Changeset 4730 in orxonox.OLD for orxonox/trunk/src/util
- Timestamp:
- Jun 29, 2005, 1:46:15 AM (20 years ago)
- Location:
- orxonox/trunk/src/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/loading/factory.cc
r4729 r4730 35 35 this->setName(factoryName); 36 36 37 if (Factory::first == NULL) 38 Factory::first = this; 37 39 next = NULL; 38 40 39 41 initialize(); 40 42 } 43 44 Factory* Factory::first = NULL; 41 45 42 46 /** … … 55 59 56 60 /** 57 \brief generates the associated object from data58 */59 BaseObject* Factory::fabricate(const TiXmlElement* data)60 {61 return NULL;62 }63 64 /**65 61 \brief make this particular factory known to the LevelFactory 66 62 */ 67 63 void Factory::initialize() 68 64 { 69 #ifdef IS_ORXONOX70 65 GameLoader::getInstance()->registerFactory( this); 71 #endif /* IS_ORXONOX */72 66 } 73 67 -
orxonox/trunk/src/util/loading/factory.h
r4729 r4730 35 35 \todo make factoryName a BaseObject-parameter. (else it would be redundant) 36 36 */ 37 #define CREATE_FACTORY(CLASS_NAME) tFactory<CLASS_NAME>* global_##CLASS_NAME## Factory = new tFactory<CLASS_NAME>(#CLASS_NAME)37 #define CREATE_FACTORY(CLASS_NAME) tFactory<CLASS_NAME>* global_##CLASS_NAME##_Factory = new tFactory<CLASS_NAME>(#CLASS_NAME) 38 38 39 39 //! The Factory is a loadable object handler … … 45 45 46 46 47 virtual BaseObject* fabricate(const TiXmlElement* root) ;47 virtual BaseObject* fabricate(const TiXmlElement* root) = NULL; 48 48 void initialize(); 49 49 void registerFactory( Factory* factory); 50 50 /** \brief sets the Next factory in the list \param nextFactory the next factory */ 51 51 inline void setNext( Factory* nextFactory) { this->next = nextFactory; }; 52 /** \returns the first factory */ 53 static Factory* getFirst(void) { return Factory::first; }; 52 54 /** \returns the next factory */ 53 55 Factory* getNext(void) const { return this->next; }; 56 54 57 55 58 private: … … 69 72 70 73 private: 71 BaseObject* fabricate(const TiXmlElement* root);74 virtual BaseObject* fabricate(const TiXmlElement* root); 72 75 }; 73 76 … … 79 82 tFactory<T>::tFactory(const char* factoryName) : Factory(factoryName) 80 83 { 81 PRINTF(5)(" fileName: %s loadable\n", this->getName());84 PRINTF(5)("Class: %s loadable\n", this->getName()); 82 85 } 83 86 … … 90 93 BaseObject* tFactory<T>::fabricate(const TiXmlElement* root) 91 94 { 92 if(!strcmp(root->Value(), getName()))95 if(!strcmp(root->Value(), this->getName())) 93 96 return new T ( root); 94 97 else if( getNext() != NULL)
Note: See TracChangeset
for help on using the changeset viewer.