Orxonox  0.0.5 Codename: Arcturus
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
orxonox::Identifier Class Referenceabstract

The Identifier is used to identify the class of an object and to store information about the class. More...

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

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

Classes

struct  InheritsFrom
 helper class to manually define inheritance More...
 

Public Member Functions

 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...
 
virtual bool canDynamicCastObjectToIdentifierClass (Identifiable *object) const =0
 
virtual void destroyObjects ()=0
 
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...
 
virtual const std::type_info & getTypeInfo ()=0
 Returns the type_info of the class as it is returned by typeid(T) 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...
 
virtual void updateConfigValues (bool updateChildren=true) const =0
 
- 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 Attributes

static bool initConfigValues_s = true
 

Protected Member Functions

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...
 

Private Member Functions

void addIfNotExists (std::list< const Identifier * > &list, const Identifier *identifierToAdd) const
 Adds. More...
 
void verifyIdentifierTrace () const
 Verifies if the recorded trace of parent identifiers matches the expected trace according to the class hierarchy. More...
 

Private Attributes

bool bHasConfigValues_
 True if this class has at least one assigned config value. More...
 
bool bInitialized_
 Is true if the Identifier was completely initialized. More...
 
bool bIsVirtualBase_
 If true, it is recommended to inherit virtually from this class. This changes the order of initialization of child classes, thus this information is necessary to check the class hierarchy. More...
 
bool bLoadable_
 False = it's not permitted to load the object through XML. More...
 
std::set< const Identifier * > children_
 The children of the class the Identifier belongs to. More...
 
unsigned int classID_
 Uniquely identifies a class (might not be the same as the networkID_) More...
 
std::map< std::string, ConfigValueContainer * > configValues_
 A map to link the string of configurable variables with their ConfigValueContainer. More...
 
std::set< const Identifier * > directChildren_
 The direct children of the class the Identifier belongs to. More...
 
std::list< const Identifier * > directParents_
 The direct parents of the class the Identifier belongs to (sorted by their order of initialization) More...
 
Factoryfactory_
 The Factory, able to create new objects of the given class (if available) More...
 
std::list< const InheritsFrom * > manualDirectParents_
 Manually defined direct parents. More...
 
std::string name_
 The name of the class the Identifier belongs to. More...
 
uint32_t networkID_
 The network ID to identify a class through the network. More...
 
std::list< const Identifier * > parents_
 The parents of the class the Identifier belongs to (sorted by their order of initialization) More...
 
std::map< std::string, XMLPortObjectContainer * > xmlportObjectContainers_
 All attachable objects. More...
 
std::map< std::string, XMLPortParamContainer * > xmlportParamContainers_
 All loadable parameters. More...
 

Detailed Description

The Identifier is used to identify the class of an object and to store information about the class.

Each Identifier stores information about one class. The Identifier can then be used to identify this class. On the other hand it's also possible to get the corresponding Identifier of a class, for example by using the macro Class().

See also
See Identifier.h for more information and some examples.
Note
You can't directly create an Identifier, it's just the base-class of ClassIdentifier<T>.

Constructor & Destructor Documentation

orxonox::Identifier::Identifier ( const std::string &  name,
Factory factory,
bool  bLoadable 
)

Constructor: No factory, no object created, new ObjectList and a unique networkID.

orxonox::Identifier::~Identifier ( )
virtual

Destructor: Deletes the list containing the children.

orxonox::Identifier::Identifier ( const Identifier )
delete

Member Function Documentation

void orxonox::Identifier::addConfigValueContainer ( const std::string &  varname,
ConfigValueContainer container 
)

Adds the ConfigValueContainer of a variable, given by the string of its name.

Parameters
varnameThe name of the variablee
containerThe container
void orxonox::Identifier::addIfNotExists ( std::list< const Identifier * > &  list,
const Identifier identifierToAdd 
) const
private

Adds.

Parameters
identifierToAddto
listif this identifier is not already contained in the list.
void orxonox::Identifier::addXMLPortObjectContainer ( const std::string &  sectionname,
XMLPortObjectContainer container 
)

Adds a new XMLPortObjectContainer that attaches an object to this class.

Parameters
sectionnameThe name of the section that contains the attachable objects
containerThe container
void orxonox::Identifier::addXMLPortParamContainer ( const std::string &  paramname,
XMLPortParamContainer container 
)

Adds a new XMLPortParamContainer that loads a parameter of this class.

Parameters
paramnameThe name of the parameter
containerThe container
virtual bool orxonox::Identifier::canDynamicCastObjectToIdentifierClass ( Identifiable object) const
pure virtual
virtual void orxonox::Identifier::createSuperFunctionCaller ( ) const
protectedpure virtual
virtual void orxonox::Identifier::destroyObjects ( )
pure virtual
Identifiable * orxonox::Identifier::fabricate ( Context context)

Creates an object of the type the Identifier belongs to.

Returns
The new object
void orxonox::Identifier::finishInitialization ( )

Finishes the initialization of this Identifier after creating the class hierarchy by wiring the (direct) parent/child references correctly.

const std::set<const Identifier*>& orxonox::Identifier::getChildren ( ) const
inline

Returns the children of the class the Identifier belongs to.

ORX_FORCEINLINE unsigned int orxonox::Identifier::getClassID ( ) const
inline

Returns the unique ID of the class.

ConfigValueContainer * orxonox::Identifier::getConfigValueContainer ( const std::string &  varname)

Returns the ConfigValueContainer of a variable, given by the string of its name.

Parameters
varnameThe name of the variable
Returns
The ConfigValueContainer
const std::set<const Identifier*>& orxonox::Identifier::getDirectChildren ( ) const
inline

Returns the direct children the class the Identifier belongs to.

const std::list<const Identifier*>& orxonox::Identifier::getDirectParents ( ) const
inline

Returns the direct parents of the class the Identifier belongs to.

const std::string& orxonox::Identifier::getName ( void  ) const
inline

Returns the name of the class the Identifier belongs to.

uint32_t orxonox::Identifier::getNetworkID ( ) const
inline

Returns the network ID to identify a class through the network.

const std::list<const Identifier*>& orxonox::Identifier::getParents ( ) const
inline

Returns the parents of the class the Identifier belongs to.

virtual const std::type_info& orxonox::Identifier::getTypeInfo ( )
pure virtual

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

Implemented in orxonox::ClassIdentifier< T >.

XMLPortObjectContainer * orxonox::Identifier::getXMLPortObjectContainer ( const std::string &  sectionname)

Returns a XMLPortObjectContainer that attaches an object to this class.

Parameters
sectionnameThe name of the section that contains the attachable objects
Returns
The container
const std::map<std::string, XMLPortObjectContainer*>& orxonox::Identifier::getXMLPortObjectMap ( ) const
inline

Returns the map that stores all XMLPort objects.

XMLPortParamContainer * orxonox::Identifier::getXMLPortParamContainer ( const std::string &  paramname)

Returns a XMLPortParamContainer that loads a parameter of this class.

Parameters
paramnameThe name of the parameter
Returns
The container
const std::map<std::string, XMLPortParamContainer*>& orxonox::Identifier::getXMLPortParamMap ( ) const
inline

Returns the map that stores all XMLPort params.

bool orxonox::Identifier::hasConfigValues ( ) const
inline

Returns true if this class has at least one config value.

bool orxonox::Identifier::hasFactory ( ) const
inline

Returns true if the Identifier has a Factory.

Identifier & orxonox::Identifier::inheritsFrom ( InheritsFrom directParent)

Used to define the direct parents of an Identifier of an abstract class.

void orxonox::Identifier::initializeParents ( const std::list< const Identifier * > &  initializationTrace)

Initializes the parents of this Identifier while creating the class hierarchy.

Parameters
initializationTraceAll identifiers that were recorded while creating an instance of this class (including nested classes and this identifier itself)
bool orxonox::Identifier::isA ( const Identifier identifier) const

Returns true, if the Identifier is at least of the given type.

Parameters
identifierThe identifier to compare with
bool orxonox::Identifier::isChildOf ( const Identifier identifier) const

Returns true, if the assigned identifier is a child of the given identifier.

Parameters
identifierThe identifier to compare with
bool orxonox::Identifier::isDirectChildOf ( const Identifier identifier) const

Returns true, if the assigned identifier is a direct child of the given identifier.

Parameters
identifierThe identifier to compare with
bool orxonox::Identifier::isDirectParentOf ( const Identifier identifier) const

Returns true, if the assigned identifier is a direct parent of the given identifier.

Parameters
identifierThe identifier to compare with
bool orxonox::Identifier::isExactlyA ( const Identifier identifier) const

Returns true, if the Identifier is exactly of the given type.

Parameters
identifierThe identifier to compare with
bool orxonox::Identifier::isInitialized ( ) const
inline

Returns true if the Identifier was completely initialized.

bool orxonox::Identifier::isLoadable ( ) const
inline

Returns true if the class can be loaded through XML.

bool orxonox::Identifier::isParentOf ( const Identifier identifier) const

Returns true, if the assigned identifier is a parent of the given identifier.

Parameters
identifierThe identifier to compare with
bool orxonox::Identifier::isVirtualBase ( ) const
inline

Returns true if child classes should inherit virtually from this class.

Identifier& orxonox::Identifier::operator= ( const Identifier )
delete
void orxonox::Identifier::reset ( )

Resets all information about the class hierarchy.

The identifier is considered uninitialized afterwards.

void orxonox::Identifier::setNetworkID ( uint32_t  id)

Sets the network ID to a new value and changes the entry in the ID-Identifier-map.

void orxonox::Identifier::setVirtualBase ( bool  bIsVirtualBase)
inline

Defines if child classes should inherit virtually from this class.

virtual void orxonox::Identifier::updateConfigValues ( bool  updateChildren = true) const
pure virtual
void orxonox::Identifier::verifyIdentifierTrace ( ) const
private

Verifies if the recorded trace of parent identifiers matches the expected trace according to the class hierarchy.

If it doesn't match, the class hierarchy is likely wrong, e.g. due to wrong inheritsFrom<>() definitions in abstract classes.

Member Data Documentation

bool orxonox::Identifier::bHasConfigValues_
private

True if this class has at least one assigned config value.

bool orxonox::Identifier::bInitialized_
private

Is true if the Identifier was completely initialized.

bool orxonox::Identifier::bIsVirtualBase_
private

If true, it is recommended to inherit virtually from this class. This changes the order of initialization of child classes, thus this information is necessary to check the class hierarchy.

bool orxonox::Identifier::bLoadable_
private

False = it's not permitted to load the object through XML.

std::set<const Identifier*> orxonox::Identifier::children_
private

The children of the class the Identifier belongs to.

unsigned int orxonox::Identifier::classID_
private

Uniquely identifies a class (might not be the same as the networkID_)

std::map<std::string, ConfigValueContainer*> orxonox::Identifier::configValues_
private

A map to link the string of configurable variables with their ConfigValueContainer.

std::set<const Identifier*> orxonox::Identifier::directChildren_
private

The direct children of the class the Identifier belongs to.

std::list<const Identifier*> orxonox::Identifier::directParents_
private

The direct parents of the class the Identifier belongs to (sorted by their order of initialization)

Factory* orxonox::Identifier::factory_
private

The Factory, able to create new objects of the given class (if available)

bool orxonox::Identifier::initConfigValues_s = true
static
std::list<const InheritsFrom*> orxonox::Identifier::manualDirectParents_
private

Manually defined direct parents.

std::string orxonox::Identifier::name_
private

The name of the class the Identifier belongs to.

uint32_t orxonox::Identifier::networkID_
private

The network ID to identify a class through the network.

std::list<const Identifier*> orxonox::Identifier::parents_
private

The parents of the class the Identifier belongs to (sorted by their order of initialization)

std::map<std::string, XMLPortObjectContainer*> orxonox::Identifier::xmlportObjectContainers_
private

All attachable objects.

std::map<std::string, XMLPortParamContainer*> orxonox::Identifier::xmlportParamContainers_
private

All loadable parameters.


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