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/libraries/core
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/core/CMakeLists.txt

    r5855 r5867  
    3737  PathConfig.cc
    3838  Resource.cc
     39  ScopedSingletonManager.cc
    3940  WindowEventListener.cc
    4041
  • code/branches/core5/src/libraries/core/Core.cc

    r5863 r5867  
    6565#include "Language.h"
    6666#include "LuaState.h"
     67#include "ScopedSingletonManager.h"
    6768#include "Shell.h"
    6869#include "TclBind.h"
     
    433434    {
    434435        // singletons from other libraries
    435         Scope<ScopeID::Root>::update(time);
     436        ScopedSingletonManager::update(time, ScopeID::Root);
    436437        if (this->bGraphicsLoaded_)
    437438        {
     
    441442            this->guiManager_->update(time);
    442443            // graphics singletons from other libraries
    443             Scope<ScopeID::Graphics>::update(time);
     444            ScopedSingletonManager::update(time, ScopeID::Graphics);
    444445        }
    445446        // process thread commands
Note: See TracChangeset for help on using the changeset viewer.