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/input/InputManager.h

    r3327 r3366  
    3737#include <vector>
    3838
     39#include "util/Singleton.h"
    3940#include "core/WindowEventListener.h"
    4041#include "InputState.h"
     
    6263          If the OIS::InputManager or the Keyboard fail, an exception is thrown.
    6364    */
    64     class _CoreExport InputManager : public WindowEventListener
     65    class _CoreExport InputManager : public Singleton<InputManager>, public WindowEventListener
    6566    {
     67        friend class Singleton<InputManager>;
    6668    public:
    6769        //! Represents internal states of the InputManager.
     
    168170            { return this->oisInputManager_; }
    169171
    170         //! Returns a reference to the singleton instance
    171         static InputManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
    172 
    173172    private: // functions
    174173        // don't mess with a Singleton
     
    211210        std::set<InputState*>               stateDestroyRequests_; //!< Requests to destroy a state
    212211
    213         static InputManager*                singletonRef_s;        //!< Pointer reference to the singleton
     212        static InputManager*                singletonPtr_s;        //!< Pointer reference to the singleton
    214213    };
    215214}
Note: See TracChangeset for help on using the changeset viewer.