Changeset 10458 for code/branches/core7/src
- Timestamp:
- May 24, 2015, 11:51:05 AM (9 years ago)
- Location:
- code/branches/core7/src
- Files:
-
- 1 deleted
- 25 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/Core.cc
r10413 r10458 57 57 #include "util/output/OutputManager.h" 58 58 #include "core/singleton/Scope.h" 59 #include "core/singleton/ScopedSingleton Manager.h"59 #include "core/singleton/ScopedSingletonWrapper.h" 60 60 #include "util/SignalHandler.h" 61 61 #include "PathConfig.h" -
code/branches/core7/src/libraries/core/CorePrereqs.h
r10419 r10458 199 199 template <ScopeID::Value> 200 200 class Scope; 201 template <class, ScopeID::Value>202 class ScopedSingleton ;201 class ScopeManager; 202 class ScopedSingletonWrapper; 203 203 class SettingsConfigFile; 204 204 template <class T> -
code/branches/core7/src/libraries/core/input/KeyBinderManager.cc
r10407 r10458 31 31 #include "util/Output.h" 32 32 #include "util/Exception.h" 33 #include "core/singleton/ScopedSingleton Manager.h"33 #include "core/singleton/ScopedSingletonWrapper.h" 34 34 #include "core/config/ConfigValueIncludes.h" 35 35 #include "core/CoreIncludes.h" -
code/branches/core7/src/libraries/core/input/KeyDetector.cc
r10407 r10458 30 30 31 31 #include "core/CoreIncludes.h" 32 #include "core/singleton/ScopedSingleton Manager.h"32 #include "core/singleton/ScopedSingletonWrapper.h" 33 33 #include "core/command/ConsoleCommandIncludes.h" 34 34 #include "Button.h" -
code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc
r10419 r10458 30 30 31 31 #include "core/CoreIncludes.h" 32 #include "core/singleton/ScopedSingleton Manager.h"32 #include "core/singleton/ScopedSingletonWrapper.h" 33 33 34 34 namespace orxonox -
code/branches/core7/src/libraries/core/singleton/CMakeLists.txt
r10407 r10458 1 1 ADD_SOURCE_FILES(CORE_SRC_FILES 2 2 Scope.cc 3 ScopedSingletonManager.cc4 3 ) -
code/branches/core7/src/libraries/core/singleton/Scope.h
r10412 r10458 46 46 Scopes are usually used to control the creation and destruction of Singletons. 47 47 48 @see orxonox::ScopedSingletonManager49 48 @see orxonox::Singleton 50 49 */ -
code/branches/core7/src/libraries/core/singleton/ScopedSingletonWrapper.h
r10457 r10458 30 30 @file 31 31 @ingroup SingletonScope 32 @brief Definition of orxonox::ScopedSingleton Manager, orxonox::ClassScopedSingletonManager, and the ManageScopedSingleton macro.33 34 ScopedSingleton Manager is used to create and destroy Singletons that belong to32 @brief Definition of orxonox::ScopedSingletonWrapper, orxonox::ClassScopedSingletonWrapper, and the ManageScopedSingleton macro. 33 34 ScopedSingletonWrapper is used to create and destroy Singletons that belong to 35 35 a given Scope. For each one of these singletons, the macro ManageScopedSingleton() 36 has to be called to register the singleton with orxonox::ScopedSingletonManager.36 has to be called to register the wrapper with orxonox::ScopeManager. 37 37 38 38 See @ref SingletonExample "this code" for an example. … … 42 42 */ 43 43 44 #ifndef __ScopedSingleton Manager_H__45 #define __ScopedSingleton Manager_H__44 #ifndef __ScopedSingletonWrapper_H__ 45 #define __ScopedSingletonWrapper_H__ 46 46 47 47 #include "core/CorePrereqs.h" 48 48 49 49 #include <cassert> 50 #include <map>51 50 #include "util/Exception.h" 52 51 #include "util/Singleton.h" … … 54 53 55 54 /** 56 @brief Registers an orxonox::Singleton with orxonox::ScopedSingletonManager.55 @brief Creates an orxonox::ScopedSingletonWrapper for an orxonox::Singleton and registers it with orxonox::ScopeManager. 57 56 @param className The name of the singleton class 58 57 @param scope The scope in which the singleton should exist 59 58 @param allowedToFail If true, the singleton is allowed to fail and thus a try-catch block is used when creating the singleton. 60 59 61 If this macro is called for a singleton, it is registered with ScopedSingletonManager60 If this macro is called for a singleton, it is wrapped in a ScopedSingletonWrapper and registered with ScopeManager 62 61 and will thus be created if its scope becomes active and destroyed if is deactivated. 63 62 … … 66 65 be destroyed (unless the singleton explicitly deletes itself). To allow controlled 67 66 construction and destruction, the singleton can be put within a virtual scope. This is 68 done by registering the singleton class with orxonox::Scope dSingletonManager. To67 done by registering the singleton class with orxonox::ScopeManager. To 69 68 do so, the ManageScopedSingleton() macro has to be called: 70 69 … … 84 83 #define ManageScopedSingleton(className, scope, allowedToFail) \ 85 84 className* className::singletonPtr_s = NULL; \ 86 static ClassScopedSingleton Manager<className, scope, allowedToFail> className##ScopedSingletonManager(#className)85 static ClassScopedSingletonWrapper<className, scope, allowedToFail> className##ScopedSingletonWrapper(#className) 87 86 88 87 namespace orxonox 89 88 { 90 89 /** 91 @brief Base class of ClassScopedSingletonManager. Keeps track of all existing ScopedSingletonManagers 92 and stores them in a map, sorted by the scope they belong to. 90 @brief Base class of ClassScopedSingletonWrapper. 93 91 */ 94 class _CoreExport ScopedSingleton Manager92 class _CoreExport ScopedSingletonWrapper 95 93 { 96 94 public: 97 95 /// Constructor: Initializes all the values 98 ScopedSingleton Manager(const std::string& className, ScopeID::Value scope)96 ScopedSingletonWrapper(const std::string& className, ScopeID::Value scope) 99 97 : className_(className) 100 98 , scope_(scope) 101 99 { } 102 virtual ~ScopedSingletonManager() { } 103 104 /// Adds a new instance of ScopedSingletonManager to the map. 105 static void addManager(ScopedSingletonManager* manager); 106 107 static std::map<std::string, ScopedSingletonManager*>& getManagers(); 108 typedef std::multimap<ScopeID::Value, ScopedSingletonManager*> ManagerMultiMap; 100 virtual ~ScopedSingletonWrapper() { } 109 101 110 102 protected: … … 114 106 115 107 /** 116 @anchor ClassScopedSingleton Manager108 @anchor ClassScopedSingletonWrapper 117 109 118 110 @brief Manages a scoped singleton for a given scope. … … 130 122 */ 131 123 template <class T, ScopeID::Value scope, bool allowedToFail> 132 class ClassScopedSingleton Manager : public ScopedSingletonManager, public ScopeListener124 class ClassScopedSingletonWrapper : public ScopedSingletonWrapper, public ScopeListener 133 125 { 134 126 public: 135 //! Constructor: Initializes the singleton pointer and passes the scope to ScopedSingleton Manager and ScopeListener136 ClassScopedSingleton Manager(const std::string& className)137 : ScopedSingleton Manager(className, scope)127 //! Constructor: Initializes the singleton pointer and passes the scope to ScopedSingletonWrapper and ScopeListener 128 ClassScopedSingletonWrapper(const std::string& className) 129 : ScopedSingletonWrapper(className, scope) 138 130 , ScopeListener(scope) 139 131 , singletonPtr_(NULL) 140 132 { 141 ScopedSingletonManager::addManager(this); 142 } 143 144 ~ClassScopedSingletonManager() 133 } 134 135 ~ClassScopedSingletonWrapper() 145 136 { 146 137 } … … 177 168 178 169 /** 179 @brief This class partially spezializes ClassScopedSingleton Manager for classes @a T that are allowed to fail.170 @brief This class partially spezializes ClassScopedSingletonWrapper for classes @a T that are allowed to fail. 180 171 @param T The managed singleton class 181 172 @param scope The scope in which the singleton @a T should be active 182 173 183 Because @a T could fail when being created, this partial spezialization of ClassScopedSingleton Manager174 Because @a T could fail when being created, this partial spezialization of ClassScopedSingletonWrapper 184 175 uses a try-catch block to handle exceptions. 185 176 186 See @ref ClassScopedSingleton Manager for a full documentation of the basis template.177 See @ref ClassScopedSingletonWrapper for a full documentation of the basis template. 187 178 */ 188 179 template <class T, ScopeID::Value scope> 189 class ClassScopedSingleton Manager<T, scope, true> : public ScopedSingletonManager, public ScopeListener180 class ClassScopedSingletonWrapper<T, scope, true> : public ScopedSingletonWrapper, public ScopeListener 190 181 { 191 182 public: 192 //! Constructor: Initializes the singleton pointer and passes the scope to ScopedSingleton Manager and ScopeListener193 ClassScopedSingleton Manager(const std::string& className)194 : ScopedSingleton Manager(className, scope)183 //! Constructor: Initializes the singleton pointer and passes the scope to ScopedSingletonWrapper and ScopeListener 184 ClassScopedSingletonWrapper(const std::string& className) 185 : ScopedSingletonWrapper(className, scope) 195 186 , ScopeListener(scope) 196 187 , singletonPtr_(NULL) 197 188 { 198 ScopedSingletonManager::addManager(this); 199 } 200 201 ~ClassScopedSingletonManager() 189 } 190 191 ~ClassScopedSingletonWrapper() 202 192 { 203 193 } … … 241 231 } 242 232 243 #endif /* __ScopedSingleton Manager_H__ */233 #endif /* __ScopedSingletonWrapper_H__ */ -
code/branches/core7/src/libraries/network/Client.cc
r10424 r10458 52 52 #include "core/Game.h" 53 53 #include "core/commandline/CommandLineParser.h" 54 #include "core/singleton/ScopedSingleton Manager.h"54 #include "core/singleton/ScopedSingletonWrapper.h" 55 55 56 56 namespace orxonox -
code/branches/core7/src/libraries/network/LANDiscovery.cc
r10424 r10458 33 33 34 34 #include "core/CoreIncludes.h" 35 #include "core/singleton/ScopedSingleton Manager.h"35 #include "core/singleton/ScopedSingletonWrapper.h" 36 36 37 37 -
code/branches/core7/src/libraries/network/MasterServer.cc
r10407 r10458 31 31 #include "core/CoreIncludes.h" 32 32 #include "core/CorePrereqs.h" 33 #include "core/singleton/ScopedSingleton Manager.h"33 #include "core/singleton/ScopedSingletonWrapper.h" 34 34 #include "util/Output.h" 35 35 -
code/branches/core7/src/libraries/util/Singleton.h
r10418 r10458 52 52 public: 53 53 TestSingleton(); // public constructor because we may want to manage this singleton 54 // with an orxonox::ScopedSingleton Manager (see below)54 // with an orxonox::ScopedSingletonWrapper 55 55 virtual ~TestSingleton(); // public destructor 56 56 -
code/branches/core7/src/modules/designtools/ScreenshotManager.cc
r10407 r10458 48 48 #include "core/Resource.h" 49 49 #include "core/command/ConsoleCommandIncludes.h" 50 #include "core/singleton/ScopedSingleton Manager.h"50 #include "core/singleton/ScopedSingletonWrapper.h" 51 51 #include "util/StringUtils.h" 52 52 -
code/branches/core7/src/modules/designtools/SkyboxGenerator.cc
r10407 r10458 45 45 #include "core/command/ConsoleCommandIncludes.h" 46 46 #include "core/command/CommandExecutor.h" 47 #include "core/singleton/ScopedSingleton Manager.h"47 #include "core/singleton/ScopedSingletonWrapper.h" 48 48 49 49 #include "controllers/HumanController.h" -
code/branches/core7/src/modules/notifications/NotificationManager.cc
r10407 r10458 37 37 #include "core/CoreIncludes.h" 38 38 #include "core/LuaState.h" 39 #include "core/singleton/ScopedSingleton Manager.h"39 #include "core/singleton/ScopedSingletonWrapper.h" 40 40 41 41 #include "interfaces/NotificationListener.h" -
code/branches/core7/src/modules/pickup/PickupManager.cc
r10407 r10458 38 38 #include "core/GUIManager.h" 39 39 #include "core/class/Identifier.h" 40 #include "core/singleton/ScopedSingleton Manager.h"40 #include "core/singleton/ScopedSingletonWrapper.h" 41 41 #include "network/Host.h" 42 42 #include "network/NetworkFunction.h" -
code/branches/core7/src/modules/questsystem/QuestManager.cc
r10407 r10458 36 36 #include "util/Exception.h" 37 37 #include "util/OrxAssert.h" 38 #include "core/singleton/ScopedSingleton Manager.h"38 #include "core/singleton/ScopedSingletonWrapper.h" 39 39 #include "core/command/ConsoleCommand.h" 40 40 #include "core/GUIManager.h" -
code/branches/core7/src/orxonox/CameraManager.cc
r10407 r10458 38 38 #include "core/GraphicsManager.h" 39 39 #include "core/object/ObjectList.h" 40 #include "core/singleton/ScopedSingleton Manager.h"40 #include "core/singleton/ScopedSingletonWrapper.h" 41 41 #include "tools/Shader.h" 42 42 #include "graphics/Camera.h" -
code/branches/core7/src/orxonox/LevelManager.cc
r10407 r10458 36 36 #include <map> 37 37 38 #include "core/singleton/ScopedSingleton Manager.h"38 #include "core/singleton/ScopedSingletonWrapper.h" 39 39 #include "core/commandline/CommandLineIncludes.h" 40 40 #include "core/config/ConfigValueIncludes.h" -
code/branches/core7/src/orxonox/MoodManager.cc
r10407 r10458 29 29 #include "MoodManager.h" 30 30 31 #include "core/singleton/ScopedSingleton Manager.h"31 #include "core/singleton/ScopedSingletonWrapper.h" 32 32 #include "core/config/ConfigValueIncludes.h" 33 33 #include "core/CoreIncludes.h" -
code/branches/core7/src/orxonox/PlayerManager.cc
r10407 r10458 31 31 #include "core/CoreIncludes.h" 32 32 #include "core/GameMode.h" 33 #include "core/singleton/ScopedSingleton Manager.h"33 #include "core/singleton/ScopedSingletonWrapper.h" 34 34 35 35 #include "Level.h" -
code/branches/core7/src/orxonox/chat/ChatHistory.cc
r10407 r10458 28 28 29 29 #include "ChatHistory.h" 30 #include "core/singleton/ScopedSingleton Manager.h"30 #include "core/singleton/ScopedSingletonWrapper.h" 31 31 32 32 #ifndef CHATTEST -
code/branches/core7/src/orxonox/chat/ChatInputHandler.cc
r10407 r10458 47 47 #endif 48 48 49 #include "core/singleton/ScopedSingleton Manager.h"49 #include "core/singleton/ScopedSingletonWrapper.h" 50 50 #include "core/CoreIncludes.h" 51 51 #include "core/GUIManager.h" -
code/branches/core7/src/orxonox/chat/ChatManager.cc
r10407 r10458 31 31 32 32 #include "core/CoreIncludes.h" 33 #include "core/singleton/ScopedSingleton Manager.h"33 #include "core/singleton/ScopedSingletonWrapper.h" 34 34 #include "core/command/ConsoleCommandIncludes.h" 35 35 #include "network/Host.h" -
code/branches/core7/src/orxonox/overlays/InGameConsole.cc
r10413 r10458 50 50 #include "core/config/ConfigValueIncludes.h" 51 51 #include "core/command/ConsoleCommandIncludes.h" 52 #include "core/singleton/ScopedSingleton Manager.h"52 #include "core/singleton/ScopedSingletonWrapper.h" 53 53 #include "core/GUIManager.h" 54 54 #include "core/input/InputManager.h" -
code/branches/core7/src/orxonox/sound/SoundManager.cc
r10413 r10458 38 38 #include "util/Math.h" 39 39 #include "util/Clock.h" 40 #include "core/singleton/ScopedSingleton Manager.h"40 #include "core/singleton/ScopedSingletonWrapper.h" 41 41 #include "core/config/ConfigValueIncludes.h" 42 42 #include "core/CoreIncludes.h"
Note: See TracChangeset
for help on using the changeset viewer.