1 | #include "Identifier.h" |
---|
2 | #include "Factory.h" |
---|
3 | #include "IdentifierList.h" |
---|
4 | #include "ObjectList.h" |
---|
5 | #include "Iterator.h" |
---|
6 | #include "OrxonoxClass.h" |
---|
7 | |
---|
8 | |
---|
9 | #define internRegisterRootObject(ClassName, bAbstract) \ |
---|
10 | if (Identifier::isCreatingHierarchy() && !this->getParents()) \ |
---|
11 | this->setParents(new IdentifierList()); \ |
---|
12 | this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, true, bAbstract)); \ |
---|
13 | if (Identifier::isCreatingHierarchy() && this->getParents()) \ |
---|
14 | this->getParents()->add(this->getIdentifier()); \ |
---|
15 | ClassIdentifier<ClassName>::addObject(this) |
---|
16 | |
---|
17 | #if HIERARCHY_VERBOSE |
---|
18 | #define registerRootObject(ClassName) \ |
---|
19 | std::cout << "*** Register Root-Object: " << #ClassName << "\n"; \ |
---|
20 | internRegisterRootObject(ClassName, false) |
---|
21 | #else |
---|
22 | #define registerRootObject(ClassName) \ |
---|
23 | internRegisterRootObject(ClassName, false) |
---|
24 | #endif |
---|
25 | |
---|
26 | #if HIERARCHY_VERBOSE |
---|
27 | #define registerAbstractRootObject(ClassName) \ |
---|
28 | std::cout << "*** Register abstract Root-Object: " << #ClassName << "\n"; \ |
---|
29 | internRegisterRootObject(ClassName, true) |
---|
30 | #else |
---|
31 | #define registerAbstractRootObject(ClassName) \ |
---|
32 | internRegisterRootObject(ClassName, true) |
---|
33 | #endif |
---|
34 | |
---|
35 | #define internRegisterObject(ClassName, bAbstract) \ |
---|
36 | this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, false, bAbstract)); \ |
---|
37 | if (Identifier::isCreatingHierarchy() && this->getParents()) \ |
---|
38 | this->getParents()->add(this->getIdentifier()); \ |
---|
39 | ClassIdentifier<ClassName>::addObject(this) |
---|
40 | |
---|
41 | #if HIERARCHY_VERBOSE |
---|
42 | #define registerObject(ClassName) \ |
---|
43 | std::cout << "*** Register Object: " << #ClassName << "\n"; \ |
---|
44 | internRegisterObject(ClassName, false) |
---|
45 | #else |
---|
46 | #define registerObject(ClassName) \ |
---|
47 | internRegisterObject(ClassName, false) |
---|
48 | #endif |
---|
49 | |
---|
50 | #if HIERARCHY_VERBOSE |
---|
51 | #define registerAbstractObject(ClassName) \ |
---|
52 | std::cout << "*** Register abstract Object: " << #ClassName << "\n"; \ |
---|
53 | internRegisterObject(ClassName, true) |
---|
54 | #else |
---|
55 | #define registerAbstractObject(ClassName) \ |
---|
56 | internRegisterObject(ClassName, true) |
---|
57 | #endif |
---|
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) |
---|