Orxonox
0.0.5 Codename: Arcturus
|
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>
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 §ionname, XMLPortObjectContainer *container) |
Adds a new XMLPortObjectContainer that attaches an object to this class. More... | |
void | addXMLPortParamContainer (const std::string ¶mname, 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 |
Identifiable * | fabricate (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... | |
ConfigValueContainer * | getConfigValueContainer (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... | |
XMLPortObjectContainer * | getXMLPortObjectContainer (const std::string §ionname) |
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... | |
XMLPortParamContainer * | getXMLPortParamContainer (const std::string ¶mname) |
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... | |
Identifier & | inheritsFrom (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... | |
Identifier & | operator= (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... | |
Factory * | factory_ |
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... | |
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().
orxonox::Identifier::Identifier | ( | const std::string & | name, |
Factory * | factory, | ||
bool | bLoadable | ||
) |
Constructor: No factory, no object created, new ObjectList and a unique networkID.
|
virtual |
Destructor: Deletes the list containing the children.
|
delete |
void orxonox::Identifier::addConfigValueContainer | ( | const std::string & | varname, |
ConfigValueContainer * | container | ||
) |
Adds the ConfigValueContainer of a variable, given by the string of its name.
varname | The name of the variablee |
container | The container |
|
private |
Adds.
identifierToAdd | to |
list | if 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.
sectionname | The name of the section that contains the attachable objects |
container | The container |
void orxonox::Identifier::addXMLPortParamContainer | ( | const std::string & | paramname, |
XMLPortParamContainer * | container | ||
) |
Adds a new XMLPortParamContainer that loads a parameter of this class.
paramname | The name of the parameter |
container | The container |
|
pure virtual |
Implemented in orxonox::ClassIdentifier< T >.
|
protectedpure virtual |
|
pure virtual |
Implemented in orxonox::ClassIdentifier< T >.
Identifiable * orxonox::Identifier::fabricate | ( | Context * | context | ) |
Creates an object of the type the Identifier belongs to.
void orxonox::Identifier::finishInitialization | ( | ) |
Finishes the initialization of this Identifier after creating the class hierarchy by wiring the (direct) parent/child references correctly.
|
inline |
Returns the children of the class the Identifier belongs to.
|
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.
varname | The name of the variable |
|
inline |
Returns the direct children the class the Identifier belongs to.
|
inline |
Returns the direct parents of the class the Identifier belongs to.
|
inline |
Returns the name of the class the Identifier belongs to.
|
inline |
Returns the network ID to identify a class through the network.
|
inline |
Returns the parents of the class the Identifier belongs to.
|
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.
sectionname | The name of the section that contains the attachable objects |
|
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.
paramname | The name of the parameter |
|
inline |
Returns the map that stores all XMLPort params.
|
inline |
Returns true if this class has at least one config value.
|
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.
initializationTrace | All 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.
identifier | The 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.
identifier | The 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.
identifier | The 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.
identifier | The identifier to compare with |
bool orxonox::Identifier::isExactlyA | ( | const Identifier * | identifier | ) | const |
Returns true, if the Identifier is exactly of the given type.
identifier | The identifier to compare with |
|
inline |
Returns true if the Identifier was completely initialized.
|
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.
identifier | The identifier to compare with |
|
inline |
Returns true if child classes should inherit virtually from this class.
|
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.
|
inline |
Defines if child classes should inherit virtually from this class.
|
pure virtual |
Implemented in orxonox::ClassIdentifier< T >.
|
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.
|
private |
True if this class has at least one assigned config value.
|
private |
Is true if the Identifier was completely initialized.
|
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.
|
private |
False = it's not permitted to load the object through XML.
|
private |
The children of the class the Identifier belongs to.
|
private |
Uniquely identifies a class (might not be the same as the networkID_)
|
private |
A map to link the string of configurable variables with their ConfigValueContainer.
|
private |
The direct children of the class the Identifier belongs to.
|
private |
The direct parents of the class the Identifier belongs to (sorted by their order of initialization)
|
private |
The Factory, able to create new objects of the given class (if available)
|
static |
|
private |
Manually defined direct parents.
|
private |
The name of the class the Identifier belongs to.
|
private |
The network ID to identify a class through the network.
|
private |
The parents of the class the Identifier belongs to (sorted by their order of initialization)
|
private |
All attachable objects.
|
private |
All loadable parameters.