Changeset 3530 in orxonox.OLD for orxonox/branches/levelloader/src/factory.h
- Timestamp:
- Mar 13, 2005, 10:40:25 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/factory.h
r3525 r3530 8 8 9 9 #include "stdincl.h" 10 #include "world.h"11 10 12 #define CREATE_FACTORY(CLASS) class CLASSFactory : public Factory { \ 13 public: \ 14 CLASSFactory (){setNext( NULL); setClassname = "CLASS"; initialize();} \ 15 ~CLASSFactory (); \ 16 private: \ 17 BaseObject* fabricate( TiXmlElement* root) \ 18 { \ 19 if(!strcmp(root->Value(), getClassname())) return new CLASS( root); \ 20 else if( next != NULL) return next->fabricate( root); \ 21 else return NULL; \ 22 } \ 23 }; \ 24 CLASSFactory global_CLASSFactory; 11 class BaseObject; 25 12 26 13 //! The Factory is … … 37 24 void initialize(); 38 25 void registerFactory( Factory* factory); 39 void setClassname(char* name) {classname = name}; 40 char* getClassname() {return classname}; 41 void setNext( ObjectFactory* factory) {next = factory}; 26 void setClassname(char* name) {classname = name;} 27 char* getClassname() {return classname;}; 28 void setNext( Factory* factory) {next = factory;} 29 Factory* getNext() {return next;} 42 30 43 31 private:
Note: See TracChangeset
for help on using the changeset viewer.