[197] | 1 | #include "Identifier.h" |
---|
[218] | 2 | #include "Factory.h" |
---|
[197] | 3 | #include "IdentifierList.h" |
---|
| 4 | #include "ObjectList.h" |
---|
[221] | 5 | #include "Iterator.h" |
---|
[197] | 6 | #include "OrxonoxClass.h" |
---|
[219] | 7 | |
---|
| 8 | |
---|
[220] | 9 | #define internRegisterRootObject(ClassName, bAbstract) \ |
---|
[219] | 10 | if (Identifier::isCreatingHierarchy() && !this->getParents()) \ |
---|
| 11 | this->setParents(new IdentifierList()); \ |
---|
[220] | 12 | this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, true, bAbstract)); \ |
---|
[219] | 13 | if (Identifier::isCreatingHierarchy() && this->getParents()) \ |
---|
| 14 | this->getParents()->add(this->getIdentifier()); \ |
---|
[224] | 15 | ClassIdentifier<ClassName>::addObject(this) |
---|
[219] | 16 | |
---|
[231] | 17 | #if HIERARCHY_VERBOSE |
---|
[220] | 18 | #define registerRootObject(ClassName) \ |
---|
| 19 | std::cout << "*** Register Root-Object: " << #ClassName << "\n"; \ |
---|
| 20 | internRegisterRootObject(ClassName, false) |
---|
[231] | 21 | #else |
---|
| 22 | #define registerRootObject(ClassName) \ |
---|
| 23 | internRegisterRootObject(ClassName, false) |
---|
| 24 | #endif |
---|
[220] | 25 | |
---|
[231] | 26 | #if HIERARCHY_VERBOSE |
---|
[219] | 27 | #define registerAbstractRootObject(ClassName) \ |
---|
[220] | 28 | std::cout << "*** Register abstract Root-Object: " << #ClassName << "\n"; \ |
---|
| 29 | internRegisterRootObject(ClassName, true) |
---|
[231] | 30 | #else |
---|
| 31 | #define registerAbstractRootObject(ClassName) \ |
---|
| 32 | internRegisterRootObject(ClassName, true) |
---|
| 33 | #endif |
---|
[220] | 34 | |
---|
| 35 | #define internRegisterObject(ClassName, bAbstract) \ |
---|
| 36 | this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, false, bAbstract)); \ |
---|
[219] | 37 | if (Identifier::isCreatingHierarchy() && this->getParents()) \ |
---|
| 38 | this->getParents()->add(this->getIdentifier()); \ |
---|
[224] | 39 | ClassIdentifier<ClassName>::addObject(this) |
---|
[219] | 40 | |
---|
[231] | 41 | #if HIERARCHY_VERBOSE |
---|
[219] | 42 | #define registerObject(ClassName) \ |
---|
| 43 | std::cout << "*** Register Object: " << #ClassName << "\n"; \ |
---|
[220] | 44 | internRegisterObject(ClassName, false) |
---|
[231] | 45 | #else |
---|
| 46 | #define registerObject(ClassName) \ |
---|
| 47 | internRegisterObject(ClassName, false) |
---|
| 48 | #endif |
---|
[219] | 49 | |
---|
[231] | 50 | #if HIERARCHY_VERBOSE |
---|
[219] | 51 | #define registerAbstractObject(ClassName) \ |
---|
[220] | 52 | std::cout << "*** Register abstract Object: " << #ClassName << "\n"; \ |
---|
| 53 | internRegisterObject(ClassName, true) |
---|
[231] | 54 | #else |
---|
| 55 | #define registerAbstractObject(ClassName) \ |
---|
| 56 | internRegisterObject(ClassName, true) |
---|
| 57 | #endif |
---|
[219] | 58 | |
---|
| 59 | #define unregisterObject() \ |
---|
| 60 | this->getIdentifier()->removeObject(this) |
---|
| 61 | |
---|
| 62 | #define Class(ClassName) \ |
---|
| 63 | ClassIdentifier<ClassName>::getIdentifier() |
---|
| 64 | |
---|
| 65 | #define CreateFactory(ClassName) \ |
---|
| 66 | Identifier* global_##ClassName##_Identifier = ClassIdentifier<ClassName>::getIdentifier() |
---|
| 67 | |
---|
| 68 | #define Factory(Name) \ |
---|
| 69 | ClassFactory::fabricate(Name) |
---|