Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/objecthierarchie/src/IdentifierIncludes.h @ 220

Last change on this file since 220 was 220, checked in by landauf, 12 years ago
  • fixed a small bug in the object hierarchy
  • new objects are now added to all class-lists they're derived from (until now they were only added to the list of their class). this means: i'm replacing the tree-structure by a mountain-one, which costs more memory but allows faster iteration.
File size: 1.9 KB
Line 
1#include "Identifier.h"
2#include "Factory.h"
3#include "IdentifierList.h"
4#include "ObjectList.h"
5#include "OrxonoxClass.h"
6
7
8#define internRegisterRootObject(ClassName, bAbstract) \
9    if (Identifier::isCreatingHierarchy() && !this->getParents()) \
10        this->setParents(new IdentifierList()); \
11    this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, true, bAbstract)); \
12    if (Identifier::isCreatingHierarchy() && this->getParents()) \
13        this->getParents()->add(this->getIdentifier()); \
14    this->getIdentifier()->addObject(this)
15
16#define registerRootObject(ClassName) \
17    std::cout << "*** Register Root-Object: " << #ClassName << "\n"; \
18    internRegisterRootObject(ClassName, false)
19
20#define registerAbstractRootObject(ClassName) \
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)); \
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    internRegisterObject(ClassName, false)
33
34#define registerAbstractObject(ClassName) \
35    std::cout << "*** Register abstract Object: " << #ClassName << "\n"; \
36    internRegisterObject(ClassName, true)
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)
Note: See TracBrowser for help on using the repository browser.