Changeset 9637 for code/branches/core6/src/libraries/core/CoreIncludes.h
- Timestamp:
- Aug 11, 2013, 4:23:41 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/CoreIncludes.h
r9635 r9637 117 117 */ 118 118 #define CreateFactory(ClassName) \ 119 RegisterFactory(ClassName, new orxonox::ClassFactoryWithContext<ClassName>( #ClassName, true))119 RegisterFactory(ClassName, new orxonox::ClassFactoryWithContext<ClassName>(), true) 120 120 121 121 /** … … 124 124 */ 125 125 #define CreateUnloadableFactory(ClassName) \ 126 RegisterFactory(ClassName, new orxonox::ClassFactoryWithContext<ClassName>( #ClassName, false))126 RegisterFactory(ClassName, new orxonox::ClassFactoryWithContext<ClassName>(), false) 127 127 128 128 /** … … 130 130 @param ClassName The name of the class 131 131 */ 132 #define RegisterFactory(ClassName, FactoryInstance ) \133 Factory* _##ClassName##Factory = FactoryInstance132 #define RegisterFactory(ClassName, FactoryInstance, bLoadable) \ 133 Identifier* _##ClassName##Identifier = orxonox::registerClass<ClassName>(#ClassName, FactoryInstance, bLoadable) 134 134 135 135 /** … … 143 143 namespace orxonox 144 144 { 145 /** 146 * @brief Overload of registerClass() which determines T implicitly by the template argument of the ClassFactory. 147 */ 148 template <class T> 149 inline Identifier* registerClass(const std::string& name, ClassFactory<T>* factory, bool bLoadable = true) 150 { 151 return registerClass<T>(name, static_cast<Factory*>(factory), bLoadable); 152 } 153 154 /** 155 * @brief Registers a class in the framework. 156 * @param name The name of the class 157 * @param factory The factory which is able to create new instances of this class 158 * @param bLoadable Whether the class is allowed to be loaded through XML 159 */ 160 template <class T> 161 inline Identifier* registerClass(const std::string& name, Factory* factory, bool bLoadable = true) 162 { 163 orxout(verbose, context::misc::factory) << "Create entry for " << name << " in Factory." << endl; 164 Identifier* identifier = ClassIdentifier<T>::getIdentifier(name); 165 identifier->setFactory(factory); 166 identifier->setLoadable(bLoadable); 167 return identifier; 168 } 169 145 170 /** 146 171 @brief Returns the Identifier with a given name.
Note: See TracChangeset
for help on using the changeset viewer.