Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10459


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
Files:
1 added
23 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
  • code/branches/core7/src/modules/designtools/ScreenshotManager.cc

    r10458 r10459  
    4848#include "core/Resource.h"
    4949#include "core/command/ConsoleCommandIncludes.h"
    50 #include "core/singleton/ScopedSingletonWrapper.h"
     50#include "core/singleton/ScopedSingletonIncludes.h"
    5151#include "util/StringUtils.h"
    5252
  • code/branches/core7/src/modules/designtools/SkyboxGenerator.cc

    r10458 r10459  
    4545#include "core/command/ConsoleCommandIncludes.h"
    4646#include "core/command/CommandExecutor.h"
    47 #include "core/singleton/ScopedSingletonWrapper.h"
     47#include "core/singleton/ScopedSingletonIncludes.h"
    4848
    4949#include "controllers/HumanController.h"
  • code/branches/core7/src/modules/notifications/NotificationManager.cc

    r10458 r10459  
    3737#include "core/CoreIncludes.h"
    3838#include "core/LuaState.h"
    39 #include "core/singleton/ScopedSingletonWrapper.h"
     39#include "core/singleton/ScopedSingletonIncludes.h"
    4040
    4141#include "interfaces/NotificationListener.h"
  • code/branches/core7/src/modules/pickup/PickupManager.cc

    r10458 r10459  
    3838#include "core/GUIManager.h"
    3939#include "core/class/Identifier.h"
    40 #include "core/singleton/ScopedSingletonWrapper.h"
     40#include "core/singleton/ScopedSingletonIncludes.h"
    4141#include "network/Host.h"
    4242#include "network/NetworkFunction.h"
  • code/branches/core7/src/modules/questsystem/QuestManager.cc

    r10458 r10459  
    3636#include "util/Exception.h"
    3737#include "util/OrxAssert.h"
    38 #include "core/singleton/ScopedSingletonWrapper.h"
     38#include "core/singleton/ScopedSingletonIncludes.h"
    3939#include "core/command/ConsoleCommand.h"
    4040#include "core/GUIManager.h"
  • code/branches/core7/src/orxonox/CameraManager.cc

    r10458 r10459  
    3838#include "core/GraphicsManager.h"
    3939#include "core/object/ObjectList.h"
    40 #include "core/singleton/ScopedSingletonWrapper.h"
     40#include "core/singleton/ScopedSingletonIncludes.h"
    4141#include "tools/Shader.h"
    4242#include "graphics/Camera.h"
  • code/branches/core7/src/orxonox/LevelManager.cc

    r10458 r10459  
    3636#include <map>
    3737
    38 #include "core/singleton/ScopedSingletonWrapper.h"
     38#include "core/singleton/ScopedSingletonIncludes.h"
    3939#include "core/commandline/CommandLineIncludes.h"
    4040#include "core/config/ConfigValueIncludes.h"
  • code/branches/core7/src/orxonox/MoodManager.cc

    r10458 r10459  
    2929#include "MoodManager.h"
    3030
    31 #include "core/singleton/ScopedSingletonWrapper.h"
     31#include "core/singleton/ScopedSingletonIncludes.h"
    3232#include "core/config/ConfigValueIncludes.h"
    3333#include "core/CoreIncludes.h"
  • code/branches/core7/src/orxonox/PlayerManager.cc

    r10458 r10459  
    3131#include "core/CoreIncludes.h"
    3232#include "core/GameMode.h"
    33 #include "core/singleton/ScopedSingletonWrapper.h"
     33#include "core/singleton/ScopedSingletonIncludes.h"
    3434
    3535#include "Level.h"
  • code/branches/core7/src/orxonox/chat/ChatHistory.cc

    r10458 r10459  
    2828
    2929#include "ChatHistory.h"
    30 #include "core/singleton/ScopedSingletonWrapper.h"
     30#include "core/singleton/ScopedSingletonIncludes.h"
    3131
    3232#ifndef CHATTEST
  • code/branches/core7/src/orxonox/chat/ChatInputHandler.cc

    r10458 r10459  
    4747#endif
    4848
    49 #include "core/singleton/ScopedSingletonWrapper.h"
     49#include "core/singleton/ScopedSingletonIncludes.h"
    5050#include "core/CoreIncludes.h"
    5151#include "core/GUIManager.h"
  • code/branches/core7/src/orxonox/chat/ChatManager.cc

    r10458 r10459  
    3131
    3232#include "core/CoreIncludes.h"
    33 #include "core/singleton/ScopedSingletonWrapper.h"
     33#include "core/singleton/ScopedSingletonIncludes.h"
    3434#include "core/command/ConsoleCommandIncludes.h"
    3535#include "network/Host.h"
  • code/branches/core7/src/orxonox/overlays/InGameConsole.cc

    r10458 r10459  
    5050#include "core/config/ConfigValueIncludes.h"
    5151#include "core/command/ConsoleCommandIncludes.h"
    52 #include "core/singleton/ScopedSingletonWrapper.h"
     52#include "core/singleton/ScopedSingletonIncludes.h"
    5353#include "core/GUIManager.h"
    5454#include "core/input/InputManager.h"
  • code/branches/core7/src/orxonox/sound/SoundManager.cc

    r10458 r10459  
    3838#include "util/Math.h"
    3939#include "util/Clock.h"
    40 #include "core/singleton/ScopedSingletonWrapper.h"
     40#include "core/singleton/ScopedSingletonIncludes.h"
    4141#include "core/config/ConfigValueIncludes.h"
    4242#include "core/CoreIncludes.h"
  • code/branches/core7/test/core/singleton/ScopeTest.cc

    r10458 r10459  
    11#include <gtest/gtest.h>
    2 #include "core/singleton/ScopedSingletonWrapper.h"
     2#include "core/singleton/ScopedSingletonIncludes.h"
    33
    44namespace orxonox
Note: See TracChangeset for help on using the changeset viewer.