Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 7, 2015, 2:16:55 PM (10 years ago)
Author:
landauf
Message:

clean and explicit setup/shutdown of singletons that are used by statically initialized instances

Location:
code/branches/core7/src/libraries/core/module
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/module/StaticInitializationManager.cc

    r10536 r10542  
    3333namespace orxonox
    3434{
    35     /* static */ StaticInitializationManager& StaticInitializationManager::getInstance()
    36     {
    37         static StaticInitializationManager instance;
    38         return instance;
    39     }
     35    StaticInitializationManager* StaticInitializationManager::singletonPtr_s = 0;
    4036
    4137    void StaticInitializationManager::addHandler(StaticInitializationHandler* handler)
    4238    {
     39        handler->setupHandler();
    4340        this->handlers_.push_back(handler);
    4441    }
     
    4744    {
    4845        this->handlers_.remove(handler);
     46        handler->shutdownHandler();
    4947    }
    5048
  • code/branches/core7/src/libraries/core/module/StaticInitializationManager.h

    r10535 r10542  
    3434#include <list>
    3535
     36#include "util/Singleton.h"
     37
    3638namespace orxonox
    3739{
    38     class _CoreExport StaticInitializationManager
     40    class _CoreExport StaticInitializationManager : public Singleton<StaticInitializationManager>
    3941    {
     42        friend class Singleton<StaticInitializationManager>;
     43
    4044        public:
    41             static StaticInitializationManager& getInstance();
    42 
    4345            StaticInitializationManager() {}
    4446            virtual ~StaticInitializationManager() {}
     
    5254        private:
    5355            std::list<StaticInitializationHandler*> handlers_;
     56
     57            static StaticInitializationManager* singletonPtr_s;
    5458    };
    5559}
Note: See TracChangeset for help on using the changeset viewer.