Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10458


Ignore:
Timestamp:
May 24, 2015, 11:51:05 AM (9 years ago)
Author:
landauf
Message:

renamed ScopedSingletonManager to ScopedSingletonWrapper. removed static maps.

Location:
code/branches/core7
Files:
1 deleted
26 edited
1 moved

Legend:

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

    r10413 r10458  
    5757#include "util/output/OutputManager.h"
    5858#include "core/singleton/Scope.h"
    59 #include "core/singleton/ScopedSingletonManager.h"
     59#include "core/singleton/ScopedSingletonWrapper.h"
    6060#include "util/SignalHandler.h"
    6161#include "PathConfig.h"
  • code/branches/core7/src/libraries/core/CorePrereqs.h

    r10419 r10458  
    199199    template <ScopeID::Value>
    200200    class Scope;
    201     template <class, ScopeID::Value>
    202     class ScopedSingleton;
     201    class ScopeManager;
     202    class ScopedSingletonWrapper;
    203203    class SettingsConfigFile;
    204204    template <class T>
  • code/branches/core7/src/libraries/core/input/KeyBinderManager.cc

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

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

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

    r10407 r10458  
    11ADD_SOURCE_FILES(CORE_SRC_FILES
    22  Scope.cc
    3   ScopedSingletonManager.cc
    43)
  • code/branches/core7/src/libraries/core/singleton/Scope.h

    r10412 r10458  
    4646Scopes are usually used to control the creation and destruction of Singletons.
    4747
    48 @see orxonox::ScopedSingletonManager
    4948@see orxonox::Singleton
    5049*/
  • code/branches/core7/src/libraries/core/singleton/ScopedSingletonWrapper.h

    r10457 r10458  
    3030    @file
    3131    @ingroup SingletonScope
    32     @brief Definition of orxonox::ScopedSingletonManager, orxonox::ClassScopedSingletonManager, and the ManageScopedSingleton macro.
    33 
    34     ScopedSingletonManager is used to create and destroy Singletons that belong to
     32    @brief Definition of orxonox::ScopedSingletonWrapper, orxonox::ClassScopedSingletonWrapper, and the ManageScopedSingleton macro.
     33
     34    ScopedSingletonWrapper is used to create and destroy Singletons that belong to
    3535    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.
    3737
    3838    See @ref SingletonExample "this code" for an example.
     
    4242*/
    4343
    44 #ifndef __ScopedSingletonManager_H__
    45 #define __ScopedSingletonManager_H__
     44#ifndef __ScopedSingletonWrapper_H__
     45#define __ScopedSingletonWrapper_H__
    4646
    4747#include "core/CorePrereqs.h"
    4848
    4949#include <cassert>
    50 #include <map>
    5150#include "util/Exception.h"
    5251#include "util/Singleton.h"
     
    5453
    5554/**
    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.
    5756    @param className The name of the singleton class
    5857    @param scope The scope in which the singleton should exist
    5958    @param allowedToFail If true, the singleton is allowed to fail and thus a try-catch block is used when creating the singleton.
    6059
    61     If this macro is called for a singleton, it is registered with ScopedSingletonManager
     60    If this macro is called for a singleton, it is wrapped in a ScopedSingletonWrapper and registered with ScopeManager
    6261    and will thus be created if its scope becomes active and destroyed if is deactivated.
    6362
     
    6665    be destroyed (unless the singleton explicitly deletes itself). To allow controlled
    6766    construction and destruction, the singleton can be put within a virtual scope. This is
    68     done by registering the singleton class with orxonox::ScopedSingletonManager. To
     67    done by registering the singleton class with orxonox::ScopeManager. To
    6968    do so, the ManageScopedSingleton() macro has to be called:
    7069
     
    8483#define ManageScopedSingleton(className, scope, allowedToFail) \
    8584    className* className::singletonPtr_s = NULL; \
    86     static ClassScopedSingletonManager<className, scope, allowedToFail> className##ScopedSingletonManager(#className)
     85    static ClassScopedSingletonWrapper<className, scope, allowedToFail> className##ScopedSingletonWrapper(#className)
    8786
    8887namespace orxonox
    8988{
    9089    /**
    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.
    9391    */
    94     class _CoreExport ScopedSingletonManager
     92    class _CoreExport ScopedSingletonWrapper
    9593    {
    9694        public:
    9795            /// Constructor: Initializes all the values
    98             ScopedSingletonManager(const std::string& className, ScopeID::Value scope)
     96            ScopedSingletonWrapper(const std::string& className, ScopeID::Value scope)
    9997                : className_(className)
    10098                , scope_(scope)
    10199            { }
    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() { }
    109101
    110102        protected:
     
    114106
    115107    /**
    116         @anchor ClassScopedSingletonManager
     108        @anchor ClassScopedSingletonWrapper
    117109
    118110        @brief Manages a scoped singleton for a given scope.
     
    130122    */
    131123    template <class T, ScopeID::Value scope, bool allowedToFail>
    132     class ClassScopedSingletonManager : public ScopedSingletonManager, public ScopeListener
     124    class ClassScopedSingletonWrapper : public ScopedSingletonWrapper, public ScopeListener
    133125    {
    134126    public:
    135         //! Constructor: Initializes the singleton pointer and passes the scope to ScopedSingletonManager and ScopeListener
    136         ClassScopedSingletonManager(const std::string& className)
    137             : ScopedSingletonManager(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)
    138130            , ScopeListener(scope)
    139131            , singletonPtr_(NULL)
    140132        {
    141             ScopedSingletonManager::addManager(this);
    142         }
    143 
    144         ~ClassScopedSingletonManager()
     133        }
     134
     135        ~ClassScopedSingletonWrapper()
    145136        {
    146137        }
     
    177168
    178169    /**
    179         @brief This class partially spezializes ClassScopedSingletonManager 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.
    180171        @param T The managed singleton class
    181172        @param scope The scope in which the singleton @a T should be active
    182173
    183         Because @a T could fail when being created, this partial spezialization of ClassScopedSingletonManager
     174        Because @a T could fail when being created, this partial spezialization of ClassScopedSingletonWrapper
    184175        uses a try-catch block to handle exceptions.
    185176
    186         See @ref ClassScopedSingletonManager for a full documentation of the basis template.
     177        See @ref ClassScopedSingletonWrapper for a full documentation of the basis template.
    187178    */
    188179    template <class T, ScopeID::Value scope>
    189     class ClassScopedSingletonManager<T, scope, true> : public ScopedSingletonManager, public ScopeListener
     180    class ClassScopedSingletonWrapper<T, scope, true> : public ScopedSingletonWrapper, public ScopeListener
    190181    {
    191182    public:
    192         //! Constructor: Initializes the singleton pointer and passes the scope to ScopedSingletonManager and ScopeListener
    193         ClassScopedSingletonManager(const std::string& className)
    194             : ScopedSingletonManager(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)
    195186            , ScopeListener(scope)
    196187            , singletonPtr_(NULL)
    197188        {
    198             ScopedSingletonManager::addManager(this);
    199         }
    200 
    201         ~ClassScopedSingletonManager()
     189        }
     190
     191        ~ClassScopedSingletonWrapper()
    202192        {
    203193        }
     
    241231}
    242232
    243 #endif /* __ScopedSingletonManager_H__ */
     233#endif /* __ScopedSingletonWrapper_H__ */
  • code/branches/core7/src/libraries/network/Client.cc

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

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

    r10407 r10458  
    3131#include "core/CoreIncludes.h"
    3232#include "core/CorePrereqs.h"
    33 #include "core/singleton/ScopedSingletonManager.h"
     33#include "core/singleton/ScopedSingletonWrapper.h"
    3434#include "util/Output.h"
    3535
  • code/branches/core7/src/libraries/util/Singleton.h

    r10418 r10458  
    5252        public:
    5353            TestSingleton();                                // public constructor because we may want to manage this singleton
    54                                                             //     with an orxonox::ScopedSingletonManager (see below)
     54                                                            //     with an orxonox::ScopedSingletonWrapper
    5555            virtual ~TestSingleton();                       // public destructor
    5656
  • code/branches/core7/src/modules/designtools/ScreenshotManager.cc

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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