Changeset 9686 in orxonox.OLD for branches/new_class_id/src/lib/util/loading
- Timestamp:
- Aug 22, 2006, 2:36:54 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/loading/factory.cc
r9684 r9686 29 29 */ 30 30 Factory::Factory (const std::string& factoryName, int classID) 31 : classID(classID),className(factoryName)31 : _classID(classID), _className(factoryName) 32 32 { 33 33 this->registerObject(this, Factory::_objectList); 34 34 this->setName(factoryName); 35 35 36 if( Factory:: factoryList == NULL)37 Factory:: factoryList = new std::list<Factory*>;36 if( Factory::_factoryList == NULL) 37 Factory::_factoryList = new std::list<Factory*>; 38 38 39 Factory:: factoryList->push_back(this);39 Factory::_factoryList->push_back(this); 40 40 } 41 41 42 42 /** @brief a reference to the First Factory */ 43 std::list<Factory*>* Factory:: factoryList = NULL;43 std::list<Factory*>* Factory::_factoryList = NULL; 44 44 45 45 /** … … 58 58 void Factory::deleteFactories() 59 59 { 60 if (Factory:: factoryList != NULL)60 if (Factory::_factoryList != NULL) 61 61 { 62 while(!Factory:: factoryList->empty())62 while(!Factory::_factoryList->empty()) 63 63 { 64 delete Factory:: factoryList->front();65 Factory:: factoryList->pop_front();64 delete Factory::_factoryList->front(); 65 Factory::_factoryList->pop_front(); 66 66 } 67 delete Factory:: factoryList;68 Factory:: factoryList = NULL;67 delete Factory::_factoryList; 68 Factory::_factoryList = NULL; 69 69 } 70 70 } … … 76 76 bool Factory::operator==(int classID) const 77 77 { 78 return (this-> classID == classID);78 return (this->_classID == classID); 79 79 } 80 80 … … 86 86 bool Factory::operator==(const char* className) const 87 87 { 88 return (className != NULL && this-> className == className);88 return (className != NULL && this->_className == className); 89 89 } 90 90 … … 96 96 bool Factory::operator==(const std::string& className) const 97 97 { 98 return (this-> className == className);98 return (this->_className == className); 99 99 } 100 100 … … 107 107 BaseObject* Factory::fabricate(const TiXmlElement* root) 108 108 { 109 assert (root != NULL && Factory:: factoryList != NULL);109 assert (root != NULL && Factory::_factoryList != NULL); 110 110 111 111 std::list<Factory*>::const_iterator factory; 112 for (factory = Factory:: factoryList->begin(); factory != Factory::factoryList->end(); factory++)112 for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++) 113 113 if (*(*factory) == root->Value()) 114 114 { … … 129 129 BaseObject* Factory::fabricate(const std::string& className) 130 130 { 131 if (Factory:: factoryList == NULL)131 if (Factory::_factoryList == NULL) 132 132 return NULL; 133 133 134 134 std::list<Factory*>::const_iterator factory; 135 for (factory = Factory:: factoryList->begin(); factory != Factory::factoryList->end(); factory++)135 for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++) 136 136 if (*(*factory) == className) 137 137 { … … 151 151 BaseObject* Factory::fabricate(int classID) 152 152 { 153 if (Factory:: factoryList == NULL)153 if (Factory::_factoryList == NULL) 154 154 return NULL; 155 155 156 156 std::list<Factory*>::const_iterator factory; 157 for (factory = Factory:: factoryList->begin(); factory != Factory::factoryList->end(); factory++)157 for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++) 158 158 if (*(*factory) == classID) 159 159 { -
branches/new_class_id/src/lib/util/loading/factory.h
r9684 r9686 60 60 61 61 protected: 62 const int classID; //!< The Class-Identifyer of the Factory.63 const std::string className; //!< The name of the Class.64 static std::list<Factory*>* factoryList; //!< List of Registered Factories62 const int _classID; //!< The Class-Identifyer of the Factory. 63 const std::string _className; //!< The name of the Class. 64 static std::list<Factory*>* _factoryList; //!< List of Registered Factories 65 65 }; 66 66
Note: See TracChangeset
for help on using the changeset viewer.