[Orxonox-commit 5804] r10464 - in code/branches/core7: src/libraries/core src/libraries/core/input src/libraries/core/object src/libraries/network src/modules/designtools src/modules/notifications src/modules/pickup src/modules/questsystem src/orxonox src/orxonox/chat src/orxonox/overlays src/orxonox/sound test/core/singleton

landauf at orxonox.net landauf at orxonox.net
Mon May 25 00:13:35 CEST 2015


Author: landauf
Date: 2015-05-25 00:13:34 +0200 (Mon, 25 May 2015)
New Revision: 10464

Modified:
   code/branches/core7/src/libraries/core/Core.cc
   code/branches/core7/src/libraries/core/Core.h
   code/branches/core7/src/libraries/core/CorePrereqs.h
   code/branches/core7/src/libraries/core/input/KeyBinderManager.cc
   code/branches/core7/src/libraries/core/input/KeyDetector.cc
   code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc
   code/branches/core7/src/libraries/network/Client.cc
   code/branches/core7/src/libraries/network/LANDiscovery.cc
   code/branches/core7/src/modules/designtools/ScreenshotManager.cc
   code/branches/core7/src/modules/designtools/SkyboxGenerator.cc
   code/branches/core7/src/modules/notifications/NotificationManager.cc
   code/branches/core7/src/modules/pickup/PickupManager.cc
   code/branches/core7/src/modules/questsystem/QuestManager.cc
   code/branches/core7/src/orxonox/CameraManager.cc
   code/branches/core7/src/orxonox/LevelManager.cc
   code/branches/core7/src/orxonox/MoodManager.cc
   code/branches/core7/src/orxonox/PlayerManager.cc
   code/branches/core7/src/orxonox/chat/ChatHistory.cc
   code/branches/core7/src/orxonox/chat/ChatInputHandler.cc
   code/branches/core7/src/orxonox/chat/ChatManager.cc
   code/branches/core7/src/orxonox/overlays/InGameConsole.cc
   code/branches/core7/src/orxonox/sound/SoundManager.cc
   code/branches/core7/test/core/singleton/ScopeTest.cc
Log:
define ScopeID as integer constants instead of an enum. this allows to extend it and add new scopes outside of core.

Modified: code/branches/core7/src/libraries/core/Core.cc
===================================================================
--- code/branches/core7/src/libraries/core/Core.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/libraries/core/Core.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -224,7 +224,7 @@
 
         // Create singletons that always exist (in other libraries)
         orxout(internal_info) << "creating root scope:" << endl;
-        this->rootScope_ = new Scope<ScopeID::Root>();
+        this->rootScope_ = new Scope<ScopeID::ROOT>();
 
         // Generate documentation instead of normal run?
         std::string docFilename;
@@ -397,7 +397,7 @@
 
         // Create singletons associated with graphics (in other libraries)
         orxout(internal_info) << "creating graphics scope:" << endl;
-        graphicsScope_ = new Scope<ScopeID::Graphics>();
+        graphicsScope_ = new Scope<ScopeID::GRAPHICS>();
 
         unloader.Dismiss();
 

Modified: code/branches/core7/src/libraries/core/Core.h
===================================================================
--- code/branches/core7/src/libraries/core/Core.h	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/libraries/core/Core.h	2015-05-24 22:13:34 UTC (rev 10464)
@@ -128,12 +128,12 @@
             IOConsole*                ioConsole_;
             TclBind*                  tclBind_;
             TclThreadManager*         tclThreadManager_;
-            Scope<ScopeID::Root>*     rootScope_;
+            Scope<ScopeID::ROOT>*     rootScope_;
             // graphical
             GraphicsManager*          graphicsManager_;            //!< Interface to OGRE
             InputManager*             inputManager_;               //!< Interface to OIS
             GUIManager*               guiManager_;                 //!< Interface to GUI
-            Scope<ScopeID::Graphics>* graphicsScope_;
+            Scope<ScopeID::GRAPHICS>* graphicsScope_;
 
             bool                      bGraphicsLoaded_;
             std::string               language_;                   //!< The language

Modified: code/branches/core7/src/libraries/core/CorePrereqs.h
===================================================================
--- code/branches/core7/src/libraries/core/CorePrereqs.h	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/libraries/core/CorePrereqs.h	2015-05-24 22:13:34 UTC (rev 10464)
@@ -78,12 +78,11 @@
 {
     namespace ScopeID
     {
+        typedef int Value;
+
         //!A list of available scopes for the Scope template.
-        enum Value
-        {
-            Root,
-            Graphics
-        };
+        static const Value ROOT = 1;
+        static const Value GRAPHICS = 2;
     }
 
     namespace XMLPort

Modified: code/branches/core7/src/libraries/core/input/KeyBinderManager.cc
===================================================================
--- code/branches/core7/src/libraries/core/input/KeyBinderManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/libraries/core/input/KeyBinderManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -40,7 +40,7 @@
 
 namespace orxonox
 {
-    ManageScopedSingleton(KeyBinderManager, ScopeID::Graphics, false);
+    ManageScopedSingleton(KeyBinderManager, ScopeID::GRAPHICS, false);
 
     static const std::string __CC_keybind_name = "keybind";
     static const std::string __CC_tkeybind_name = "tkeybind";

Modified: code/branches/core7/src/libraries/core/input/KeyDetector.cc
===================================================================
--- code/branches/core7/src/libraries/core/input/KeyDetector.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/libraries/core/input/KeyDetector.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -37,7 +37,7 @@
 
 namespace orxonox
 {
-    ManageScopedSingleton(KeyDetector, ScopeID::Graphics, false);
+    ManageScopedSingleton(KeyDetector, ScopeID::GRAPHICS, false);
 
     static const std::string __CC_KeyDetector_callback_name = "KeyDetectorKeyPressed";
     DeclareConsoleCommand(__CC_KeyDetector_callback_name, &prototype::void__string).hide();

Modified: code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc
===================================================================
--- code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -33,7 +33,7 @@
 
 namespace orxonox
 {
-    ManageScopedSingleton(DestroyLaterManager, ScopeID::Root, false);
+    ManageScopedSingleton(DestroyLaterManager, ScopeID::ROOT, false);
 
     RegisterAbstractClass(DestroyLaterManager).inheritsFrom<UpdateListener>();
 

Modified: code/branches/core7/src/libraries/network/Client.cc
===================================================================
--- code/branches/core7/src/libraries/network/Client.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/libraries/network/Client.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -56,7 +56,7 @@
 namespace orxonox
 {
 
-  ManageScopedSingleton( Client, ScopeID::Root, false );
+  ManageScopedSingleton( Client, ScopeID::ROOT, false );
 
   /**
   * Constructor for the Client class

Modified: code/branches/core7/src/libraries/network/LANDiscovery.cc
===================================================================
--- code/branches/core7/src/libraries/network/LANDiscovery.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/libraries/network/LANDiscovery.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -37,7 +37,7 @@
 
 namespace orxonox
 {
-  ManageScopedSingleton(LANDiscovery, ScopeID::Graphics, false);
+  ManageScopedSingleton(LANDiscovery, ScopeID::GRAPHICS, false);
 
   LANDiscovery::LANDiscovery()
   {

Modified: code/branches/core7/src/modules/designtools/ScreenshotManager.cc
===================================================================
--- code/branches/core7/src/modules/designtools/ScreenshotManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/modules/designtools/ScreenshotManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -60,7 +60,7 @@
 
     SetConsoleCommand("printScreenHD", &ScreenshotManager::makeScreenshot_s);
     
-    ManageScopedSingleton(ScreenshotManager, ScopeID::Graphics, false);
+    ManageScopedSingleton(ScreenshotManager, ScopeID::GRAPHICS, false);
 
     RegisterAbstractClass(ScreenshotManager).inheritsFrom<Configurable>();
 

Modified: code/branches/core7/src/modules/designtools/SkyboxGenerator.cc
===================================================================
--- code/branches/core7/src/modules/designtools/SkyboxGenerator.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/modules/designtools/SkyboxGenerator.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -59,7 +59,7 @@
 
     SetConsoleCommand("SkyboxGenerator", "createSkybox", &SkyboxGenerator::createSkybox).addShortcut();
 
-    ManageScopedSingleton(SkyboxGenerator, ScopeID::Graphics, false);
+    ManageScopedSingleton(SkyboxGenerator, ScopeID::GRAPHICS, false);
 
     RegisterAbstractClass(SkyboxGenerator).inheritsFrom<Configurable>().inheritsFrom<Tickable>();
 

Modified: code/branches/core7/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/branches/core7/src/modules/notifications/NotificationManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/modules/notifications/NotificationManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -46,7 +46,7 @@
 namespace orxonox
 {
 
-    ManageScopedSingleton(NotificationManager, ScopeID::Root, false);
+    ManageScopedSingleton(NotificationManager, ScopeID::ROOT, false);
 
     RegisterAbstractClass(NotificationManager).inheritsFrom<NotificationListener>();
 

Modified: code/branches/core7/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/core7/src/modules/pickup/PickupManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/modules/pickup/PickupManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -50,7 +50,7 @@
 
 namespace orxonox
 {
-    ManageScopedSingleton(PickupManager, ScopeID::Root, false);
+    ManageScopedSingleton(PickupManager, ScopeID::ROOT, false);
 
     // Initialization of the name of the PickupInventory GUI.
     /*static*/ const std::string PickupManager::guiName_s = "PickupInventory";

Modified: code/branches/core7/src/modules/questsystem/QuestManager.cc
===================================================================
--- code/branches/core7/src/modules/questsystem/QuestManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/modules/questsystem/QuestManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -48,7 +48,7 @@
 
 namespace orxonox
 {
-    ManageScopedSingleton(QuestManager, ScopeID::Root, false);
+    ManageScopedSingleton(QuestManager, ScopeID::ROOT, false);
 
     /**
     @brief

Modified: code/branches/core7/src/orxonox/CameraManager.cc
===================================================================
--- code/branches/core7/src/orxonox/CameraManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/orxonox/CameraManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -43,7 +43,7 @@
 
 namespace orxonox
 {
-    ManageScopedSingleton(CameraManager, ScopeID::Graphics, false);
+    ManageScopedSingleton(CameraManager, ScopeID::GRAPHICS, false);
 
     CameraManager::CameraManager()
     {

Modified: code/branches/core7/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/core7/src/orxonox/LevelManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/orxonox/LevelManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -50,7 +50,7 @@
 {
     SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
 
-    ManageScopedSingleton(LevelManager, ScopeID::Root, false);
+    ManageScopedSingleton(LevelManager, ScopeID::ROOT, false);
 
     RegisterAbstractClass(LevelManager).inheritsFrom<Configurable>();
 

Modified: code/branches/core7/src/orxonox/MoodManager.cc
===================================================================
--- code/branches/core7/src/orxonox/MoodManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/orxonox/MoodManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -35,7 +35,7 @@
 
 namespace orxonox
 {
-    ManageScopedSingleton(MoodManager, ScopeID::Root, false);
+    ManageScopedSingleton(MoodManager, ScopeID::ROOT, false);
 
     // Note: I'm (Kevin Young) not entirely sure whether that's good code style:
     const std::string MoodManager::defaultMood_ = "default";

Modified: code/branches/core7/src/orxonox/PlayerManager.cc
===================================================================
--- code/branches/core7/src/orxonox/PlayerManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/orxonox/PlayerManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -38,7 +38,7 @@
 
 namespace orxonox
 {
-    ManageScopedSingleton(PlayerManager, ScopeID::Root, false);
+    ManageScopedSingleton(PlayerManager, ScopeID::ROOT, false);
 
     RegisterAbstractClass(PlayerManager).inheritsFrom<ClientConnectionListener>();
 

Modified: code/branches/core7/src/orxonox/chat/ChatHistory.cc
===================================================================
--- code/branches/core7/src/orxonox/chat/ChatHistory.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/orxonox/chat/ChatHistory.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -33,7 +33,7 @@
 namespace orxonox
 {
   /* singleton */
-  ManageScopedSingleton( ChatHistory, ScopeID::Root, false );
+  ManageScopedSingleton( ChatHistory, ScopeID::ROOT, false );
 
   RegisterAbstractClass(ChatHistory).inheritsFrom<ChatListener>();
 

Modified: code/branches/core7/src/orxonox/chat/ChatInputHandler.cc
===================================================================
--- code/branches/core7/src/orxonox/chat/ChatInputHandler.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/orxonox/chat/ChatInputHandler.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -61,7 +61,7 @@
 namespace orxonox
 {
   /* singleton */
-  ManageScopedSingleton( ChatInputHandler, ScopeID::Graphics, false );
+  ManageScopedSingleton( ChatInputHandler, ScopeID::GRAPHICS, false );
 
   /* add commands to console */
   SetConsoleCommand( "startchat", &ChatInputHandler::activate_static );

Modified: code/branches/core7/src/orxonox/chat/ChatManager.cc
===================================================================
--- code/branches/core7/src/orxonox/chat/ChatManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/orxonox/chat/ChatManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -39,7 +39,7 @@
 
 namespace orxonox
 {
-    ManageScopedSingleton(ChatManager, ScopeID::Root, false);
+    ManageScopedSingleton(ChatManager, ScopeID::ROOT, false);
 
     SetConsoleCommand("chat", &ChatManager::chat).defaultValue(1, NETWORK_PEER_ID_BROADCAST);
 

Modified: code/branches/core7/src/orxonox/overlays/InGameConsole.cc
===================================================================
--- code/branches/core7/src/orxonox/overlays/InGameConsole.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/orxonox/overlays/InGameConsole.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -64,7 +64,7 @@
     SetConsoleCommand("InGameConsole", "openConsole", &InGameConsole::openConsole);
     SetConsoleCommand("InGameConsole", "closeConsole", &InGameConsole::closeConsole);
 
-    ManageScopedSingleton(InGameConsole, ScopeID::Graphics, false);
+    ManageScopedSingleton(InGameConsole, ScopeID::GRAPHICS, false);
 
     RegisterAbstractClass(InGameConsole).inheritsFrom<WindowEventListener>().inheritsFrom<UpdateListener>();
 

Modified: code/branches/core7/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/core7/src/orxonox/sound/SoundManager.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/src/orxonox/sound/SoundManager.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -49,7 +49,7 @@
 
 namespace orxonox
 {
-    ManageScopedSingleton(SoundManager, ScopeID::Graphics, true);
+    ManageScopedSingleton(SoundManager, ScopeID::GRAPHICS, true);
 
     std::string SoundManager::getALErrorString(ALenum code)
     {

Modified: code/branches/core7/test/core/singleton/ScopeTest.cc
===================================================================
--- code/branches/core7/test/core/singleton/ScopeTest.cc	2015-05-24 22:00:14 UTC (rev 10463)
+++ code/branches/core7/test/core/singleton/ScopeTest.cc	2015-05-24 22:13:34 UTC (rev 10464)
@@ -17,8 +17,8 @@
             static TestSingletonGraphics* singletonPtr_s;
         };
 
-        ManageScopedSingleton(TestSingletonRoot, ScopeID::Root, false);
-        ManageScopedSingleton(TestSingletonGraphics, ScopeID::Graphics, false);
+        ManageScopedSingleton(TestSingletonRoot, ScopeID::ROOT, false);
+        ManageScopedSingleton(TestSingletonGraphics, ScopeID::GRAPHICS, false);
 
         // Fixture
         class ScopeTest : public ::testing::Test
@@ -38,8 +38,8 @@
 
     TEST_F(ScopeTest, ScopesDoNotExist)
     {
-        EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
-        EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
+        EXPECT_FALSE(Scope<ScopeID::ROOT>::isActive());
+        EXPECT_FALSE(Scope<ScopeID::GRAPHICS>::isActive());
     }
 
     TEST_F(ScopeTest, SingletonsDoNotExist)
@@ -50,34 +50,34 @@
 
     TEST_F(ScopeTest, RootScope)
     {
-        EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
+        EXPECT_FALSE(Scope<ScopeID::ROOT>::isActive());
         {   // create root scope
-            Scope<ScopeID::Root> scope;
-            EXPECT_TRUE(Scope<ScopeID::Root>::isActive());
+            Scope<ScopeID::ROOT> scope;
+            EXPECT_TRUE(Scope<ScopeID::ROOT>::isActive());
         }   // destroy root scope
-        EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
+        EXPECT_FALSE(Scope<ScopeID::ROOT>::isActive());
     }
 
     TEST_F(ScopeTest, DISABLED_RootAndGraphicsScope)
     {
-        EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
+        EXPECT_FALSE(Scope<ScopeID::GRAPHICS>::isActive());
         {   // create root scope
-            Scope<ScopeID::Root> scope;
-            EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
+            Scope<ScopeID::ROOT> scope;
+            EXPECT_FALSE(Scope<ScopeID::GRAPHICS>::isActive());
             {   // create graphics scope
-                Scope<ScopeID::Graphics> scope;
-                EXPECT_TRUE(Scope<ScopeID::Graphics>::isActive());
+                Scope<ScopeID::GRAPHICS> scope;
+                EXPECT_TRUE(Scope<ScopeID::GRAPHICS>::isActive());
             }   // destroy graphics scope
-            EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
+            EXPECT_FALSE(Scope<ScopeID::GRAPHICS>::isActive());
         }   // destroy root scope
-        EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
+        EXPECT_FALSE(Scope<ScopeID::GRAPHICS>::isActive());
     }
 
     TEST_F(ScopeTest, RootSingleton)
     {
         EXPECT_FALSE(TestSingletonRoot::exists());
         {   // create root scope
-            Scope<ScopeID::Root> scope;
+            Scope<ScopeID::ROOT> scope;
             EXPECT_TRUE(TestSingletonRoot::exists());
         }   // destroy root scope
         EXPECT_FALSE(TestSingletonRoot::exists());
@@ -87,10 +87,10 @@
     {
         EXPECT_FALSE(TestSingletonGraphics::exists());
         {   // create root scope
-            Scope<ScopeID::Root> scope;
+            Scope<ScopeID::ROOT> scope;
             EXPECT_FALSE(TestSingletonGraphics::exists());
             {   // create graphics scope
-                Scope<ScopeID::Graphics> scope;
+                Scope<ScopeID::GRAPHICS> scope;
                 EXPECT_TRUE(TestSingletonGraphics::exists());
             }   // destroy graphics scope
             EXPECT_FALSE(TestSingletonGraphics::exists());




More information about the Orxonox-commit mailing list