Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2015, 1:48:18 PM (9 years ago)
Author:
landauf
Message:

wrap ScopedSingletonWrapper in a StaticallyInitializedScopedSingletonWrapper. doesn't do a lot at the moment.

Location:
code/branches/core7/src/libraries
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/Core.cc

    r10458 r10459  
    5757#include "util/output/OutputManager.h"
    5858#include "core/singleton/Scope.h"
    59 #include "core/singleton/ScopedSingletonWrapper.h"
     59#include "core/singleton/ScopedSingletonIncludes.h"
    6060#include "util/SignalHandler.h"
    6161#include "PathConfig.h"
  • code/branches/core7/src/libraries/core/input/KeyBinderManager.cc

    r10458 r10459  
    3131#include "util/Output.h"
    3232#include "util/Exception.h"
    33 #include "core/singleton/ScopedSingletonWrapper.h"
     33#include "core/singleton/ScopedSingletonIncludes.h"
    3434#include "core/config/ConfigValueIncludes.h"
    3535#include "core/CoreIncludes.h"
  • code/branches/core7/src/libraries/core/input/KeyDetector.cc

    r10458 r10459  
    3030
    3131#include "core/CoreIncludes.h"
    32 #include "core/singleton/ScopedSingletonWrapper.h"
     32#include "core/singleton/ScopedSingletonIncludes.h"
    3333#include "core/command/ConsoleCommandIncludes.h"
    3434#include "Button.h"
  • code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc

    r10458 r10459  
    3030
    3131#include "core/CoreIncludes.h"
    32 #include "core/singleton/ScopedSingletonWrapper.h"
     32#include "core/singleton/ScopedSingletonIncludes.h"
    3333
    3434namespace orxonox
  • code/branches/core7/src/libraries/core/singleton/ScopedSingletonWrapper.h

    r10458 r10459  
    3030    @file
    3131    @ingroup SingletonScope
    32     @brief Definition of orxonox::ScopedSingletonWrapper, orxonox::ClassScopedSingletonWrapper, and the ManageScopedSingleton macro.
     32    @brief Definition of orxonox::ScopedSingletonWrapper and orxonox::ClassScopedSingletonWrapper.
    3333
    3434    ScopedSingletonWrapper is used to create and destroy Singletons that belong to
     
    5151#include "util/Singleton.h"
    5252#include "Scope.h"
    53 
    54 /**
    55     @brief Creates an orxonox::ScopedSingletonWrapper for an orxonox::Singleton and registers it with orxonox::ScopeManager.
    56     @param className The name of the singleton class
    57     @param scope The scope in which the singleton should exist
    58     @param allowedToFail If true, the singleton is allowed to fail and thus a try-catch block is used when creating the singleton.
    59 
    60     If this macro is called for a singleton, it is wrapped in a ScopedSingletonWrapper and registered with ScopeManager
    61     and will thus be created if its scope becomes active and destroyed if is deactivated.
    62 
    63 
    64     Usually a singleton gets created automatically when it is first used, but it will never
    65     be destroyed (unless the singleton explicitly deletes itself). To allow controlled
    66     construction and destruction, the singleton can be put within a virtual scope. This is
    67     done by registering the singleton class with orxonox::ScopeManager. To
    68     do so, the ManageScopedSingleton() macro has to be called:
    69 
    70     @code
    71     ManageScopedSingleton(TestSingleton, ScopeID::Graphics, false); // muste be called in a source (*.cc) file
    72     @endcode
    73 
    74     @b Important: If you call ManageScopedSingleton(), you don't have to initialize singletonPtr_s anymore,
    75     because that's already done by the macro.
    76 
    77     Now the singleton TestSingleton gets automatically created if the scope Graphics becomes
    78     active and also gets destroyed if the scope is deactivated.
    79 
    80     Note that not all singletons must register with a scope, but it's recommended.
    81 
    82 */
    83 #define ManageScopedSingleton(className, scope, allowedToFail) \
    84     className* className::singletonPtr_s = NULL; \
    85     static ClassScopedSingletonWrapper<className, scope, allowedToFail> className##ScopedSingletonWrapper(#className)
    8653
    8754namespace orxonox
  • code/branches/core7/src/libraries/network/Client.cc

    r10458 r10459  
    5252#include "core/Game.h"
    5353#include "core/commandline/CommandLineParser.h"
    54 #include "core/singleton/ScopedSingletonWrapper.h"
     54#include "core/singleton/ScopedSingletonIncludes.h"
    5555
    5656namespace orxonox
  • code/branches/core7/src/libraries/network/LANDiscovery.cc

    r10458 r10459  
    3333
    3434#include "core/CoreIncludes.h"
    35 #include "core/singleton/ScopedSingletonWrapper.h"
     35#include "core/singleton/ScopedSingletonIncludes.h"
    3636
    3737
  • code/branches/core7/src/libraries/network/MasterServer.cc

    r10458 r10459  
    3131#include "core/CoreIncludes.h"
    3232#include "core/CorePrereqs.h"
    33 #include "core/singleton/ScopedSingletonWrapper.h"
     33#include "core/singleton/ScopedSingletonIncludes.h"
    3434#include "util/Output.h"
    3535
Note: See TracChangeset for help on using the changeset viewer.