Changeset 10362 for code/branches/core7/src/libraries
- Timestamp:
- Apr 12, 2015, 11:07:14 PM (10 years ago)
- Location:
- code/branches/core7/src/libraries
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/Core.cc
r10352 r10362 94 94 95 95 // register Core as an abstract class to avoid problems if the class hierarchy is created within Core-constructor 96 RegisterAbstractClass(Core).inheritsFrom (Class(Configurable));96 RegisterAbstractClass(Core).inheritsFrom<Configurable>(); 97 97 98 98 Core::Core(const std::string& cmdLine) … … 517 517 518 518 519 RegisterAbstractClass(DevModeListener).inheritsFrom (Class(Listable));519 RegisterAbstractClass(DevModeListener).inheritsFrom<Listable>(); 520 520 521 521 DevModeListener::DevModeListener() -
code/branches/core7/src/libraries/core/CoreIncludes.h
r10360 r10362 127 127 */ 128 128 #define RegisterClassWithFactory(ClassName, FactoryInstance, bLoadable) \ 129 Identifier& _##ClassName##Identifier = (new orxonox::SI_I(orxonox::registerClass<ClassName>(#ClassName, FactoryInstance, bLoadable)))->getIdentifier()129 orxonox::SI_I& _##ClassName##Identifier = (*new orxonox::SI_I(orxonox::registerClass<ClassName>(#ClassName, FactoryInstance, bLoadable))) 130 130 131 131 /** … … 213 213 } 214 214 215 216 217 218 /** 219 * The static initializer stores the parent classes of this identifier. The corresponding identifiers are later loaded. This prevents identifiers from 220 * being used before they are completely initialized. 221 */ 215 222 class _CoreExport StaticallyInitializedIdentifier : public StaticallyInitializedInstance 216 223 { 224 struct InheritsFrom 225 { 226 virtual ~InheritsFrom() {} 227 virtual Identifier* getParent() = 0; 228 }; 229 230 template <class T> 231 struct InheritsFromClass : public InheritsFrom 232 { 233 virtual Identifier* getParent() { return Class(T); } 234 }; 235 217 236 public: 218 237 StaticallyInitializedIdentifier(Identifier* identifier) : identifier_(identifier) {} 219 220 virtual void load() {} 238 ~StaticallyInitializedIdentifier() 239 { 240 for (size_t i = 0; i < this->parents_.size(); ++i) 241 delete parents_[i]; 242 } 243 244 virtual void load() 245 { 246 for (size_t i = 0; i < this->parents_.size(); ++i) 247 this->identifier_->inheritsFrom(this->parents_[i]->getParent()); 248 } 221 249 222 250 inline Identifier& getIdentifier() 223 251 { return *this->identifier_; } 224 252 253 template <class T> 254 inline StaticallyInitializedIdentifier& inheritsFrom() 255 { this->parents_.push_back(new InheritsFromClass<T>()); return *this; } 256 225 257 private: 226 258 Identifier* identifier_; 259 std::vector<InheritsFrom*> parents_; 227 260 }; 228 261 -
code/branches/core7/src/libraries/core/ViewportEventListener.cc
r9667 r10362 32 32 namespace orxonox 33 33 { 34 RegisterAbstractClass(ViewportEventListener).inheritsFrom (Class(Listable));34 RegisterAbstractClass(ViewportEventListener).inheritsFrom<Listable>(); 35 35 36 36 ViewportEventListener::ViewportEventListener() -
code/branches/core7/src/libraries/core/WindowEventListener.cc
r9667 r10362 35 35 unsigned int WindowEventListener::windowHeight_s = 0; 36 36 37 RegisterAbstractClass(WindowEventListener).inheritsFrom (Class(Listable));37 RegisterAbstractClass(WindowEventListener).inheritsFrom<Listable>(); 38 38 39 39 WindowEventListener::WindowEventListener() -
code/branches/core7/src/libraries/core/XMLNameListener.cc
r9667 r10362 32 32 namespace orxonox 33 33 { 34 RegisterAbstractClass(XMLNameListener).inheritsFrom (Class(Listable));34 RegisterAbstractClass(XMLNameListener).inheritsFrom<Listable>(); 35 35 36 36 XMLNameListener::XMLNameListener() -
code/branches/core7/src/libraries/network/ClientConnectionListener.cc
r9667 r10362 35 35 namespace orxonox 36 36 { 37 RegisterAbstractClass(ClientConnectionListener).inheritsFrom (Class(Listable));37 RegisterAbstractClass(ClientConnectionListener).inheritsFrom<Listable>(); 38 38 39 39 ClientConnectionListener::ClientConnectionListener() -
code/branches/core7/src/libraries/network/NetworkFunction.cc
r9667 r10362 38 38 39 39 // no suitable factory for NetworkFunctionBase (and children), so we declare it abstract 40 RegisterAbstractClass(NetworkFunctionBase).inheritsFrom (Class(Listable));41 RegisterAbstractClass(NetworkFunctionStatic).inheritsFrom (Class(NetworkFunctionBase));42 RegisterAbstractClass(NetworkMemberFunctionBase).inheritsFrom (Class(NetworkFunctionBase));40 RegisterAbstractClass(NetworkFunctionBase).inheritsFrom<Listable>(); 41 RegisterAbstractClass(NetworkFunctionStatic).inheritsFrom<NetworkFunctionBase>(); 42 RegisterAbstractClass(NetworkMemberFunctionBase).inheritsFrom<NetworkFunctionBase>(); 43 43 44 44 NetworkFunctionBase::NetworkFunctionBase(const std::string& name) -
code/branches/core7/src/libraries/network/synchronisable/Synchronisable.cc
r9667 r10362 45 45 uint8_t Synchronisable::state_=0x1; // detemines wheter we are server (default) or client 46 46 47 RegisterAbstractClass(Synchronisable).inheritsFrom (Class(OrxonoxInterface));47 RegisterAbstractClass(Synchronisable).inheritsFrom<OrxonoxInterface>(); 48 48 49 49 /** -
code/branches/core7/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc
r9667 r10362 46 46 float TimeFactorListener::timefactor_s = 1.0f; 47 47 48 RegisterAbstractClass(TimeFactorListener).inheritsFrom (Class(Listable));48 RegisterAbstractClass(TimeFactorListener).inheritsFrom<Listable>(); 49 49 50 50 TimeFactorListener::TimeFactorListener() … … 67 67 // Tickable 68 68 //---------------------------- 69 RegisterAbstractClass(Tickable).inheritsFrom (Class(OrxonoxInterface));69 RegisterAbstractClass(Tickable).inheritsFrom<OrxonoxInterface>(); 70 70 71 71 /**
Note: See TracChangeset
for help on using the changeset viewer.