Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2009, 12:02:28 AM (15 years ago)
Author:
rgrieder
Message:

Modified Scoped Singleton concept: Derive from Singleton normally, but place an important pre-main() instruction in the source file: ManageScopedSingleton(className, scope) (it's a macro).
This causes the Singleton to be created and destroyed with the Scope. Thus if a Singleton c'tor throws, it is much easier to react accordingly.

Location:
code/branches/core5/src/orxonox/sound
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/orxonox/sound/SoundManager.cc

    r5738 r5867  
    3232
    3333#include "util/Math.h"
     34#include "core/ScopedSingletonManager.h"
    3435#include "CameraManager.h"
    3536#include "graphics/Camera.h"
     
    3940{
    4041    SoundManager* SoundManager::singletonPtr_s = NULL;
     42    ManageScopedSingleton(SoundManager, ScopeID::Graphics);
    4143
    4244    /**
  • code/branches/core5/src/orxonox/sound/SoundManager.h

    r5850 r5867  
    3232#include <cassert>
    3333#include <list>
    34 #include "util/ScopedSingleton.h"
     34#include "util/Singleton.h"
    3535#include "tools/interfaces/Tickable.h"
    3636
     
    4343     *
    4444     */
    45     class _OrxonoxExport SoundManager : public ScopedSingleton<SoundManager, ScopeID::Graphics>, public Tickable
     45    class _OrxonoxExport SoundManager : public Singleton<SoundManager>, public Tickable
    4646    {
    47         friend class ScopedSingleton<SoundManager, ScopeID::Graphics>;
     47        friend class Singleton<SoundManager>;
    4848    public:
    4949        SoundManager();
Note: See TracChangeset for help on using the changeset viewer.