Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
orxonox::ClassIdentifier< T > Class Template Reference

The ClassIdentifier is derived from Identifier and holds all class-specific functions and variables the Identifier cannot have. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/class/Identifier.h>

Inheritance diagram for orxonox::ClassIdentifier< T >:
orxonox::Identifier orxonox::Destroyable

Public Member Functions

 ClassIdentifier (const std::string &name, Factory *factory, bool bLoadable)
 
 ~ClassIdentifier ()
 
virtual bool canDynamicCastObjectToIdentifierClass (Identifiable *object) const override
 
virtual void destroyObjects () override
 Destroy all objects of this class (must be Listable). More...
 
virtual const std::type_info & getTypeInfo () override
 Returns the type_info of the class as it is returned by typeid(T) More...
 
bool initializeObject (T *object)
 Adds an object of the given type to the ObjectList. More...
 
virtual void updateConfigValues (bool updateChildren=true) const override
 Updates the config-values of all existing objects of this class by calling their setConfigValues() function. More...
 
- Public Member Functions inherited from orxonox::Identifier
 Identifier (const std::string &name, Factory *factory, bool bLoadable)
 Constructor: No factory, no object created, new ObjectList and a unique networkID. More...
 
 Identifier (const Identifier &)=delete
 
virtual ~Identifier ()
 Destructor: Deletes the list containing the children. More...
 
void addConfigValueContainer (const std::string &varname, ConfigValueContainer *container)
 Adds the ConfigValueContainer of a variable, given by the string of its name. More...
 
void addXMLPortObjectContainer (const std::string &sectionname, XMLPortObjectContainer *container)
 Adds a new XMLPortObjectContainer that attaches an object to this class. More...
 
void addXMLPortParamContainer (const std::string &paramname, XMLPortParamContainer *container)
 Adds a new XMLPortParamContainer that loads a parameter of this class. More...
 
Identifiablefabricate (Context *context)
 Creates an object of the type the Identifier belongs to. More...
 
void finishInitialization ()
 Finishes the initialization of this Identifier after creating the class hierarchy by wiring the (direct) parent/child references correctly. More...
 
const std::set< const Identifier * > & getChildren () const
 Returns the children of the class the Identifier belongs to. More...
 
ORX_FORCEINLINE unsigned int getClassID () const
 Returns the unique ID of the class. More...
 
ConfigValueContainergetConfigValueContainer (const std::string &varname)
 Returns the ConfigValueContainer of a variable, given by the string of its name. More...
 
const std::set< const Identifier * > & getDirectChildren () const
 Returns the direct children the class the Identifier belongs to. More...
 
const std::list< const Identifier * > & getDirectParents () const
 Returns the direct parents of the class the Identifier belongs to. More...
 
const std::string & getName () const
 Returns the name of the class the Identifier belongs to. More...
 
uint32_t getNetworkID () const
 Returns the network ID to identify a class through the network. More...
 
const std::list< const Identifier * > & getParents () const
 Returns the parents of the class the Identifier belongs to. More...
 
XMLPortObjectContainergetXMLPortObjectContainer (const std::string &sectionname)
 Returns a XMLPortObjectContainer that attaches an object to this class. More...
 
const std::map< std::string, XMLPortObjectContainer * > & getXMLPortObjectMap () const
 Returns the map that stores all XMLPort objects. More...
 
XMLPortParamContainergetXMLPortParamContainer (const std::string &paramname)
 Returns a XMLPortParamContainer that loads a parameter of this class. More...
 
const std::map< std::string, XMLPortParamContainer * > & getXMLPortParamMap () const
 Returns the map that stores all XMLPort params. More...
 
bool hasConfigValues () const
 Returns true if this class has at least one config value. More...
 
bool hasFactory () const
 Returns true if the Identifier has a Factory. More...
 
IdentifierinheritsFrom (InheritsFrom *directParent)
 Used to define the direct parents of an Identifier of an abstract class. More...
 
void initializeParents (const std::list< const Identifier * > &initializationTrace)
 Initializes the parents of this Identifier while creating the class hierarchy. More...
 
bool isA (const Identifier *identifier) const
 Returns true, if the Identifier is at least of the given type. More...
 
bool isChildOf (const Identifier *identifier) const
 Returns true, if the assigned identifier is a child of the given identifier. More...
 
bool isDirectChildOf (const Identifier *identifier) const
 Returns true, if the assigned identifier is a direct child of the given identifier. More...
 
bool isDirectParentOf (const Identifier *identifier) const
 Returns true, if the assigned identifier is a direct parent of the given identifier. More...
 
bool isExactlyA (const Identifier *identifier) const
 Returns true, if the Identifier is exactly of the given type. More...
 
bool isInitialized () const
 Returns true if the Identifier was completely initialized. More...
 
bool isLoadable () const
 Returns true if the class can be loaded through XML. More...
 
bool isParentOf (const Identifier *identifier) const
 Returns true, if the assigned identifier is a parent of the given identifier. More...
 
bool isVirtualBase () const
 Returns true if child classes should inherit virtually from this class. More...
 
Identifieroperator= (const Identifier &)=delete
 
void reset ()
 Resets all information about the class hierarchy. More...
 
void setNetworkID (uint32_t id)
 Sets the network ID to a new value and changes the entry in the ID-Identifier-map. More...
 
void setVirtualBase (bool bIsVirtualBase)
 Defines if child classes should inherit virtually from this class. More...
 
- Public Member Functions inherited from orxonox::Destroyable
 Destroyable ()
 Constructor: Sets the default values. More...
 
virtual ~Destroyable ()
 Destructor: Notifies all DestructionListener (for example weak pointers) that this object is being deleted. More...
 
void destroy ()
 Deletes the object if no strong pointers point to this object. More...
 
void destroyLater ()
 Works like destroy() but doesn't destroy the object until the current tick has ended. More...
 
unsigned int getReferenceCount () const
 Returns the number of strong pointers that point to this object. More...
 

Static Public Member Functions

static ClassIdentifier< T > * getIdentifier ()
 Returns the only instance of this class. More...
 

Private Member Functions

 ClassIdentifier (const ClassIdentifier< T > &)=delete
 
void addObjectToList (T *object, Listable *)
 Only adds the object to the object list if is a Listable. More...
 
void addObjectToList (T *object, Identifiable *)
 
void destroyObject (Destroyable *object)
 Call 'object->destroy()' for Destroyables and 'delete object' for all other types. More...
 
void destroyObject (void *object)
 
void destroyObjects (Listable *)
 Only searches and destroys objects if is a Listable. More...
 
void destroyObjects (void *)
 
ClassIdentifieroperator= (const ClassIdentifier< T > &)=delete
 
void setConfigValues (T *object, Configurable *) const
 Only configures the object if is a Configurable. More...
 
void setConfigValues (T *object, Identifiable *) const
 
void updateConfigValues (bool updateChildren, Listable *) const
 
void updateConfigValues (bool updateChildren, Identifiable *) const
 

Static Private Attributes

static WeakPtr< ClassIdentifier< T > > classIdentifier_s
 

Additional Inherited Members

- Static Public Attributes inherited from orxonox::Identifier
static bool initConfigValues_s = true
 
- Protected Member Functions inherited from orxonox::Identifier
virtual void createSuperFunctionCaller () const =0
 
- Protected Member Functions inherited from orxonox::Destroyable
virtual void preDestroy ()
 This virtual function is called if destroy() is called and no StrongPtr points to this object. More...
 

Detailed Description

template<class T>
class orxonox::ClassIdentifier< T >

The ClassIdentifier is derived from Identifier and holds all class-specific functions and variables the Identifier cannot have.

ClassIdentifier is a Singleton, which means that only one ClassIdentifier for a given type T exists. This makes it possible to store information about a class, sharing them with all objects of that class without defining static variables in every class.

To be really sure that not more than exactly one object exists (even with libraries), ClassIdentifiers are stored in a static map in Identifier.

Constructor & Destructor Documentation

template<class T>
orxonox::ClassIdentifier< T >::ClassIdentifier ( const std::string &  name,
Factory factory,
bool  bLoadable 
)
inline
template<class T>
orxonox::ClassIdentifier< T >::~ClassIdentifier ( )
inline
template<class T>
orxonox::ClassIdentifier< T >::ClassIdentifier ( const ClassIdentifier< T > &  )
privatedelete

Member Function Documentation

template<class T >
void orxonox::ClassIdentifier< T >::addObjectToList ( T *  object,
Listable listable 
)
private

Only adds the object to the object list if is a Listable.

template<class T >
void orxonox::ClassIdentifier< T >::addObjectToList ( T *  object,
Identifiable  
)
private
template<class T>
virtual bool orxonox::ClassIdentifier< T >::canDynamicCastObjectToIdentifierClass ( Identifiable object) const
inlineoverridevirtual

Implements orxonox::Identifier.

template<class T >
void orxonox::ClassIdentifier< T >::destroyObject ( Destroyable object)
private

Call 'object->destroy()' for Destroyables and 'delete object' for all other types.

template<class T >
void orxonox::ClassIdentifier< T >::destroyObject ( void object)
private
template<class T >
void orxonox::ClassIdentifier< T >::destroyObjects ( )
overridevirtual

Destroy all objects of this class (must be Listable).

Destroyables are destroyed with destroy(), all other classes with delete.

Implements orxonox::Identifier.

template<class T >
void orxonox::ClassIdentifier< T >::destroyObjects ( Listable )
private

Only searches and destroys objects if is a Listable.

template<class T >
void orxonox::ClassIdentifier< T >::destroyObjects ( void )
private
template<class T >
ClassIdentifier< T > * orxonox::ClassIdentifier< T >::getIdentifier ( )
inlinestatic

Returns the only instance of this class.

Returns
The unique Identifier
template<class T>
virtual const std::type_info& orxonox::ClassIdentifier< T >::getTypeInfo ( )
inlineoverridevirtual

Returns the type_info of the class as it is returned by typeid(T)

Implements orxonox::Identifier.

template<class T >
bool orxonox::ClassIdentifier< T >::initializeObject ( T *  object)

Adds an object of the given type to the ObjectList.

Parameters
objectThe object to add
template<class T>
ClassIdentifier& orxonox::ClassIdentifier< T >::operator= ( const ClassIdentifier< T > &  )
privatedelete
template<class T >
void orxonox::ClassIdentifier< T >::setConfigValues ( T *  object,
Configurable  
) const
private

Only configures the object if is a Configurable.

template<class T >
void orxonox::ClassIdentifier< T >::setConfigValues ( T *  object,
Identifiable  
) const
private
template<class T >
void orxonox::ClassIdentifier< T >::updateConfigValues ( bool  updateChildren = true) const
overridevirtual

Updates the config-values of all existing objects of this class by calling their setConfigValues() function.

Implements orxonox::Identifier.

template<class T >
void orxonox::ClassIdentifier< T >::updateConfigValues ( bool  updateChildren,
Listable  
) const
private
template<class T >
void orxonox::ClassIdentifier< T >::updateConfigValues ( bool  updateChildren,
Identifiable  
) const
private

Member Data Documentation

template<class T>
WeakPtr< ClassIdentifier< T > > orxonox::ClassIdentifier< T >::classIdentifier_s
staticprivate

The documentation for this class was generated from the following file: