Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10464


Ignore:
Timestamp:
May 25, 2015, 12:13:34 AM (9 years ago)
Author:
landauf
Message:

define ScopeID as integer constants instead of an enum. this allows to extend it and add new scopes outside of core.

Location:
code/branches/core7
Files:
23 edited

Legend:

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

    r10462 r10464  
    225225        // Create singletons that always exist (in other libraries)
    226226        orxout(internal_info) << "creating root scope:" << endl;
    227         this->rootScope_ = new Scope<ScopeID::Root>();
     227        this->rootScope_ = new Scope<ScopeID::ROOT>();
    228228
    229229        // Generate documentation instead of normal run?
     
    398398        // Create singletons associated with graphics (in other libraries)
    399399        orxout(internal_info) << "creating graphics scope:" << endl;
    400         graphicsScope_ = new Scope<ScopeID::Graphics>();
     400        graphicsScope_ = new Scope<ScopeID::GRAPHICS>();
    401401
    402402        unloader.Dismiss();
  • code/branches/core7/src/libraries/core/Core.h

    r10392 r10464  
    129129            TclBind*                  tclBind_;
    130130            TclThreadManager*         tclThreadManager_;
    131             Scope<ScopeID::Root>*     rootScope_;
     131            Scope<ScopeID::ROOT>*     rootScope_;
    132132            // graphical
    133133            GraphicsManager*          graphicsManager_;            //!< Interface to OGRE
    134134            InputManager*             inputManager_;               //!< Interface to OIS
    135135            GUIManager*               guiManager_;                 //!< Interface to GUI
    136             Scope<ScopeID::Graphics>* graphicsScope_;
     136            Scope<ScopeID::GRAPHICS>* graphicsScope_;
    137137
    138138            bool                      bGraphicsLoaded_;
  • code/branches/core7/src/libraries/core/CorePrereqs.h

    r10458 r10464  
    7979    namespace ScopeID
    8080    {
     81        typedef int Value;
     82
    8183        //!A list of available scopes for the Scope template.
    82         enum Value
    83         {
    84             Root,
    85             Graphics
    86         };
     84        static const Value ROOT = 1;
     85        static const Value GRAPHICS = 2;
    8786    }
    8887
  • code/branches/core7/src/libraries/core/input/KeyBinderManager.cc

    r10459 r10464  
    4141namespace orxonox
    4242{
    43     ManageScopedSingleton(KeyBinderManager, ScopeID::Graphics, false);
     43    ManageScopedSingleton(KeyBinderManager, ScopeID::GRAPHICS, false);
    4444
    4545    static const std::string __CC_keybind_name = "keybind";
  • code/branches/core7/src/libraries/core/input/KeyDetector.cc

    r10459 r10464  
    3838namespace orxonox
    3939{
    40     ManageScopedSingleton(KeyDetector, ScopeID::Graphics, false);
     40    ManageScopedSingleton(KeyDetector, ScopeID::GRAPHICS, false);
    4141
    4242    static const std::string __CC_KeyDetector_callback_name = "KeyDetectorKeyPressed";
  • code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc

    r10459 r10464  
    3434namespace orxonox
    3535{
    36     ManageScopedSingleton(DestroyLaterManager, ScopeID::Root, false);
     36    ManageScopedSingleton(DestroyLaterManager, ScopeID::ROOT, false);
    3737
    3838    RegisterAbstractClass(DestroyLaterManager).inheritsFrom<UpdateListener>();
  • code/branches/core7/src/libraries/network/Client.cc

    r10459 r10464  
    5757{
    5858
    59   ManageScopedSingleton( Client, ScopeID::Root, false );
     59  ManageScopedSingleton( Client, ScopeID::ROOT, false );
    6060
    6161  /**
  • code/branches/core7/src/libraries/network/LANDiscovery.cc

    r10459 r10464  
    3838namespace orxonox
    3939{
    40   ManageScopedSingleton(LANDiscovery, ScopeID::Graphics, false);
     40  ManageScopedSingleton(LANDiscovery, ScopeID::GRAPHICS, false);
    4141
    4242  LANDiscovery::LANDiscovery()
  • code/branches/core7/src/modules/designtools/ScreenshotManager.cc

    r10459 r10464  
    6161    SetConsoleCommand("printScreenHD", &ScreenshotManager::makeScreenshot_s);
    6262   
    63     ManageScopedSingleton(ScreenshotManager, ScopeID::Graphics, false);
     63    ManageScopedSingleton(ScreenshotManager, ScopeID::GRAPHICS, false);
    6464
    6565    RegisterAbstractClass(ScreenshotManager).inheritsFrom<Configurable>();
  • code/branches/core7/src/modules/designtools/SkyboxGenerator.cc

    r10459 r10464  
    6060    SetConsoleCommand("SkyboxGenerator", "createSkybox", &SkyboxGenerator::createSkybox).addShortcut();
    6161
    62     ManageScopedSingleton(SkyboxGenerator, ScopeID::Graphics, false);
     62    ManageScopedSingleton(SkyboxGenerator, ScopeID::GRAPHICS, false);
    6363
    6464    RegisterAbstractClass(SkyboxGenerator).inheritsFrom<Configurable>().inheritsFrom<Tickable>();
  • code/branches/core7/src/modules/notifications/NotificationManager.cc

    r10459 r10464  
    4747{
    4848
    49     ManageScopedSingleton(NotificationManager, ScopeID::Root, false);
     49    ManageScopedSingleton(NotificationManager, ScopeID::ROOT, false);
    5050
    5151    RegisterAbstractClass(NotificationManager).inheritsFrom<NotificationListener>();
  • code/branches/core7/src/modules/pickup/PickupManager.cc

    r10459 r10464  
    5151namespace orxonox
    5252{
    53     ManageScopedSingleton(PickupManager, ScopeID::Root, false);
     53    ManageScopedSingleton(PickupManager, ScopeID::ROOT, false);
    5454
    5555    // Initialization of the name of the PickupInventory GUI.
  • code/branches/core7/src/modules/questsystem/QuestManager.cc

    r10459 r10464  
    4949namespace orxonox
    5050{
    51     ManageScopedSingleton(QuestManager, ScopeID::Root, false);
     51    ManageScopedSingleton(QuestManager, ScopeID::ROOT, false);
    5252
    5353    /**
  • code/branches/core7/src/orxonox/CameraManager.cc

    r10459 r10464  
    4444namespace orxonox
    4545{
    46     ManageScopedSingleton(CameraManager, ScopeID::Graphics, false);
     46    ManageScopedSingleton(CameraManager, ScopeID::GRAPHICS, false);
    4747
    4848    CameraManager::CameraManager()
  • code/branches/core7/src/orxonox/LevelManager.cc

    r10459 r10464  
    5151    SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
    5252
    53     ManageScopedSingleton(LevelManager, ScopeID::Root, false);
     53    ManageScopedSingleton(LevelManager, ScopeID::ROOT, false);
    5454
    5555    RegisterAbstractClass(LevelManager).inheritsFrom<Configurable>();
  • code/branches/core7/src/orxonox/MoodManager.cc

    r10459 r10464  
    3636namespace orxonox
    3737{
    38     ManageScopedSingleton(MoodManager, ScopeID::Root, false);
     38    ManageScopedSingleton(MoodManager, ScopeID::ROOT, false);
    3939
    4040    // Note: I'm (Kevin Young) not entirely sure whether that's good code style:
  • code/branches/core7/src/orxonox/PlayerManager.cc

    r10459 r10464  
    3939namespace orxonox
    4040{
    41     ManageScopedSingleton(PlayerManager, ScopeID::Root, false);
     41    ManageScopedSingleton(PlayerManager, ScopeID::ROOT, false);
    4242
    4343    RegisterAbstractClass(PlayerManager).inheritsFrom<ClientConnectionListener>();
  • code/branches/core7/src/orxonox/chat/ChatHistory.cc

    r10459 r10464  
    3434{
    3535  /* singleton */
    36   ManageScopedSingleton( ChatHistory, ScopeID::Root, false );
     36  ManageScopedSingleton( ChatHistory, ScopeID::ROOT, false );
    3737
    3838  RegisterAbstractClass(ChatHistory).inheritsFrom<ChatListener>();
  • code/branches/core7/src/orxonox/chat/ChatInputHandler.cc

    r10459 r10464  
    6262{
    6363  /* singleton */
    64   ManageScopedSingleton( ChatInputHandler, ScopeID::Graphics, false );
     64  ManageScopedSingleton( ChatInputHandler, ScopeID::GRAPHICS, false );
    6565
    6666  /* add commands to console */
  • code/branches/core7/src/orxonox/chat/ChatManager.cc

    r10459 r10464  
    4040namespace orxonox
    4141{
    42     ManageScopedSingleton(ChatManager, ScopeID::Root, false);
     42    ManageScopedSingleton(ChatManager, ScopeID::ROOT, false);
    4343
    4444    SetConsoleCommand("chat", &ChatManager::chat).defaultValue(1, NETWORK_PEER_ID_BROADCAST);
  • code/branches/core7/src/orxonox/overlays/InGameConsole.cc

    r10459 r10464  
    6565    SetConsoleCommand("InGameConsole", "closeConsole", &InGameConsole::closeConsole);
    6666
    67     ManageScopedSingleton(InGameConsole, ScopeID::Graphics, false);
     67    ManageScopedSingleton(InGameConsole, ScopeID::GRAPHICS, false);
    6868
    6969    RegisterAbstractClass(InGameConsole).inheritsFrom<WindowEventListener>().inheritsFrom<UpdateListener>();
  • code/branches/core7/src/orxonox/sound/SoundManager.cc

    r10459 r10464  
    5050namespace orxonox
    5151{
    52     ManageScopedSingleton(SoundManager, ScopeID::Graphics, true);
     52    ManageScopedSingleton(SoundManager, ScopeID::GRAPHICS, true);
    5353
    5454    std::string SoundManager::getALErrorString(ALenum code)
  • code/branches/core7/test/core/singleton/ScopeTest.cc

    r10460 r10464  
    1818        };
    1919
    20         ManageScopedSingleton(TestSingletonRoot, ScopeID::Root, false);
    21         ManageScopedSingleton(TestSingletonGraphics, ScopeID::Graphics, false);
     20        ManageScopedSingleton(TestSingletonRoot, ScopeID::ROOT, false);
     21        ManageScopedSingleton(TestSingletonGraphics, ScopeID::GRAPHICS, false);
    2222
    2323        // Fixture
     
    3939    TEST_F(ScopeTest, ScopesDoNotExist)
    4040    {
    41         EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
    42         EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
     41        EXPECT_FALSE(Scope<ScopeID::ROOT>::isActive());
     42        EXPECT_FALSE(Scope<ScopeID::GRAPHICS>::isActive());
    4343    }
    4444
     
    5151    TEST_F(ScopeTest, RootScope)
    5252    {
    53         EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
     53        EXPECT_FALSE(Scope<ScopeID::ROOT>::isActive());
    5454        {   // create root scope
    55             Scope<ScopeID::Root> scope;
    56             EXPECT_TRUE(Scope<ScopeID::Root>::isActive());
     55            Scope<ScopeID::ROOT> scope;
     56            EXPECT_TRUE(Scope<ScopeID::ROOT>::isActive());
    5757        }   // destroy root scope
    58         EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
     58        EXPECT_FALSE(Scope<ScopeID::ROOT>::isActive());
    5959    }
    6060
    6161    TEST_F(ScopeTest, DISABLED_RootAndGraphicsScope)
    6262    {
    63         EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
     63        EXPECT_FALSE(Scope<ScopeID::GRAPHICS>::isActive());
    6464        {   // create root scope
    65             Scope<ScopeID::Root> scope;
    66             EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
     65            Scope<ScopeID::ROOT> scope;
     66            EXPECT_FALSE(Scope<ScopeID::GRAPHICS>::isActive());
    6767            {   // create graphics scope
    68                 Scope<ScopeID::Graphics> scope;
    69                 EXPECT_TRUE(Scope<ScopeID::Graphics>::isActive());
     68                Scope<ScopeID::GRAPHICS> scope;
     69                EXPECT_TRUE(Scope<ScopeID::GRAPHICS>::isActive());
    7070            }   // destroy graphics scope
    71             EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
     71            EXPECT_FALSE(Scope<ScopeID::GRAPHICS>::isActive());
    7272        }   // destroy root scope
    73         EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
     73        EXPECT_FALSE(Scope<ScopeID::GRAPHICS>::isActive());
    7474    }
    7575
     
    7878        EXPECT_FALSE(TestSingletonRoot::exists());
    7979        {   // create root scope
    80             Scope<ScopeID::Root> scope;
     80            Scope<ScopeID::ROOT> scope;
    8181            EXPECT_TRUE(TestSingletonRoot::exists());
    8282        }   // destroy root scope
     
    8888        EXPECT_FALSE(TestSingletonGraphics::exists());
    8989        {   // create root scope
    90             Scope<ScopeID::Root> scope;
     90            Scope<ScopeID::ROOT> scope;
    9191            EXPECT_FALSE(TestSingletonGraphics::exists());
    9292            {   // create graphics scope
    93                 Scope<ScopeID::Graphics> scope;
     93                Scope<ScopeID::GRAPHICS> scope;
    9494                EXPECT_TRUE(TestSingletonGraphics::exists());
    9595            }   // destroy graphics scope
Note: See TracChangeset for help on using the changeset viewer.