Changeset 9709 in orxonox.OLD for branches/new_class_id/src/lib/util/loading/factory.cc
- Timestamp:
- Aug 31, 2006, 10:51:08 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/loading/factory.cc
r9695 r9709 28 28 * set everything to zero and define factoryName 29 29 */ 30 Factory::Factory (const std::string& factoryName, intclassID)31 : _classID(classID) , _className(factoryName)30 Factory::Factory (const NewClassID& classID) 31 : _classID(classID) 32 32 { 33 this->registerObject(this, Factory::_objectList); 34 this->setName(factoryName); 33 printf("Factory::create(%s::%d)\n", classID.name().c_str(), classID.id()); 34 //this->registerObject(this, Factory::_objectList); 35 this->setName(classID.name()); 35 36 36 37 if( Factory::_factoryList == NULL) … … 79 80 } 80 81 81 /**82 * @brief Compares the Factories Name against a given ClassName83 * @param className the Name of the Class to Query84 * @returns true on match, false otherwise.85 */86 bool Factory::operator==(const char* className) const87 {88 return (className != NULL && this->_className == className);89 }90 82 91 83 /** … … 96 88 bool Factory::operator==(const std::string& className) const 97 89 { 98 return (this->_class Name== className);90 return (this->_classID.name() == className); 99 91 } 100 92 … … 143 135 } 144 136 145 146 137 /** 147 138 * @brief Creates a new Object of type classID … … 149 140 * @returns a new Object of Type classID on match, NULL otherwise 150 141 */ 151 BaseObject* Factory::fabricate( intclassID)142 BaseObject* Factory::fabricate(const NewClassID& classID) 152 143 { 153 144 if (Factory::_factoryList == NULL) … … 157 148 for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++) 158 149 if (*(*factory) == classID) 159 160 161 150 { 151 PRINTF(4)("Create a new Object of type %s\n", (*factory)->getCName()); 152 return (*factory)->fabricateObject(NULL); 162 153 163 164 PRINTF(2)("Could not Fabricate an Object of ClassID ' 0x%h'\n", classID);154 } 155 PRINTF(2)("Could not Fabricate an Object of ClassID '%d'\n", classID.id()); 165 156 return NULL; 166 157 } 167 168 169 /**170 * @brief Creates a new Object of type classID171 * @param classID the ClassID to match for the newly created Object172 * @returns a new Object of Type classID on match, NULL otherwise173 */174 BaseObject* Factory::fabricate(const NewClassID& classID)175 {176 return Factory::fabricate(classID.id());177 }
Note: See TracChangeset
for help on using the changeset viewer.