g4tools  5.4.0
Public Member Functions | Public Attributes | Protected Attributes | List of all members
tools::sg::holder< T > Class Template Reference
Inheritance diagram for tools::sg::holder< T >:
Inheritance graph
[legend]
Collaboration diagram for tools::sg::holder< T >:
Collaboration graph
[legend]

Public Member Functions

virtual void * cast (const std::string &a_class) const
 
virtual nodecopy () const
 
virtual const std::string & s_cls () const
 
virtual const desc_fieldsnode_desc_fields () const
 
 holder (T *a_obj=0, const std::string &a_name="", bool a_own=true)
 
virtual ~holder ()
 
 holder (const holder &a_from)
 
holderoperator= (const holder &a_from)
 
const T * object () const
 
T * object ()
 
- Public Member Functions inherited from tools::sg::base_holder
 base_holder (const std::string &a_name)
 
virtual ~base_holder ()
 
 base_holder (const base_holder &a_from)
 
base_holderoperator= (const base_holder &a_from)
 
const std::string & name () const
 
- Public Member Functions inherited from tools::sg::node
virtual unsigned int cls_version () const
 
virtual void render (render_action &)
 
virtual void pick (pick_action &)
 
virtual void bbox (bbox_action &)
 
virtual void search (search_action &a_action)
 
virtual void get_matrix (get_matrix_action &a_action)
 
virtual bool write (write_action &a_action)
 
virtual void event (event_action &)
 
virtual bool read (read_action &a_action)
 
virtual void is_visible (visible_action &)
 
virtual void protocol_one_fields (std::vector< field * > &a_fields) const
 
virtual bool draw_in_frame_buffer () const
 
virtual bool touched ()
 
virtual void reset_touched ()
 
 node ()
 
virtual ~node ()
 
void touch ()
 
fieldfield_from_desc (const field_desc &a_desc) const
 
void dump_field_descs (std::ostream &a_out) const
 
fieldfind_field_by_name (const std::string &a_name) const
 

Public Attributes

sf_string class_name
 

Protected Attributes

T * m_obj
 
bool m_own
 
- Protected Attributes inherited from tools::sg::base_holder
std::string m_name
 

Additional Inherited Members

- Protected Member Functions inherited from tools::sg::node
 node (const node &)
 
nodeoperator= (const node &)
 
void add_field (field *a_field)
 
bool write_fields (write_action &a_action)
 
bool read_fields (read_action &a_action)
 
field_desc::offset_t field_offset (const field *a_field) const
 
fieldfind_field (const field_desc &a_rdesc) const
 
void check_fields (std::ostream &a_out) const
 

Detailed Description

template<class T>
class tools::sg::holder< T >

Definition at line 37 of file holder.

Constructor & Destructor Documentation

◆ holder() [1/2]

template<class T >
tools::sg::holder< T >::holder ( T *  a_obj = 0,
const std::string &  a_name = "",
bool  a_own = true 
)
inline

Definition at line 67 of file holder.

68  :parent(a_name)
69  ,class_name(T::s_class())
70  ,m_obj(a_obj) //it takes a_obj ownership.
71  ,m_own(a_own)
72  {
73  add_fields();
74  }

◆ ~holder()

template<class T >
virtual tools::sg::holder< T >::~holder ( )
inlinevirtual

Definition at line 76 of file holder.

76 {if(m_own) delete m_obj;}

◆ holder() [2/2]

template<class T >
tools::sg::holder< T >::holder ( const holder< T > &  a_from)
inline

Definition at line 79 of file holder.

80  :parent(a_from)
81  ,class_name(std::string())
82  ,m_obj(0)
83  ,m_own(false)
84  {
85  parent::m_name.clear();
86  add_fields();
87  }

Member Function Documentation

◆ cast()

template<class T >
virtual void* tools::sg::holder< T >::cast ( const std::string &  a_class) const
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 46 of file holder.

46  {
47  if(void* p = cmp_cast< holder<T> >(this,a_class)) {return p;}
48  return parent::cast(a_class);
49  }

◆ copy()

template<class T >
virtual node* tools::sg::holder< T >::copy ( ) const
inlinevirtual

Implements tools::sg::node.

Definition at line 50 of file holder.

50 {return new holder(*this);}

◆ node_desc_fields()

template<class T >
virtual const desc_fields& tools::sg::holder< T >::node_desc_fields ( ) const
inlinevirtual

Reimplemented from tools::sg::node.

Definition at line 55 of file holder.

55  {
57  static const desc_fields s_v(parent::node_desc_fields(),1, //WARNING : take care of count.
59  );
60  return s_v;
61  }

◆ object() [1/2]

template<class T >
T* tools::sg::holder< T >::object ( )
inline

Definition at line 98 of file holder.

98 {return m_obj;}

◆ object() [2/2]

template<class T >
const T* tools::sg::holder< T >::object ( ) const
inline

Definition at line 97 of file holder.

97 {return m_obj;}

◆ operator=()

template<class T >
holder& tools::sg::holder< T >::operator= ( const holder< T > &  a_from)
inline

Definition at line 88 of file holder.

88  {
89  parent::operator=(a_from);
90  class_name.value().clear();
91  m_obj = 0;
92  m_own = false;
93  parent::m_name.clear();
94  return *this;
95  }

◆ s_cls()

template<class T >
virtual const std::string& tools::sg::holder< T >::s_cls ( ) const
inlinevirtual

Implements tools::sg::node.

Definition at line 51 of file holder.

51 {return s_class();}

Member Data Documentation

◆ class_name

template<class T >
sf_string tools::sg::holder< T >::class_name

Definition at line 53 of file holder.

◆ m_obj

template<class T >
T* tools::sg::holder< T >::m_obj
protected

Definition at line 100 of file holder.

◆ m_own

template<class T >
bool tools::sg::holder< T >::m_own
protected

Definition at line 101 of file holder.


The documentation for this class was generated from the following file:
tools::sg::holder::m_obj
T * m_obj
Definition: holder:100
tools::sg::holder::m_own
bool m_own
Definition: holder:101
tools::sg::holder
Definition: holder:37
tools::sg::base_holder::operator=
base_holder & operator=(const base_holder &a_from)
Definition: holder:25
tools::sg::base_holder::m_name
std::string m_name
Definition: holder:33
tools::sg::node::cast
virtual void * cast(const std::string &a_class) const
Definition: node:38
tools::sg::holder::holder
holder(T *a_obj=0, const std::string &a_name="", bool a_own=true)
Definition: holder:67
tools::sg::node::node_desc_fields
virtual const desc_fields & node_desc_fields() const
Definition: node:48
tools::cmp_cast
void * cmp_cast(const TO *a_this, const std::string &a_class)
Definition: scast:15
TOOLS_FIELD_DESC_NODE_CLASS
#define TOOLS_FIELD_DESC_NODE_CLASS(a__class)
Definition: field:68
tools::sg::bsf::value
T & value()
Definition: bsf:98
tools::sg::holder::class_name
sf_string class_name
Definition: holder:53
TOOLS_ARG_FIELD_DESC
#define TOOLS_ARG_FIELD_DESC(a__field)
Definition: field:71