This class manages the type infos. More...
#include "TypeSys.hpp"
Public Member Functions | |
TypeInfoManT () | |
The constructor. More... | |
void | Register (TypeInfoT *TI) |
Registers the given TypeInfoT with this type info manager. More... | |
void | Init () |
Completes the initialization of the TypeInfoManT and the registered type infos. More... | |
const TypeInfoT * | FindTypeInfoByName (const char *ClassName) const |
Returns the type info matching the class name ClassName. More... | |
const TypeInfoT * | FindTypeInfoByNr (unsigned long TypeNr) const |
Returns the type info matching the type number TypeNr. More... | |
const ArrayT< const TypeInfoT * > & | GetTypeInfosByName () const |
Returns all type infos registered with this TypeInfoManT, ordered by name. More... | |
const ArrayT< const TypeInfoT * > & | GetTypeInfosByNr () const |
Returns all type infos registered with this TypeInfoManT, ordered by type number. More... | |
const ArrayT< const TypeInfoT * > & | GetTypeInfoRoots () const |
Returns the roots of the inheritance trees. (Normally there should only be one root.) More... | |
This class manages the type infos.
Intended usage: Each entity class that occurs in the game keeps a static TypeInfoT member (plus a non-static, virtual GetTypeInfo() method that returns that member). The constructor of each such TypeInfoT member registers its own this-pointer with an instance of this class, so that when main() begins, the TypeInfoManT is aware of all TypeInfoTs and thus all entity classes. Its Init() method then completes the type initialization.
TypeInfoManT::TypeInfoManT | ( | ) |
The constructor.
const TypeInfoT * TypeInfoManT::FindTypeInfoByName | ( | const char * | ClassName | ) | const |
Returns the type info matching the class name ClassName.
const TypeInfoT * TypeInfoManT::FindTypeInfoByNr | ( | unsigned long | TypeNr | ) | const |
Returns the type info matching the type number TypeNr.
Returns the roots of the inheritance trees. (Normally there should only be one root.)
Returns all type infos registered with this TypeInfoManT, ordered by name.
Returns all type infos registered with this TypeInfoManT, ordered by type number.
GetTypeInfosByNr()[i]->TypeNr == i
void TypeInfoManT::Init | ( | ) |
Completes the initialization of the TypeInfoManT and the registered type infos.
Should be called exactly once before any other TypeInfoManT method is called.
void TypeInfoManT::Register | ( | TypeInfoT * | TI | ) |