Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 29, 2009, 10:27:10 PM (15 years ago)
Author:
rgrieder
Message:

Derived all singletons implemented in a usual manner from orxonox::Singleton<T>.
This resolves inconsistencies with the singletonPtr_s variable in case of exceptions (asserts were being triggered then).
And while at it replaced singletonRef_s with singletonPtr_s for it to be less misleading (as fabian has already pointed out).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource/src/orxonox/LevelManager.h

    r3339 r3366  
    3535#include <list>
    3636#include <string>
     37
     38#include "util/Singleton.h"
    3739#include "core/OrxonoxClass.h"
    3840
     
    4244    class _OrxonoxExport LevelManager
    4345    // tolua_end
    44         : public OrxonoxClass
     46        : public Singleton<LevelManager>, public OrxonoxClass
    4547    { // tolua_export
     48            friend class Singleton<LevelManager>;
    4649        public:
    4750            LevelManager();
     
    5962            std::string getAvailableLevelListItem(unsigned int index) const; //tolua_export
    6063
    61             static LevelManager* getInstancePtr() { return singletonRef_s; }
    62             static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
     64            static LevelManager* getInstancePtr() { return singletonPtr_s; }
     65            static LevelManager& getInstance()    { return Singleton<LevelManager>::getInstance(); } // tolua_export
    6366
    6467        private:
     
    7376            std::string defaultLevelName_;
    7477
    75             static LevelManager* singletonRef_s;
     78            static LevelManager* singletonPtr_s;
    7679    }; // tolua_export
    7780} // tolua_export
Note: See TracChangeset for help on using the changeset viewer.