- Timestamp:
- Dec 1, 2007, 4:24:56 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/core/IdentifierIncludes.h
r362 r365 1 /** 2 @file IDentifierIncludes.h 3 @brief Definition of macros for the class-hierarchy and the factory. 4 5 Every class needs the RegisterObject(class) macro in its constructor. If the class is an interface 6 or the BaseObject itself, it needs the macro RegisterRootObject(class) instead. 7 8 To allow the object being created through the factory, use the CreateFactory(class) macro outside 9 the of the class implementation, so it gets executed before main(). 10 */ 11 12 // All needed header-files 1 13 #include "Identifier.h" 2 14 #include "Factory.h" … … 6 18 7 19 20 // Intern macro, containing the common parts of RegisterObject and RegisterRootObject 8 21 #define InternRegisterObject(ClassName, bRootClass) \ 9 22 this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, bRootClass)); \ … … 12 25 ClassIdentifier<ClassName>::addObject(this) 13 26 27 // Intern macro, containing the specific part of RegisterRootObject 14 28 #define InternRegisterRootObject(ClassName) \ 15 29 if (Identifier::isCreatingHierarchy() && !this->getParents()) \ … … 17 31 InternRegisterObject(ClassName, true) 18 32 33 // RegisterObject - with and without debug output 19 34 #if HIERARCHY_VERBOSE 20 35 #define RegisterObject(ClassName) \ … … 26 41 #endif 27 42 43 // RegisterRootObject - with and without debug output 28 44 #if HIERARCHY_VERBOSE 29 45 #define RegisterRootObject(ClassName) \ … … 35 51 #endif 36 52 53 // Class(ClassName) returns the Identifier of the given class 37 54 #define Class(ClassName) \ 38 55 ClassIdentifier<ClassName>::getIdentifier() 39 56 57 // Creates the entry in the Factory 40 58 #define CreateFactory(ClassName) \ 41 59 bool bCreated##ClassName##Factory = ClassFactory<ClassName>::create() 42 60 43 #define ID(NameOrID) \ 44 Factory::getIdentifier(NameOrID) 61 // ID(StringOrInt) returns the Identifier with either a given name or a given NetworkID through the factory 62 #define ID(StringOrInt) \ 63 Factory::getIdentifier(StringOrInt)
Note: See TracChangeset
for help on using the changeset viewer.