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