- Timestamp:
- Dec 10, 2007, 8:34:48 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/core/ClassFactory.h
r453 r457 10 10 11 11 #include "Identifier.h" 12 #include "Debug.h"13 12 14 13 namespace orxonox … … 22 21 { 23 22 public: 24 static bool create( );23 static bool create(const std::string& name); 25 24 BaseObject* fabricate(); 26 25 … … 34 33 35 34 /** 36 @brief Adds the ClassFactory to the Identifier of the same type and creates a new object to retrieve the parents.35 @brief Adds the ClassFactory to the Identifier of the same type and the Identifier to the Factory. 37 36 @return Always true (this is needed because the compiler only allows assignments before main()) 38 37 */ 39 38 template <class T> 40 bool ClassFactory<T>::create( )39 bool ClassFactory<T>::create(const std::string& name) 41 40 { 42 // Add the ClassFactory to the Classidentifier of type T43 41 ClassIdentifier<T>::getIdentifier()->addFactory(new ClassFactory<T>); 44 45 // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards. 46 ClassIdentifier<T>::getIdentifier()->startCreatingHierarchy(); 47 COUT(4) << "*** Create Factory -> Create Class\n"; 48 BaseObject* temp = ClassIdentifier<T>::getIdentifier()->fabricate(); 49 delete temp; 50 ClassIdentifier<T>::getIdentifier()->stopCreatingHierarchy(); 42 Factory::add(name, ClassIdentifier<T>::getIdentifier()); 51 43 52 44 return true;
Note: See TracChangeset
for help on using the changeset viewer.