Changeset 4003 in orxonox.OLD for orxonox/branches/ll2trunktemp/src/factory.h
- Timestamp:
- Apr 28, 2005, 2:25:08 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/ll2trunktemp/src/factory.h
r3940 r4003 11 11 #include "xmlparser/tinyxml.h" 12 12 13 #define CREATE_FACTORY(x) \ 14 class x ## Factory : public Factory { \ 15 public: \ 16 x ## Factory (){setClassname( #x );} \ 17 ~x ## Factory () {}; \ 18 private: \ 19 BaseObject* fabricate( TiXmlElement* root) \ 20 { \ 21 if(!strcmp(root->Value(), getClassname())) return new x ( root); \ 22 else if( getNext() != NULL) return getNext()->fabricate( root); \ 23 else return NULL; \ 24 } \ 25 }; \ 26 x ## Factory global_ ## x ## Factory; 27 13 28 //! The Factory is 14 29 /** 15 30 Very philosophic description, huh? 16 31 */ 17 32 class Factory { … … 20 35 Factory (); 21 36 ~Factory (); 37 22 38 23 24 25 26 27 28 29 39 virtual BaseObject* fabricate( TiXmlElement* root); 40 void initialize(); 41 void registerFactory( Factory* factory); 42 void setClassname(char* name) {classname = name;} 43 char* getClassname() {return classname;}; 44 void setNext( Factory* factory) {next = factory;} 45 Factory* getNext() {return next;} 30 46 31 47 private: 32 48 char* classname; 33 49 34 50 Factory* next;
Note: See TracChangeset
for help on using the changeset viewer.