Changeset 10344 for code/branches/core7/src/libraries/core/module
- Timestamp:
- Apr 5, 2015, 5:29:21 PM (10 years ago)
- Location:
- code/branches/core7/src/libraries/core/module
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/module/ModuleInstance.cc
r10342 r10344 35 35 ModuleInstance* ModuleInstance::currentModuleInstance_s = NULL; 36 36 37 ModuleInstance::~ModuleInstance() 38 { 39 std::list<StaticallyInitializedInstance*> copy(this->staticallyInitializedInstances_); 40 for (std::list<StaticallyInitializedInstance*>::iterator it = this->staticallyInitializedInstances_.begin(); it != this->staticallyInitializedInstances_.end(); ++it) 41 delete (*it); 42 } 43 37 44 void ModuleInstance::addStaticallyInitializedInstance(StaticallyInitializedInstance* instance) 38 45 { … … 42 49 void ModuleInstance::loadAllStaticallyInitializedInstances() 43 50 { 44 for (size_t i = 0; i < this->staticallyInitializedInstances_.size(); ++i) 45 this->staticallyInitializedInstances_[i]->load(); 51 for (std::list<StaticallyInitializedInstance*>::iterator it = this->staticallyInitializedInstances_.begin(); it != this->staticallyInitializedInstances_.end(); ++it) 52 (*it)->load(); 53 } 54 55 void ModuleInstance::removeStaticallyInitializedInstance(StaticallyInitializedInstance* instance) 56 { 57 this->staticallyInitializedInstances_.remove(instance); 46 58 } 47 59 -
code/branches/core7/src/libraries/core/module/ModuleInstance.h
r10342 r10344 32 32 #include "core/CorePrereqs.h" 33 33 34 #include < vector>34 #include <list> 35 35 36 36 namespace orxonox … … 39 39 { 40 40 public: 41 ~ModuleInstance(); 42 41 43 void addStaticallyInitializedInstance(StaticallyInitializedInstance* instance); 42 44 void loadAllStaticallyInitializedInstances(); 45 void removeStaticallyInitializedInstance(StaticallyInitializedInstance* instance); 43 46 44 47 static void setCurrentModuleInstance(ModuleInstance* instance); … … 46 49 47 50 private: 48 std:: vector<StaticallyInitializedInstance*> staticallyInitializedInstances_;51 std::list<StaticallyInitializedInstance*> staticallyInitializedInstances_; 49 52 50 53 static ModuleInstance* currentModuleInstance_s; -
code/branches/core7/src/libraries/core/module/StaticallyInitializedInstance.cc
r10342 r10344 37 37 ModuleInstance::getCurrentModuleInstance()->addStaticallyInitializedInstance(this); 38 38 } 39 40 StaticallyInitializedInstance::~StaticallyInitializedInstance() 41 { 42 ModuleInstance::getCurrentModuleInstance()->removeStaticallyInitializedInstance(this); 43 } 39 44 } -
code/branches/core7/src/libraries/core/module/StaticallyInitializedInstance.h
r10342 r10344 38 38 public: 39 39 StaticallyInitializedInstance(); 40 virtual ~StaticallyInitializedInstance() {}40 virtual ~StaticallyInitializedInstance(); 41 41 42 42 virtual void load() = 0;
Note: See TracChangeset
for help on using the changeset viewer.