[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 | |
---|
| 8 | #define registerRootObject(ClassName) \ |
---|
| 9 | std::cout << "*** Register Root-Object: " << #ClassName << "\n"; \ |
---|
| 10 | if (Identifier::isCreatingHierarchy() && !this->getParents()) \ |
---|
| 11 | this->setParents(new IdentifierList()); \ |
---|
| 12 | if (this->getIdentifier()) \ |
---|
| 13 | this->getIdentifier()->removeObject(this); \ |
---|
| 14 | this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, true, false)); \ |
---|
| 15 | if (Identifier::isCreatingHierarchy() && this->getParents()) \ |
---|
| 16 | this->getParents()->add(this->getIdentifier()); \ |
---|
| 17 | this->getIdentifier()->addObject(this) |
---|
| 18 | |
---|
| 19 | #define registerAbstractRootObject(ClassName) \ |
---|
| 20 | std::cout << "*** Register Root-Object: " << #ClassName << "\n"; \ |
---|
| 21 | if (Identifier::isCreatingHierarchy() && !this->getParents()) \ |
---|
| 22 | this->setParents(new IdentifierList()); \ |
---|
| 23 | if (this->getIdentifier()) \ |
---|
| 24 | this->getIdentifier()->removeObject(this); \ |
---|
| 25 | this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, true, true)); \ |
---|
| 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"; \ |
---|
| 32 | this->getIdentifier()->removeObject(this); \ |
---|
| 33 | this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, false, false)); \ |
---|
| 34 | if (Identifier::isCreatingHierarchy() && this->getParents()) \ |
---|
| 35 | this->getParents()->add(this->getIdentifier()); \ |
---|
| 36 | this->getIdentifier()->addObject(this) |
---|
| 37 | |
---|
| 38 | #define registerAbstractObject(ClassName) \ |
---|
| 39 | std::cout << "*** Register Object: " << #ClassName << "\n"; \ |
---|
| 40 | this->getIdentifier()->removeObject(this); \ |
---|
| 41 | this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, false, true)); \ |
---|
| 42 | if (Identifier::isCreatingHierarchy() && this->getParents()) \ |
---|
| 43 | this->getParents()->add(this->getIdentifier()); \ |
---|
| 44 | this->getIdentifier()->addObject(this) |
---|
| 45 | |
---|
| 46 | #define unregisterObject() \ |
---|
| 47 | this->getIdentifier()->removeObject(this) |
---|
| 48 | |
---|
| 49 | #define Class(ClassName) \ |
---|
| 50 | ClassIdentifier<ClassName>::getIdentifier() |
---|
| 51 | |
---|
| 52 | #define CreateFactory(ClassName) \ |
---|
| 53 | Identifier* global_##ClassName##_Identifier = ClassIdentifier<ClassName>::getIdentifier() |
---|
| 54 | |
---|
| 55 | #define Factory(Name) \ |
---|
| 56 | ClassFactory::fabricate(Name) |
---|