Changeset 5156 in orxonox.OLD for trunk/src/util/loading
- Timestamp:
- Aug 27, 2005, 3:57:42 PM (19 years ago)
- Location:
- trunk/src/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/loading/factory.cc
r5155 r5156 95 95 { 96 96 PRINTF(3)("Create a new Object of type %s\n", fac->getName()); 97 BaseObject* object = fac->fabricate (NULL);97 BaseObject* object = fac->fabricateDirect(); 98 98 if (object != NULL) 99 99 { -
trunk/src/util/loading/factory.h
r5155 r5156 41 41 public: 42 42 Factory (const char* factoryName = NULL); 43 ~Factory ();43 virtual ~Factory (); 44 44 45 45 void fabricate(const char* className, const char* entityName); 46 46 virtual BaseObject* fabricate(const TiXmlElement* root) = NULL; 47 virtual BaseObject* fabricateDirect() = NULL; 47 48 48 49 static void registerFactory( Factory* factory); … … 73 74 private: 74 75 virtual BaseObject* fabricate(const TiXmlElement* root); 76 virtual BaseObject* fabricateDirect(); 75 77 }; 76 78 … … 93 95 BaseObject* tFactory<T>::fabricate(const TiXmlElement* root) 94 96 { 97 if (root == NULL) 98 return NULL; 99 95 100 if(!strcmp(root->Value(), this->getName())) 96 101 return new T ( root); … … 101 106 } 102 107 108 template<class T> 109 BaseObject* tFactory<T>::fabricateDirect() 110 { 111 return new T((const TiXmlElement*)NULL); 112 } 113 103 114 #endif /* _FACTORY_H */ 104 115
Note: See TracChangeset
for help on using the changeset viewer.