Changeset 9637 for code/branches/core6/src/libraries/core/object
- Timestamp:
- Aug 11, 2013, 4:23:41 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/object/ClassFactory.h
r9635 r9637 43 43 44 44 #include "util/Output.h" 45 #include "core/class/Identifier.h"46 45 47 46 namespace orxonox … … 54 53 { 55 54 public: 56 virtual ~Factory() {} ;55 virtual ~Factory() {} 57 56 virtual Identifiable* fabricate(Context* context) = 0; 58 57 }; … … 61 60 // ### ClassFactory ### 62 61 // ############################### 63 /// The ClassFactory is able to create new objects of a specific class that require no constructor arguments.62 /// The ClassFactory is the base-class of all class-spezific factories 64 63 template <class T> 65 64 class ClassFactory : public Factory 66 65 { 66 }; 67 68 // ############################### 69 // ### ClassFactoryNoArgs ### 70 // ############################### 71 /// The ClassFactoryNoArgs is able to create new objects of a specific class that require no constructor arguments. 72 template <class T> 73 class ClassFactoryNoArgs : public ClassFactory<T> 74 { 67 75 public: 68 /**69 @brief Constructor: Adds the ClassFactory to the Identifier of the same type.70 @param name The name of the class71 @param bLoadable True if the class can be loaded through XML72 */73 ClassFactory(const std::string& name, bool bLoadable = true)74 {75 orxout(verbose, context::misc::factory) << "Create entry for " << name << " in Factory." << endl;76 ClassIdentifier<T>::getIdentifier(name)->setFactory(this);77 ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);78 }79 80 76 /** 81 77 @brief Creates and returns a new object of class T. … … 93 89 /// The ClassFactoryWithContext is able to create new objects of a specific class that require a context as constructor argument 94 90 template <class T> 95 class ClassFactoryWithContext : public Factory91 class ClassFactoryWithContext : public ClassFactory<T> 96 92 { 97 93 public: 98 /**99 @brief Constructor: Adds the ClassFactory to the Identifier of the same type.100 @param name The name of the class101 @param bLoadable True if the class can be loaded through XML102 */103 ClassFactoryWithContext(const std::string& name, bool bLoadable = true)104 {105 orxout(verbose, context::misc::factory) << "Create entry for " << name << " in Factory." << endl;106 ClassIdentifier<T>::getIdentifier(name)->setFactory(this);107 ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);108 }109 110 94 /** 111 95 @brief Creates and returns a new object of class T.
Note: See TracChangeset
for help on using the changeset viewer.