Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 9, 2011, 5:06:49 AM (13 years ago)
Author:
rgrieder
Message:

Added and incorporated new class DestructionHelper: instead of doing the destruction of certain singletons implicitly via scoped_ptrs and ScopeGuards, use a method named destroy() that essentially achieves the same, but makes the destruction sequence obvious.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/GraphicsManager.h

    r8351 r8423  
    4848#include <string>
    4949#include <OgreLog.h>
    50 #include <boost/scoped_ptr.hpp>
    5150#include <boost/shared_ptr.hpp>
    5251
     52#include "util/DestructionHelper.h"
    5353#include "util/Singleton.h"
    5454#include "OrxonoxClass.h"
     
    6868    public:
    6969        GraphicsManager(bool bLoadRenderer = true);
    70         ~GraphicsManager();
     70
     71        //! Leave empty and use cleanup() instead
     72        ~GraphicsManager() {}
     73        /// Destructor that also executes when object fails to construct
     74        void destroy();
    7175
    7276        void setConfigValues();
     
    113117        std::string setVSync(bool vsync);
    114118
    115         scoped_ptr<OgreWindowEventListener> ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
    116         scoped_ptr<Ogre::LogManager>        ogreLogger_;
    117         scoped_ptr<Ogre::Root>              ogreRoot_;                //!< Ogre's root
     119        OgreWindowEventListener* ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
     120        Ogre::LogManager*        ogreLogger_;
     121        Ogre::Root*              ogreRoot_;                //!< Ogre's root
    118122        Ogre::RenderWindow* renderWindow_;             //!< the one and only render window
    119123        Ogre::Viewport*     viewport_;                 //!< default full size viewport
     
    134138        int                 ogreLogLevelCritical_;     //!< Corresponding Orxonox debug level for LL_CRITICAL
    135139
     140        /// Helper object that executes the surrogate destructor destroy()
     141        DestructionHelper<GraphicsManager> destructionHelper_;
     142
    136143        static GraphicsManager* singletonPtr_s;        //!< Pointer to the Singleton
    137144// tolua_begin
Note: See TracChangeset for help on using the changeset viewer.