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/core/Core.h

    r3363 r3366  
    4646#include "util/OutputHandler.h"
    4747#include "util/ScopeGuard.h"
     48#include "util/Singleton.h"
    4849
    4950namespace orxonox
     
    5859        The class provides information about the media, config and log path.
    5960        It determines those by the use of platform specific functions.
     61    @remark
     62        You should only create this singleton once because it destroys the identifiers!
    6063    */
    61     class _CoreExport Core
     64    class _CoreExport Core : public Singleton<Core>
    6265    {
    6366        typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard;
     67        friend class Singleton<Core>;
    6468
    6569        public:
     
    8185            void loadGraphics();
    8286            void unloadGraphics();
    83 
    84             static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; }
    8587
    8688            static int   getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
     
    136138            bool                          bGraphicsLoaded_;
    137139
    138             static Core* singletonRef_s;
     140            static Core* singletonPtr_s;
    139141    };
    140142}
Note: See TracChangeset for help on using the changeset viewer.