Last change
on this file since 3900 was
3900,
checked in by bensch, 19 years ago
|
orxonox/branches/levelLoader.tmp: added some files from the XML-parser
|
File size:
624 bytes
|
Line | |
---|
1 | /*! |
---|
2 | \file factory.h |
---|
3 | \brief This File creates a class, that can load any Object |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _FACTORY_H |
---|
7 | #define _FACTORY_H |
---|
8 | |
---|
9 | |
---|
10 | #define CREATE_FACTORY(x) \ |
---|
11 | class x ## Factory : public Factory { \ |
---|
12 | public: \ |
---|
13 | x ## Factory (){setNext( NULL); setClassname( #x ); initialize();} \ |
---|
14 | ~x ## Factory () {}; \ |
---|
15 | private: \ |
---|
16 | BaseObject* fabricate( TiXmlElement* root) \ |
---|
17 | { \ |
---|
18 | if(!strcmp(root->Value(), getClassname())) return new x ( root); \ |
---|
19 | else if( getNext() != NULL) return getNext()->fabricate( root); \ |
---|
20 | else return NULL; \ |
---|
21 | } \ |
---|
22 | }; \ |
---|
23 | x ## Factory global_ ## x ## Factory; |
---|
24 | |
---|
25 | #endif /* _FACTORY_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.