Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2015, 11:42:16 PM (9 years ago)
Author:
landauf
Message:

some refactoring in ScopeManager. made it a singleton and added functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/singleton/ScopeManager.cc

    r10461 r10462  
    3232*/
    3333
     34#include "ScopeManager.h"
     35
    3436#include "Scope.h"
    3537
    3638namespace orxonox
    3739{
    38     /*static*/ std::map<ScopeID::Value, int>& ScopeManager::getInstanceCounts()
     40    /* static */ ScopeManager& ScopeManager::getInstance()
    3941    {
    40         static std::map<ScopeID::Value, int> instanceCounts;
    41         return instanceCounts;
     42        static ScopeManager instance;
     43        return instance;
    4244    }
    43     /*static*/ std::map<ScopeID::Value, std::set<ScopeListener*> >& ScopeManager::getListeners()
     45
     46    void ScopeManager::addListener(ScopeListener* listener)
    4447    {
    45         static std::map<ScopeID::Value, std::set<ScopeListener*> > listeners;
    46         return listeners;
     48        this->listeners_[listener->getScope()].insert(listener);
     49    }
     50
     51    void ScopeManager::removeListener(ScopeListener* listener)
     52    {
     53        this->listeners_[listener->getScope()].erase(listener);
    4754    }
    4855}
Note: See TracChangeset for help on using the changeset viewer.