Changeset 11071 for code/trunk/src/libraries/core/singleton
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/singleton/Scope.h
r10514 r11071 72 72 protected: 73 73 ScopeListener() : bActivated_(false) { } 74 virtual ~ScopeListener() { }74 virtual ~ScopeListener() = default; 75 75 76 76 //! Gets called if the scope is activated -
code/trunk/src/libraries/core/singleton/ScopeManager.cc
r10542 r11071 38 38 namespace orxonox 39 39 { 40 ScopeManager* ScopeManager::singletonPtr_s = 0;40 ScopeManager* ScopeManager::singletonPtr_s = nullptr; 41 41 42 42 void ScopeManager::addScope(ScopeID::Value scope) … … 73 73 void ScopeManager::activateListenersForScope(ScopeID::Value scope) 74 74 { 75 for ( std::set<ScopeListener*>::iterator it = this->listeners_[scope].begin(); it != this->listeners_[scope].end(); ++it)76 this->activateListener( *it);75 for (ScopeListener* listener : this->listeners_[scope]) 76 this->activateListener(listener); 77 77 } 78 78 79 79 void ScopeManager::deactivateListenersForScope(ScopeID::Value scope) 80 80 { 81 for ( std::set<ScopeListener*>::iterator it = this->listeners_[scope].begin(); it != this->listeners_[scope].end(); ++it)82 this->deactivateListener( *it);81 for (ScopeListener* listener : this->listeners_[scope]) 82 this->deactivateListener(listener); 83 83 } 84 84 -
code/trunk/src/libraries/core/singleton/ScopeManager.h
r11012 r11071 83 83 84 84 std::set<ScopeID::Value> activeScopes_; 85 std::map<ScopeID::Value, std::set<ScopeListener*> 85 std::map<ScopeID::Value, std::set<ScopeListener*>> listeners_; //!< Stores all listeners for a scope 86 86 87 87 static ScopeManager* singletonPtr_s; -
code/trunk/src/libraries/core/singleton/ScopedSingletonIncludes.h
r11052 r11071 71 71 */ 72 72 #define ManageScopedSingleton(className, scope, allowedToFail) \ 73 className* className::singletonPtr_s = NULL; \73 className* className::singletonPtr_s = nullptr; \ 74 74 static ScopedSingletonWrapper& className##ScopedSingletonWrapper \ 75 75 = (new orxonox::SI_SSW(new ClassScopedSingletonWrapper<className, allowedToFail>(#className), scope))->getWrapper() … … 87 87 ~StaticallyInitializedScopedSingletonWrapper() { delete wrapper_; } 88 88 89 virtual void load() ;90 virtual void unload() ;89 virtual void load() override; 90 virtual void unload() override; 91 91 92 92 inline ScopedSingletonWrapper& getWrapper() -
code/trunk/src/libraries/core/singleton/ScopedSingletonWrapper.h
r10528 r11071 64 64 : className_(className) 65 65 { } 66 virtual ~ScopedSingletonWrapper() { }66 virtual ~ScopedSingletonWrapper() = default; 67 67 68 68 protected: … … 91 91 ClassScopedSingletonWrapper(const std::string& className) 92 92 : ScopedSingletonWrapper(className) 93 , singletonPtr_( NULL)93 , singletonPtr_(nullptr) 94 94 { 95 95 } … … 102 102 103 103 //! Called if the Scope of the Singleton gets active (creates the instance) 104 v oid activated()104 virtual void activated() override 105 105 { 106 assert(singletonPtr_ == NULL);106 assert(singletonPtr_ == nullptr); 107 107 singletonPtr_ = new T(); 108 108 } 109 109 110 110 //! Called if the Scope of this Singleton gets deactivated (destroys the instance) 111 v oid deactivated()111 virtual void deactivated() override 112 112 { 113 assert(singletonPtr_ != NULL);113 assert(singletonPtr_ != nullptr); 114 114 this->destroy(singletonPtr_); 115 singletonPtr_ = NULL;115 singletonPtr_ = nullptr; 116 116 } 117 117 … … 146 146 ClassScopedSingletonWrapper(const std::string& className) 147 147 : ScopedSingletonWrapper(className) 148 , singletonPtr_( NULL)148 , singletonPtr_(nullptr) 149 149 { 150 150 } … … 157 157 158 158 //! Called if the Scope of the Singleton gets active (creates the instance) 159 v oid activated()159 virtual void activated() override 160 160 { 161 assert(singletonPtr_ == NULL);161 assert(singletonPtr_ == nullptr); 162 162 try 163 163 { singletonPtr_ = new T(); } … … 169 169 170 170 //! Called if the Scope of this Singleton gets deactivated (destroys the instance) 171 v oid deactivated()171 virtual void deactivated() override 172 172 { 173 if (singletonPtr_ != NULL)173 if (singletonPtr_ != nullptr) 174 174 { 175 175 this->destroy(singletonPtr_); 176 singletonPtr_ = NULL;176 singletonPtr_ = nullptr; 177 177 } 178 178 }
Note: See TracChangeset
for help on using the changeset viewer.