Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 3, 2015, 1:54:43 PM (10 years ago)
Author:
landauf
Message:

improved documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/util/Singleton.h

    r10413 r10418  
    6868    TestSingleton* TestSingleton::singletonPtr_s = NULL;
    6969    @endcode
    70 
    71     Usually a singleton gets created automatically when it is first used, but it will never
    72     be destroyed (unless the singleton explicitly deletes itself). To allow controlled
    73     construction and destruction, the singleton can be put within a virtual scope. This is
    74     done by registering the singleton class with orxonox::ScopedSingletonManager. To
    75     do so, the ManageScopedSingleton() macro has to be called:
    76 
    77     @code
    78     ManageScopedSingleton(TestSingleton, ScopeID::Graphics, false); // muste be called in a source (*.cc) file
    79     @endcode
    80 
    81     @b Important: If you call ManageScopedSingleton(), you don't have to initialize singletonPtr_s anymore,
    82     because that's already done by the macro.
    83 
    84     Now the singleton TestSingleton gets automatically created if the scope Graphics becomes
    85     active and also gets destroyed if the scope is deactivated.
    86 
    87     Note that not all singletons must register with a scope, but it's recommended.
    8870
    8971    If a class inherits from orxonox::Singleton, it also inherits its functions. The most important
Note: See TracChangeset for help on using the changeset viewer.