Changeset 10360 for code/branches/core7/src
- Timestamp:
- Apr 12, 2015, 9:41:22 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/CoreIncludes.h
r10208 r10360 84 84 #include "object/ClassFactory.h" 85 85 #include "object/ObjectList.h" 86 #include "module/StaticallyInitializedInstance.h" 86 87 87 88 // resolve macro conflict on windows … … 126 127 */ 127 128 #define RegisterClassWithFactory(ClassName, FactoryInstance, bLoadable) \ 128 Identifier& _##ClassName##Identifier = orxonox::registerClass<ClassName>(#ClassName, FactoryInstance, bLoadable)129 Identifier& _##ClassName##Identifier = (new orxonox::SI_I(orxonox::registerClass<ClassName>(#ClassName, FactoryInstance, bLoadable)))->getIdentifier() 129 130 130 131 /** … … 152 153 */ 153 154 template <class T> 154 inline Identifier ®isterClass(const std::string& name, ClassFactory<T>* factory, bool bLoadable = true)155 inline Identifier* registerClass(const std::string& name, ClassFactory<T>* factory, bool bLoadable = true) 155 156 { 156 157 return registerClass<T>(name, static_cast<Factory*>(factory), bLoadable); … … 164 165 */ 165 166 template <class T> 166 inline Identifier ®isterClass(const std::string& name, Factory* factory, bool bLoadable = true)167 inline Identifier* registerClass(const std::string& name, Factory* factory, bool bLoadable = true) 167 168 { 168 169 orxout(verbose, context::misc::factory) << "Create entry for " << name << " in Factory." << endl; … … 170 171 identifier->setFactory(factory); 171 172 identifier->setLoadable(bLoadable); 172 return *identifier;173 return identifier; 173 174 } 174 175 … … 211 212 return ClassIdentifier<T>::getIdentifier(); 212 213 } 214 215 class _CoreExport StaticallyInitializedIdentifier : public StaticallyInitializedInstance 216 { 217 public: 218 StaticallyInitializedIdentifier(Identifier* identifier) : identifier_(identifier) {} 219 220 virtual void load() {} 221 222 inline Identifier& getIdentifier() 223 { return *this->identifier_; } 224 225 private: 226 Identifier* identifier_; 227 }; 228 229 typedef StaticallyInitializedIdentifier SI_I; 213 230 } 214 231
Note: See TracChangeset
for help on using the changeset viewer.