Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 221 was 221, checked in by landauf, 16 years ago
  • made ObjectList double-linked to allow forward- and backward-iterating. its now a LI(F/L)O list.
  • added an iterator to iterate through object-lists. you can iterate forwards and backwards.

iterating forwards is easy: you get "0 1 2 … last"
iterating backwards is a bit tricky: you still get "0" first, but then "last … 2 1".
thats caused by the structure of the for-loop: you get the first element before the iterator knows if you'll increase or decrease it

File size: 1.9 KB
Line 
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    this->getIdentifier()->addObject(this)
16
17#define registerRootObject(ClassName) \
18    std::cout << "*** Register Root-Object: " << #ClassName << "\n"; \
19    internRegisterRootObject(ClassName, false)
20
21#define registerAbstractRootObject(ClassName) \
22    std::cout << "*** Register abstract Root-Object: " << #ClassName << "\n"; \
23    internRegisterRootObject(ClassName, true)
24
25#define internRegisterObject(ClassName, bAbstract) \
26    this->setIdentifier(ClassIdentifier<ClassName>::registerClass(this->getParents(), #ClassName, false, bAbstract)); \
27    if (Identifier::isCreatingHierarchy() && this->getParents()) \
28        this->getParents()->add(this->getIdentifier()); \
29    this->getIdentifier()->addObject(this)
30
31#define registerObject(ClassName) \
32    std::cout << "*** Register Object: " << #ClassName << "\n"; \
33    internRegisterObject(ClassName, false)
34
35#define registerAbstractObject(ClassName) \
36    std::cout << "*** Register abstract Object: " << #ClassName << "\n"; \
37    internRegisterObject(ClassName, true)
38
39#define unregisterObject() \
40    this->getIdentifier()->removeObject(this)
41
42#define Class(ClassName) \
43    ClassIdentifier<ClassName>::getIdentifier()
44
45#define CreateFactory(ClassName) \
46    Identifier* global_##ClassName##_Identifier = ClassIdentifier<ClassName>::getIdentifier()
47
48#define Factory(Name) \
49    ClassFactory::fabricate(Name)
Note: See TracBrowser for help on using the repository browser.