[Orxonox-commit 5747] r10407 - in code/branches/core7: src/libraries/core src/libraries/core/input src/libraries/core/singleton src/libraries/network src/libraries/util 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 test/core/singleton test/util

landauf at orxonox.net landauf at orxonox.net
Mon Apr 27 23:08:27 CEST 2015


Author: landauf
Date: 2015-04-27 23:08:26 +0200 (Mon, 27 Apr 2015)
New Revision: 10407

Added:
   code/branches/core7/src/libraries/core/singleton/
   code/branches/core7/src/libraries/core/singleton/CMakeLists.txt
   code/branches/core7/src/libraries/core/singleton/Scope.cc
   code/branches/core7/src/libraries/core/singleton/Scope.h
   code/branches/core7/src/libraries/core/singleton/ScopedSingletonManager.cc
   code/branches/core7/src/libraries/core/singleton/ScopedSingletonManager.h
   code/branches/core7/test/core/singleton/
   code/branches/core7/test/core/singleton/ScopeTest.cc
Removed:
   code/branches/core7/src/libraries/util/Scope.cc
   code/branches/core7/src/libraries/util/Scope.h
   code/branches/core7/src/libraries/util/ScopedSingletonManager.cc
   code/branches/core7/src/libraries/util/ScopedSingletonManager.h
   code/branches/core7/test/util/ScopeTest.cc
Modified:
   code/branches/core7/src/libraries/core/CMakeLists.txt
   code/branches/core7/src/libraries/core/Core.cc
   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/network/Client.cc
   code/branches/core7/src/libraries/network/LANDiscovery.cc
   code/branches/core7/src/libraries/network/MasterServer.cc
   code/branches/core7/src/libraries/util/CMakeLists.txt
   code/branches/core7/src/libraries/util/UtilPrereqs.h
   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/PawnManager.cc
   code/branches/core7/src/orxonox/PlayerManager.cc
   code/branches/core7/src/orxonox/ShipPartManager.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/CMakeLists.txt
   code/branches/core7/test/util/CMakeLists.txt
Log:
moved Scope and ScopedSingletonManager from util to core.
TODO: I had to disable two tests in ScopeTest.cc because now that it runs in the core library, there are too many singletons which get loaded in graphics scope (with too many dependencies). this should be fixed

Modified: code/branches/core7/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/core7/src/libraries/core/CMakeLists.txt	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/core/CMakeLists.txt	2015-04-27 21:08:26 UTC (rev 10407)
@@ -68,6 +68,7 @@
 ADD_SUBDIRECTORY(input)
 ADD_SUBDIRECTORY(module)
 ADD_SUBDIRECTORY(object)
+ADD_SUBDIRECTORY(singleton)
 
 #Add the icon (for the renderwindow)
 IF(WIN32)

Modified: code/branches/core7/src/libraries/core/Core.cc
===================================================================
--- code/branches/core7/src/libraries/core/Core.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/core/Core.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -55,8 +55,8 @@
 #include "util/Exception.h"
 #include "util/output/LogWriter.h"
 #include "util/output/OutputManager.h"
-#include "util/Scope.h"
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/Scope.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "util/SignalHandler.h"
 #include "PathConfig.h"
 #include "commandline/CommandLineIncludes.h"

Modified: code/branches/core7/src/libraries/core/CorePrereqs.h
===================================================================
--- code/branches/core7/src/libraries/core/CorePrereqs.h	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/core/CorePrereqs.h	2015-04-27 21:08:26 UTC (rev 10407)
@@ -76,6 +76,16 @@
 
 namespace orxonox
 {
+    namespace ScopeID
+    {
+        //!A list of available scopes for the Scope template.
+        enum Value
+        {
+            Root,
+            Graphics
+        };
+    }
+
     namespace XMLPort
     {
         enum Mode
@@ -185,6 +195,10 @@
     class OrxonoxInterface;
     class PathConfig;
     struct ResourceInfo;
+    template <ScopeID::Value>
+    class Scope;
+    template <class, ScopeID::Value>
+    class ScopedSingleton;
     class SettingsConfigFile;
     template <class T>
     class SmartPtr;

Modified: code/branches/core7/src/libraries/core/input/KeyBinderManager.cc
===================================================================
--- code/branches/core7/src/libraries/core/input/KeyBinderManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/core/input/KeyBinderManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -30,7 +30,7 @@
 
 #include "util/Output.h"
 #include "util/Exception.h"
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "core/config/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
 #include "core/LuaState.h"

Modified: code/branches/core7/src/libraries/core/input/KeyDetector.cc
===================================================================
--- code/branches/core7/src/libraries/core/input/KeyDetector.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/core/input/KeyDetector.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -28,8 +28,8 @@
 
 #include "KeyDetector.h"
 
-#include "util/ScopedSingletonManager.h"
 #include "core/CoreIncludes.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "core/command/ConsoleCommandIncludes.h"
 #include "Button.h"
 #include "InputManager.h"

Added: code/branches/core7/src/libraries/core/singleton/CMakeLists.txt
===================================================================
--- code/branches/core7/src/libraries/core/singleton/CMakeLists.txt	                        (rev 0)
+++ code/branches/core7/src/libraries/core/singleton/CMakeLists.txt	2015-04-27 21:08:26 UTC (rev 10407)
@@ -0,0 +1,4 @@
+ADD_SOURCE_FILES(CORE_SRC_FILES
+  Scope.cc
+  ScopedSingletonManager.cc
+)


Property changes on: code/branches/core7/src/libraries/core/singleton/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Copied: code/branches/core7/src/libraries/core/singleton/Scope.cc (from rev 10406, code/branches/core7/src/libraries/util/Scope.cc)
===================================================================
--- code/branches/core7/src/libraries/core/singleton/Scope.cc	                        (rev 0)
+++ code/branches/core7/src/libraries/core/singleton/Scope.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -0,0 +1,40 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Static linkage of the two maps in orxonox::ScopeManager.
+*/
+
+#include "Scope.h"
+
+namespace orxonox
+{
+    std::map<ScopeID::Value, int> ScopeManager::instanceCounts_s;
+    std::map<ScopeID::Value, std::set<ScopeListener*> > ScopeManager::listeners_s;
+}

Copied: code/branches/core7/src/libraries/core/singleton/Scope.h (from rev 10406, code/branches/core7/src/libraries/util/Scope.h)
===================================================================
--- code/branches/core7/src/libraries/core/singleton/Scope.h	                        (rev 0)
+++ code/branches/core7/src/libraries/core/singleton/Scope.h	2015-04-27 21:08:26 UTC (rev 10407)
@@ -0,0 +1,200 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ at file
+ at ingroup SingletonScope
+ at brief Declaration of the classes that are needed to use Scopes:
+orxonox::Scope, orxonox::ScopeListener, and orxonox::ScopeManager.
+
+ at anchor Scope
+
+A virtual scope can be represented by an instance of class orxonox::Scope. orxonox::Scope<@a scope> is a template
+an its template argument defines the name of the virtual scope. See orxonox::ScopeID for an enumeration of the
+available values for @a scope. The orxonox::Scope object for a given @a scope can be activated or deactivated.
+Instances of orxonox::ScopeListener can register for a given @a scope and will get a notification if the
+corresponding orxonox::Scope object changes its state.
+
+To avoid multiple instances of orxonox::Scope<@a scope> in different libraries, each instance of orxonox::Scope
+registers in orxonox::ScopeManager, where they are linked statically in the core library.
+
+Scopes are usually used to control the creation and destruction of Singletons.
+
+ at see orxonox::ScopedSingletonManager
+ at see orxonox::Singleton
+*/
+
+#ifndef __Core_Scope_H__
+#define __Core_Scope_H__
+
+#include "core/CorePrereqs.h"
+
+#include <cassert>
+#include <map>
+#include <set>
+#include <loki/ScopeGuard.h>
+
+#include "util/Output.h"
+
+namespace orxonox
+{
+    /**
+        @brief The ScopeManager stores the variables of the Scope templates in a statically linked context.
+
+        If all Scope objects are managed by this class, they are statically linked in the core library.
+        Without this, a new instance of Scope<T> for each T would be created in every library of Orxonox,
+        which is of course not the desired behavior.
+
+        @see See @ref Scope "this description" for details about the interrelationship of Scope, ScopeListener, and ScopeManager.
+    */
+    class _CoreExport ScopeManager
+    {
+        template <ScopeID::Value scope>
+        friend class Scope;
+        friend class ScopeListener;
+
+        private:
+            static std::map<ScopeID::Value, int> instanceCounts_s;                  //!< Counts the number of active instances (>0 means active) for a scope
+            static std::map<ScopeID::Value, std::set<ScopeListener*> > listeners_s; //!< Stores all listeners for a scope
+    };
+
+    /**
+        @brief ScopeListeners register themselves in the corresponding Scope and wait for notifications.
+        Notifications are sent if a Scope is activated or deactivated.
+
+        @see See @ref Scope "this description" for details about the interrelationship of Scope, ScopeListener, and ScopeManager.
+    */
+    class _CoreExport ScopeListener
+    {
+        template <ScopeID::Value scope>
+        friend class Scope;
+
+        protected:
+            //! Constructor: Registers the instance.
+            ScopeListener(ScopeID::Value scope) : scope_(scope), bActivated_(false)
+                { ScopeManager::listeners_s[this->scope_].insert(this); }
+            //! Destructor: Unregisters the instance.
+            virtual ~ScopeListener()
+                { ScopeManager::listeners_s[this->scope_].erase(this); }
+
+            //! Gets called if the scope is activated
+            virtual void activated() = 0;
+            //! Gets called if the scope is deactivated
+            virtual void deactivated() = 0;
+
+        private:
+            ScopeID::Value scope_; //!< Store the scope to unregister on destruction
+            bool bActivated_;
+    };
+
+    /**
+        @brief A scope for a given template argument is either active or not.
+
+        Objects inheriting from a ScopeListener are registered in a list (different for each scope).
+        If the scope gets activated or deactivated, all objects in this list are notified.
+
+        @see See @ref Scope "this description" for details about the interrelationship of Scope, ScopeListener, and ScopeManager.
+    */
+    template <ScopeID::Value scope>
+    class Scope
+    {
+        public:
+            //! Constructor: Increases the instance counter and activates the scope if the count went from 0 to 1. Counts >1 don't change anything.
+            Scope()
+            {
+                orxout(internal_status) << "creating scope... (" << scope << ")" << endl;
+
+                try
+                {
+                    ScopeManager::instanceCounts_s[scope]++;
+                    assert(ScopeManager::instanceCounts_s[scope] > 0);
+                    if (ScopeManager::instanceCounts_s[scope] == 1)
+                    {
+                        Loki::ScopeGuard deactivator = Loki::MakeObjGuard(*this, &Scope::deactivateListeners);
+                        for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); )
+                        {
+                            (*it)->activated();
+                            (*(it++))->bActivated_ = true;
+                        }
+                        deactivator.Dismiss();
+                    }
+                }
+                catch (...)
+                {
+                    ScopeManager::instanceCounts_s[scope]--;
+                    throw;
+                }
+
+                orxout(internal_status) << "created scope (" << scope << ")" << endl;
+            }
+
+            //! Destructor: Decreases the instance counter and deactivates the scope if the count went from 1 to 0. Counts >0 don't change anything.
+            ~Scope()
+            {
+                orxout(internal_status) << "destroying scope... (" << scope << ")" << endl;
+
+                ScopeManager::instanceCounts_s[scope]--;
+
+                // This shouldn't happen but just to be sure: check if the count is positive
+                assert(ScopeManager::instanceCounts_s[scope] >= 0);
+                if (ScopeManager::instanceCounts_s[scope] < 0)
+                    ScopeManager::instanceCounts_s[scope] = 0;
+
+                if (ScopeManager::instanceCounts_s[scope] == 0)
+                    this->deactivateListeners();
+
+                orxout(internal_status) << "destroyed scope (" << scope << ")" << endl;
+            }
+
+            //! Deactivates the listeners of this scope in case the scope is destroyed or the construction fails.
+            void deactivateListeners()
+            {
+                for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); )
+                {
+                    if ((*it)->bActivated_)
+                    {
+                        try
+                            { (*it)->deactivated(); }
+                        catch (...)
+                            { orxout(internal_warning) << "ScopeListener::deactivated() failed! This MUST NOT happen, fix it!" << endl; }
+                        (*(it++))->bActivated_ = false;
+                    }
+                    else
+                        ++it;
+                }
+            }
+
+            //! Returns true if the scope is active.
+            static bool isActive()
+            {
+                return (ScopeManager::instanceCounts_s[scope] > 0);
+            }
+    };
+}
+
+#endif /* __Core_Scope_H__ */

Copied: code/branches/core7/src/libraries/core/singleton/ScopedSingletonManager.cc (from rev 10406, code/branches/core7/src/libraries/util/ScopedSingletonManager.cc)
===================================================================
--- code/branches/core7/src/libraries/core/singleton/ScopedSingletonManager.cc	                        (rev 0)
+++ code/branches/core7/src/libraries/core/singleton/ScopedSingletonManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -0,0 +1,54 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Static linkage of the ScopedSingletonManager maps.
+*/
+
+#include "ScopedSingletonManager.h"
+
+namespace orxonox
+{
+    /*static*/ std::map<std::string, ScopedSingletonManager*>& ScopedSingletonManager::getManagers()
+    {
+        static std::map<std::string, ScopedSingletonManager*> managers;
+        return managers;
+    }
+    /*static*/ ScopedSingletonManager::ManagerMultiMap& ScopedSingletonManager::getManagersByScope()
+    {
+        static ManagerMultiMap managers;
+        return managers;
+    }
+
+    /*static*/ void ScopedSingletonManager::addManager(ScopedSingletonManager* manager)
+    {
+        getManagers()[manager->className_] = manager;
+        getManagersByScope().insert(std::make_pair(manager->scope_, manager));
+    }
+}

Copied: code/branches/core7/src/libraries/core/singleton/ScopedSingletonManager.h (from rev 10406, code/branches/core7/src/libraries/util/ScopedSingletonManager.h)
===================================================================
--- code/branches/core7/src/libraries/core/singleton/ScopedSingletonManager.h	                        (rev 0)
+++ code/branches/core7/src/libraries/core/singleton/ScopedSingletonManager.h	2015-04-27 21:08:26 UTC (rev 10407)
@@ -0,0 +1,282 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @ingroup SingletonScope
+    @brief Definition of orxonox::ScopedSingletonManager, orxonox::ClassScopedSingletonManager, and the ManageScopedSingleton macro.
+
+    ScopedSingletonManager is used to create and destroy Singletons that belong to
+    a given Scope. For each one of these singletons, the macro ManageScopedSingleton()
+    has to be called to register the singleton with orxonox::ScopedSingletonManager.
+
+    See @ref SingletonExample "this code" for an example.
+
+    @see orxonox::Singleton
+    @see orxonox::Scope
+*/
+
+#ifndef __ScopedSingletonManager_H__
+#define __ScopedSingletonManager_H__
+
+#include "core/CorePrereqs.h"
+
+#include <cassert>
+#include <map>
+#include "util/Exception.h"
+#include "util/Singleton.h"
+#include "Scope.h"
+
+/**
+    @brief Registers an orxonox::Singleton with orxonox::ScopedSingletonManager.
+    @param className The name of the singleton class
+    @param scope The scope in which the singleton should exist
+    @param allowedToFail If true, the singleton is allowed to fail and thus a try-catch block is used when creating the singleton.
+
+    If this macro is called for a singleton, it is registered with ScopedSingletonManager
+    and will thus be created if its scope becomes active and destroyed if is deactivated.
+*/
+#define ManageScopedSingleton(className, scope, allowedToFail) \
+    className* className::singletonPtr_s = NULL; \
+    static ClassScopedSingletonManager<className, scope, allowedToFail> className##ScopedSingletonManager(#className)
+
+namespace orxonox
+{
+    class Destroyable;
+
+    /**
+        @brief Base class of ClassScopedSingletonManager, implements some static functions
+        used to dispatch calls to preUpdate and postUpdate to all instances of this class.
+        It also keeps track of all existing ScopedSingletonManagers and stores them in a
+        map, sorted by the scope they belong to.
+    */
+    class _CoreExport ScopedSingletonManager
+    {
+        public:
+            /// Constructor: Initializes all the values
+            ScopedSingletonManager(const std::string& className, ScopeID::Value scope)
+                : className_(className)
+                , scope_(scope)
+            { }
+            virtual ~ScopedSingletonManager() { }
+
+            /// Adds a new instance of ScopedSingletonManager to the map.
+            static void addManager(ScopedSingletonManager* manager);
+
+            /// Calls preUpdate in all instances of ScopedSingletonManager that are registered in the map.
+            template<ScopeID::Value scope>
+            static void preUpdate(const Clock& time)
+            {
+                assert(Scope<scope>::isActive());
+                for (ManagerMultiMap::iterator it = getManagersByScope().lower_bound(scope); it != getManagersByScope().upper_bound(scope); ++it)
+                    it->second->preUpdate(time);
+            }
+            virtual void preUpdate(const Clock& time) = 0;
+
+            /// Calls postUpdate in all instances of ScopedSingletonManager that are registered in the map.
+            template<ScopeID::Value scope>
+            static void postUpdate(const Clock& time)
+            {
+                assert(Scope<scope>::isActive());
+                for (ManagerMultiMap::iterator it = getManagersByScope().lower_bound(scope); it != getManagersByScope().upper_bound(scope); ++it)
+                    it->second->postUpdate(time);
+            }
+            virtual void postUpdate(const Clock& time) = 0;
+
+            static std::map<std::string, ScopedSingletonManager*>& getManagers();
+            typedef std::multimap<ScopeID::Value, ScopedSingletonManager*> ManagerMultiMap;
+            static ManagerMultiMap& getManagersByScope();
+
+        protected:
+            const std::string className_;   ///< The name of the scoped singleton class that is managed by this object
+            const ScopeID::Value scope_;    ///< The scope of the singleton that is managed by this object
+    };
+
+    /**
+        @anchor ClassScopedSingletonManager
+
+        @brief Manages a scoped singleton for a given scope.
+        @param T The managed singleton class
+        @param scope The scope in which the singleton @a T should be active
+        @param allowedToFail If true, a specialization of this template is used, that uses try-catch blocks to handle possible failures.
+
+        This class inherits from ScopeListener for the given scope and thus its functions
+        activated() and deactivated() are called whenever the Scope changes its state.
+
+        If the Scope is activated, a new instance of @a T (which must be a singleton) is created.
+        If the Scope is deactivated, the singleton is destroyed.
+
+        @see Singleton
+    */
+    template <class T, ScopeID::Value scope, bool allowedToFail>
+    class ClassScopedSingletonManager : public ScopedSingletonManager, public ScopeListener
+    {
+    public:
+        //! Constructor: Initializes the singleton pointer and passes the scope to ScopedSingletonManager and ScopeListener
+        ClassScopedSingletonManager(const std::string& className)
+            : ScopedSingletonManager(className, scope)
+            , ScopeListener(scope)
+            , singletonPtr_(NULL)
+        {
+            ScopedSingletonManager::addManager(this);
+        }
+
+        ~ClassScopedSingletonManager()
+        {
+        }
+
+        //! Called if the Scope of the Singleton gets active (creates the instance)
+        void activated()
+        {
+            assert(singletonPtr_ == NULL);
+            singletonPtr_ = new T();
+        }
+
+        //! Called if the Scope of this Singleton gets deactivated (destroys the instance)
+        void deactivated()
+        {
+            assert(singletonPtr_ != NULL);
+            this->destroy(singletonPtr_);
+            singletonPtr_ = NULL;
+        }
+
+        //! Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy()
+        void destroy(Destroyable*)
+        {
+            singletonPtr_->destroy();
+        }
+        //! Destroys the singleton instance - overloaded for all other pointers, calls delete
+        void destroy(void*)
+        {
+            delete singletonPtr_;
+        }
+
+        //! Called every frame by the ScopedSingletonManager
+        void preUpdate(const Clock& time)
+        {
+            assert(Scope<scope>::isActive());
+            // assuming T inherits Singleton<T>
+            singletonPtr_->preUpdateSingleton(time);
+        }
+
+        //! Called every frame by the ScopedSingletonManager
+        void postUpdate(const Clock& time)
+        {
+            assert(Scope<scope>::isActive());
+            // assuming T inherits Singleton<T>
+            singletonPtr_->postUpdateSingleton(time);
+        }
+
+    private:
+        T* singletonPtr_;   ///< Unique instance of the singleton class @a T
+    };
+
+    /**
+        @brief This class partially spezializes ClassScopedSingletonManager for classes @a T that are allowed to fail.
+        @param T The managed singleton class
+        @param scope The scope in which the singleton @a T should be active
+
+        Because @a T could fail when being created, this partial spezialization of ClassScopedSingletonManager
+        uses a try-catch block to handle exceptions.
+
+        See @ref ClassScopedSingletonManager for a full documentation of the basis template.
+    */
+    template <class T, ScopeID::Value scope>
+    class ClassScopedSingletonManager<T, scope, true> : public ScopedSingletonManager, public ScopeListener
+    {
+    public:
+        //! Constructor: Initializes the singleton pointer and passes the scope to ScopedSingletonManager and ScopeListener
+        ClassScopedSingletonManager(const std::string& className)
+            : ScopedSingletonManager(className, scope)
+            , ScopeListener(scope)
+            , singletonPtr_(NULL)
+        {
+            ScopedSingletonManager::addManager(this);
+        }
+
+        ~ClassScopedSingletonManager()
+        {
+        }
+
+        //! Called if the Scope of the Singleton gets active (creates the instance)
+        void activated()
+        {
+            assert(singletonPtr_ == NULL);
+            try
+                { singletonPtr_ = new T(); }
+            catch (const InitialisationAbortedException& ex)
+                { orxout(internal_error) << ex.getDescription() << endl; }
+            catch (...)
+                { orxout(internal_error) << "Singleton creation failed: " << Exception::handleMessage() << endl; }
+        }
+
+        //! Called if the Scope of this Singleton gets deactivated (destroys the instance)
+        void deactivated()
+        {
+            if (singletonPtr_ != NULL)
+            {
+                this->destroy(singletonPtr_);
+                singletonPtr_ = NULL;
+            }
+        }
+
+        //! Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy()
+        void destroy(Destroyable*)
+        {
+            singletonPtr_->destroy();
+        }
+        //! Destroys the singleton instance - overloaded for void*, calls delete
+        void destroy(void*)
+        {
+            delete singletonPtr_;
+        }
+
+        //! Called every frame by the ScopedSingletonManager
+        void preUpdate(const Clock& time)
+        {
+            assert(Scope<scope>::isActive());
+            // assuming T inherits Singleton<T>
+            if (singletonPtr_ != NULL)
+                singletonPtr_->preUpdateSingleton(time);
+        }
+
+        //! Called every frame by the ScopedSingletonManager
+        void postUpdate(const Clock& time)
+        {
+            assert(Scope<scope>::isActive());
+            // assuming T inherits Singleton<T>
+            if (singletonPtr_ != NULL)
+                singletonPtr_->postUpdateSingleton(time);
+        }
+
+    private:
+        T* singletonPtr_;   ///< Unique instance of the singleton class @a T
+    };
+}
+
+#endif /* __ScopedSingletonManager_H__ */

Modified: code/branches/core7/src/libraries/network/Client.cc
===================================================================
--- code/branches/core7/src/libraries/network/Client.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/network/Client.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -44,7 +44,6 @@
 
 #include "util/Clock.h"
 #include "util/Output.h"
-#include "util/ScopedSingletonManager.h"
 #include "synchronisable/Synchronisable.h"
 #include "packet/Chat.h"
 #include "packet/Gamestate.h"
@@ -52,6 +51,7 @@
 #include "core/CoreIncludes.h"
 #include "core/Game.h"
 #include "core/commandline/CommandLineParser.h"
+#include "core/singleton/ScopedSingletonManager.h"
 
 namespace orxonox
 {

Modified: code/branches/core7/src/libraries/network/LANDiscovery.cc
===================================================================
--- code/branches/core7/src/libraries/network/LANDiscovery.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/network/LANDiscovery.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -31,8 +31,8 @@
 #include <enet/enet.h>
 #include <cstring>
 
-#include "util/ScopedSingletonManager.h"
 #include "core/CoreIncludes.h"
+#include "core/singleton/ScopedSingletonManager.h"
 
 
 namespace orxonox

Modified: code/branches/core7/src/libraries/network/MasterServer.cc
===================================================================
--- code/branches/core7/src/libraries/network/MasterServer.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/network/MasterServer.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -27,10 +27,10 @@
  */
 
 #include "MasterServer.h"
-#include "util/ScopedSingletonManager.h"
 #include "core/command/ConsoleCommandIncludes.h"
 #include "core/CoreIncludes.h"
 #include "core/CorePrereqs.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "util/Output.h"
 
 namespace orxonox 

Modified: code/branches/core7/src/libraries/util/CMakeLists.txt
===================================================================
--- code/branches/core7/src/libraries/util/CMakeLists.txt	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/util/CMakeLists.txt	2015-04-27 21:08:26 UTC (rev 10407)
@@ -25,8 +25,6 @@
   Convert.cc
   CRC32.cc
   ExprParser.cc
-  Scope.cc
-  ScopedSingletonManager.cc
   SharedPtr.cc
   Sleep.cc
   SmallObjectAllocator.cc

Deleted: code/branches/core7/src/libraries/util/Scope.cc
===================================================================
--- code/branches/core7/src/libraries/util/Scope.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/util/Scope.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -1,40 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file
-    @brief Static linkage of the two maps in orxonox::ScopeManager.
-*/
-
-#include "Scope.h"
-
-namespace orxonox
-{
-    std::map<ScopeID::Value, int> ScopeManager::instanceCounts_s;
-    std::map<ScopeID::Value, std::set<ScopeListener*> > ScopeManager::listeners_s;
-}

Deleted: code/branches/core7/src/libraries/util/Scope.h
===================================================================
--- code/branches/core7/src/libraries/util/Scope.h	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/util/Scope.h	2015-04-27 21:08:26 UTC (rev 10407)
@@ -1,200 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-/**
- at file
- at ingroup SingletonScope
- at brief Declaration of the classes that are needed to use Scopes:
-orxonox::Scope, orxonox::ScopeListener, and orxonox::ScopeManager.
-
- at anchor Scope
-
-A virtual scope can be represented by an instance of class orxonox::Scope. orxonox::Scope<@a scope> is a template
-an its template argument defines the name of the virtual scope. See orxonox::ScopeID for an enumeration of the
-available values for @a scope. The orxonox::Scope object for a given @a scope can be activated or deactivated.
-Instances of orxonox::ScopeListener can register for a given @a scope and will get a notification if the
-corresponding orxonox::Scope object changes its state.
-
-To avoid multiple instances of orxonox::Scope<@a scope> in different libraries, each instance of orxonox::Scope
-registers in orxonox::ScopeManager, where they are linked statically in the util library.
-
-Scopes are usually used to control the creation and destruction of Singletons.
-
- at see orxonox::ScopedSingletonManager
- at see orxonox::Singleton
-*/
-
-#ifndef __Util_Scope_H__
-#define __Util_Scope_H__
-
-#include "UtilPrereqs.h"
-
-#include <cassert>
-#include <map>
-#include <set>
-#include <loki/ScopeGuard.h>
-
-#include "Output.h"
-
-namespace orxonox
-{
-    /**
-        @brief The ScopeManager stores the variables of the Scope templates in a statically linked context.
-
-        If all Scope objects are managed by this class, they are statically linked in the util library.
-        Without this, a new instance of Scope<T> for each T would be created in every library of Orxonox,
-        which is of course not the desired behavior.
-
-        @see See @ref Scope "this description" for details about the interrelationship of Scope, ScopeListener, and ScopeManager.
-    */
-    class _UtilExport ScopeManager
-    {
-        template <ScopeID::Value scope>
-        friend class Scope;
-        friend class ScopeListener;
-
-        private:
-            static std::map<ScopeID::Value, int> instanceCounts_s;                  //!< Counts the number of active instances (>0 means active) for a scope
-            static std::map<ScopeID::Value, std::set<ScopeListener*> > listeners_s; //!< Stores all listeners for a scope
-    };
-
-    /**
-        @brief ScopeListeners register themselves in the corresponding Scope and wait for notifications.
-        Notifications are sent if a Scope is activated or deactivated.
-
-        @see See @ref Scope "this description" for details about the interrelationship of Scope, ScopeListener, and ScopeManager.
-    */
-    class _UtilExport ScopeListener
-    {
-        template <ScopeID::Value scope>
-        friend class Scope;
-
-        protected:
-            //! Constructor: Registers the instance.
-            ScopeListener(ScopeID::Value scope) : scope_(scope), bActivated_(false)
-                { ScopeManager::listeners_s[this->scope_].insert(this); }
-            //! Destructor: Unregisters the instance.
-            virtual ~ScopeListener()
-                { ScopeManager::listeners_s[this->scope_].erase(this); }
-
-            //! Gets called if the scope is activated
-            virtual void activated() = 0;
-            //! Gets called if the scope is deactivated
-            virtual void deactivated() = 0;
-
-        private:
-            ScopeID::Value scope_; //!< Store the scope to unregister on destruction
-            bool bActivated_;
-    };
-
-    /**
-        @brief A scope for a given template argument is either active or not.
-
-        Objects inheriting from a ScopeListener are registered in a list (different for each scope).
-        If the scope gets activated or deactivated, all objects in this list are notified.
-
-        @see See @ref Scope "this description" for details about the interrelationship of Scope, ScopeListener, and ScopeManager.
-    */
-    template <ScopeID::Value scope>
-    class Scope
-    {
-        public:
-            //! Constructor: Increases the instance counter and activates the scope if the count went from 0 to 1. Counts >1 don't change anything.
-            Scope()
-            {
-                orxout(internal_status) << "creating scope... (" << scope << ")" << endl;
-
-                try
-                {
-                    ScopeManager::instanceCounts_s[scope]++;
-                    assert(ScopeManager::instanceCounts_s[scope] > 0);
-                    if (ScopeManager::instanceCounts_s[scope] == 1)
-                    {
-                        Loki::ScopeGuard deactivator = Loki::MakeObjGuard(*this, &Scope::deactivateListeners);
-                        for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); )
-                        {
-                            (*it)->activated();
-                            (*(it++))->bActivated_ = true;
-                        }
-                        deactivator.Dismiss();
-                    }
-                }
-                catch (...)
-                {
-                    ScopeManager::instanceCounts_s[scope]--;
-                    throw;
-                }
-
-                orxout(internal_status) << "created scope (" << scope << ")" << endl;
-            }
-
-            //! Destructor: Decreases the instance counter and deactivates the scope if the count went from 1 to 0. Counts >0 don't change anything.
-            ~Scope()
-            {
-                orxout(internal_status) << "destroying scope... (" << scope << ")" << endl;
-
-                ScopeManager::instanceCounts_s[scope]--;
-
-                // This shouldn't happen but just to be sure: check if the count is positive
-                assert(ScopeManager::instanceCounts_s[scope] >= 0);
-                if (ScopeManager::instanceCounts_s[scope] < 0)
-                    ScopeManager::instanceCounts_s[scope] = 0;
-
-                if (ScopeManager::instanceCounts_s[scope] == 0)
-                    this->deactivateListeners();
-
-                orxout(internal_status) << "destroyed scope (" << scope << ")" << endl;
-            }
-
-            //! Deactivates the listeners of this scope in case the scope is destroyed or the construction fails.
-            void deactivateListeners()
-            {
-                for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); )
-                {
-                    if ((*it)->bActivated_)
-                    {
-                        try
-                            { (*it)->deactivated(); }
-                        catch (...)
-                            { orxout(internal_warning) << "ScopeListener::deactivated() failed! This MUST NOT happen, fix it!" << endl; }
-                        (*(it++))->bActivated_ = false;
-                    }
-                    else
-                        ++it;
-                }
-            }
-
-            //! Returns true if the scope is active.
-            static bool isActive()
-            {
-                return (ScopeManager::instanceCounts_s[scope] > 0);
-            }
-    };
-}
-
-#endif /* __Util_Scope_H__ */

Deleted: code/branches/core7/src/libraries/util/ScopedSingletonManager.cc
===================================================================
--- code/branches/core7/src/libraries/util/ScopedSingletonManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/util/ScopedSingletonManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -1,54 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file
-    @brief Static linkage of the ScopedSingletonManager maps.
-*/
-
-#include "ScopedSingletonManager.h"
-
-namespace orxonox
-{
-    /*static*/ std::map<std::string, ScopedSingletonManager*>& ScopedSingletonManager::getManagers()
-    {
-        static std::map<std::string, ScopedSingletonManager*> managers;
-        return managers;
-    }
-    /*static*/ ScopedSingletonManager::ManagerMultiMap& ScopedSingletonManager::getManagersByScope()
-    {
-        static ManagerMultiMap managers;
-        return managers;
-    }
-
-    /*static*/ void ScopedSingletonManager::addManager(ScopedSingletonManager* manager)
-    {
-        getManagers()[manager->className_] = manager;
-        getManagersByScope().insert(std::make_pair(manager->scope_, manager));
-    }
-}

Deleted: code/branches/core7/src/libraries/util/ScopedSingletonManager.h
===================================================================
--- code/branches/core7/src/libraries/util/ScopedSingletonManager.h	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/util/ScopedSingletonManager.h	2015-04-27 21:08:26 UTC (rev 10407)
@@ -1,282 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Reto Grieder
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file
-    @ingroup SingletonScope
-    @brief Definition of orxonox::ScopedSingletonManager, orxonox::ClassScopedSingletonManager, and the ManageScopedSingleton macro.
-
-    ScopedSingletonManager is used to create and destroy Singletons that belong to
-    a given Scope. For each one of these singletons, the macro ManageScopedSingleton()
-    has to be called to register the singleton with orxonox::ScopedSingletonManager.
-
-    See @ref SingletonExample "this code" for an example.
-
-    @see orxonox::Singleton
-    @see orxonox::Scope
-*/
-
-#ifndef __ScopedSingletonManager_H__
-#define __ScopedSingletonManager_H__
-
-#include "UtilPrereqs.h"
-
-#include <cassert>
-#include <map>
-#include "util/Exception.h"
-#include "util/Scope.h"
-#include "util/Singleton.h"
-
-/**
-    @brief Registers an orxonox::Singleton with orxonox::ScopedSingletonManager.
-    @param className The name of the singleton class
-    @param scope The scope in which the singleton should exist
-    @param allowedToFail If true, the singleton is allowed to fail and thus a try-catch block is used when creating the singleton.
-
-    If this macro is called for a singleton, it is registered with ScopedSingletonManager
-    and will thus be created if its scope becomes active and destroyed if is deactivated.
-*/
-#define ManageScopedSingleton(className, scope, allowedToFail) \
-    className* className::singletonPtr_s = NULL; \
-    static ClassScopedSingletonManager<className, scope, allowedToFail> className##ScopedSingletonManager(#className)
-
-namespace orxonox
-{
-    class Destroyable;
-
-    /**
-        @brief Base class of ClassScopedSingletonManager, implements some static functions
-        used to dispatch calls to preUpdate and postUpdate to all instances of this class.
-        It also keeps track of all existing ScopedSingletonManagers and stores them in a
-        map, sorted by the scope they belong to.
-    */
-    class _UtilExport ScopedSingletonManager
-    {
-        public:
-            /// Constructor: Initializes all the values
-            ScopedSingletonManager(const std::string& className, ScopeID::Value scope)
-                : className_(className)
-                , scope_(scope)
-            { }
-            virtual ~ScopedSingletonManager() { }
-
-            /// Adds a new instance of ScopedSingletonManager to the map.
-            static void addManager(ScopedSingletonManager* manager);
-
-            /// Calls preUpdate in all instances of ScopedSingletonManager that are registered in the map.
-            template<ScopeID::Value scope>
-            static void preUpdate(const Clock& time)
-            {
-                assert(Scope<scope>::isActive());
-                for (ManagerMultiMap::iterator it = getManagersByScope().lower_bound(scope); it != getManagersByScope().upper_bound(scope); ++it)
-                    it->second->preUpdate(time);
-            }
-            virtual void preUpdate(const Clock& time) = 0;
-
-            /// Calls postUpdate in all instances of ScopedSingletonManager that are registered in the map.
-            template<ScopeID::Value scope>
-            static void postUpdate(const Clock& time)
-            {
-                assert(Scope<scope>::isActive());
-                for (ManagerMultiMap::iterator it = getManagersByScope().lower_bound(scope); it != getManagersByScope().upper_bound(scope); ++it)
-                    it->second->postUpdate(time);
-            }
-            virtual void postUpdate(const Clock& time) = 0;
-
-            static std::map<std::string, ScopedSingletonManager*>& getManagers();
-            typedef std::multimap<ScopeID::Value, ScopedSingletonManager*> ManagerMultiMap;
-            static ManagerMultiMap& getManagersByScope();
-
-        protected:
-            const std::string className_;   ///< The name of the scoped singleton class that is managed by this object
-            const ScopeID::Value scope_;    ///< The scope of the singleton that is managed by this object
-    };
-
-    /**
-        @anchor ClassScopedSingletonManager
-
-        @brief Manages a scoped singleton for a given scope.
-        @param T The managed singleton class
-        @param scope The scope in which the singleton @a T should be active
-        @param allowedToFail If true, a specialization of this template is used, that uses try-catch blocks to handle possible failures.
-
-        This class inherits from ScopeListener for the given scope and thus its functions
-        activated() and deactivated() are called whenever the Scope changes its state.
-
-        If the Scope is activated, a new instance of @a T (which must be a singleton) is created.
-        If the Scope is deactivated, the singleton is destroyed.
-
-        @see Singleton
-    */
-    template <class T, ScopeID::Value scope, bool allowedToFail>
-    class ClassScopedSingletonManager : public ScopedSingletonManager, public ScopeListener
-    {
-    public:
-        //! Constructor: Initializes the singleton pointer and passes the scope to ScopedSingletonManager and ScopeListener
-        ClassScopedSingletonManager(const std::string& className)
-            : ScopedSingletonManager(className, scope)
-            , ScopeListener(scope)
-            , singletonPtr_(NULL)
-        {
-            ScopedSingletonManager::addManager(this);
-        }
-
-        ~ClassScopedSingletonManager()
-        {
-        }
-
-        //! Called if the Scope of the Singleton gets active (creates the instance)
-        void activated()
-        {
-            assert(singletonPtr_ == NULL);
-            singletonPtr_ = new T();
-        }
-
-        //! Called if the Scope of this Singleton gets deactivated (destroys the instance)
-        void deactivated()
-        {
-            assert(singletonPtr_ != NULL);
-            this->destroy(singletonPtr_);
-            singletonPtr_ = NULL;
-        }
-
-        //! Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy()
-        void destroy(Destroyable*)
-        {
-            singletonPtr_->destroy();
-        }
-        //! Destroys the singleton instance - overloaded for all other pointers, calls delete
-        void destroy(void*)
-        {
-            delete singletonPtr_;
-        }
-
-        //! Called every frame by the ScopedSingletonManager
-        void preUpdate(const Clock& time)
-        {
-            assert(Scope<scope>::isActive());
-            // assuming T inherits Singleton<T>
-            singletonPtr_->preUpdateSingleton(time);
-        }
-
-        //! Called every frame by the ScopedSingletonManager
-        void postUpdate(const Clock& time)
-        {
-            assert(Scope<scope>::isActive());
-            // assuming T inherits Singleton<T>
-            singletonPtr_->postUpdateSingleton(time);
-        }
-
-    private:
-        T* singletonPtr_;   ///< Unique instance of the singleton class @a T
-    };
-
-    /**
-        @brief This class partially spezializes ClassScopedSingletonManager for classes @a T that are allowed to fail.
-        @param T The managed singleton class
-        @param scope The scope in which the singleton @a T should be active
-
-        Because @a T could fail when being created, this partial spezialization of ClassScopedSingletonManager
-        uses a try-catch block to handle exceptions.
-
-        See @ref ClassScopedSingletonManager for a full documentation of the basis template.
-    */
-    template <class T, ScopeID::Value scope>
-    class ClassScopedSingletonManager<T, scope, true> : public ScopedSingletonManager, public ScopeListener
-    {
-    public:
-        //! Constructor: Initializes the singleton pointer and passes the scope to ScopedSingletonManager and ScopeListener
-        ClassScopedSingletonManager(const std::string& className)
-            : ScopedSingletonManager(className, scope)
-            , ScopeListener(scope)
-            , singletonPtr_(NULL)
-        {
-            ScopedSingletonManager::addManager(this);
-        }
-
-        ~ClassScopedSingletonManager()
-        {
-        }
-
-        //! Called if the Scope of the Singleton gets active (creates the instance)
-        void activated()
-        {
-            assert(singletonPtr_ == NULL);
-            try
-                { singletonPtr_ = new T(); }
-            catch (const InitialisationAbortedException& ex)
-                { orxout(internal_error) << ex.getDescription() << endl; }
-            catch (...)
-                { orxout(internal_error) << "Singleton creation failed: " << Exception::handleMessage() << endl; }
-        }
-
-        //! Called if the Scope of this Singleton gets deactivated (destroys the instance)
-        void deactivated()
-        {
-            if (singletonPtr_ != NULL)
-            {
-                this->destroy(singletonPtr_);
-                singletonPtr_ = NULL;
-            }
-        }
-
-        //! Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy()
-        void destroy(Destroyable*)
-        {
-            singletonPtr_->destroy();
-        }
-        //! Destroys the singleton instance - overloaded for void*, calls delete
-        void destroy(void*)
-        {
-            delete singletonPtr_;
-        }
-
-        //! Called every frame by the ScopedSingletonManager
-        void preUpdate(const Clock& time)
-        {
-            assert(Scope<scope>::isActive());
-            // assuming T inherits Singleton<T>
-            if (singletonPtr_ != NULL)
-                singletonPtr_->preUpdateSingleton(time);
-        }
-
-        //! Called every frame by the ScopedSingletonManager
-        void postUpdate(const Clock& time)
-        {
-            assert(Scope<scope>::isActive());
-            // assuming T inherits Singleton<T>
-            if (singletonPtr_ != NULL)
-                singletonPtr_->postUpdateSingleton(time);
-        }
-
-    private:
-        T* singletonPtr_;   ///< Unique instance of the singleton class @a T
-    };
-}
-
-#endif /* __ScopedSingletonManager_H__ */

Modified: code/branches/core7/src/libraries/util/UtilPrereqs.h
===================================================================
--- code/branches/core7/src/libraries/util/UtilPrereqs.h	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/libraries/util/UtilPrereqs.h	2015-04-27 21:08:26 UTC (rev 10407)
@@ -61,23 +61,6 @@
 #endif
 
 //-----------------------------------------------------------------------
-// Enums
-//-----------------------------------------------------------------------
-
-namespace orxonox
-{
-    namespace ScopeID
-    {
-        //!A list of available scopes for the Scope template.
-        enum Value
-        {
-            Root,
-            Graphics
-        };
-    }
-}
-
-//-----------------------------------------------------------------------
 // Forward declarations
 //-----------------------------------------------------------------------
 
@@ -95,10 +78,6 @@
     class OutputListener;
     class OutputManager;
     class OutputStream;
-    template <ScopeID::Value>
-    class Scope;
-    template <class, ScopeID::Value>
-    class ScopedSingleton;
     class ScopeListener;
     template <class T>
     class SharedPtr;

Modified: code/branches/core7/src/modules/designtools/ScreenshotManager.cc
===================================================================
--- code/branches/core7/src/modules/designtools/ScreenshotManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/modules/designtools/ScreenshotManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -47,7 +47,7 @@
 #include "core/PathConfig.h"
 #include "core/Resource.h"
 #include "core/command/ConsoleCommandIncludes.h"
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "util/StringUtils.h"
 
 #include "CameraManager.h"

Modified: code/branches/core7/src/modules/designtools/SkyboxGenerator.cc
===================================================================
--- code/branches/core7/src/modules/designtools/SkyboxGenerator.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/modules/designtools/SkyboxGenerator.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -37,7 +37,6 @@
 #include <OgreRenderWindow.h>
 #include <OgreCamera.h>
 
-#include "util/ScopedSingletonManager.h"
 #include "core/CoreIncludes.h"
 #include "core/config/ConfigValueIncludes.h"
 #include "core/GraphicsManager.h"
@@ -45,6 +44,7 @@
 #include "core/Resource.h"
 #include "core/command/ConsoleCommandIncludes.h"
 #include "core/command/CommandExecutor.h"
+#include "core/singleton/ScopedSingletonManager.h"
 
 #include "controllers/HumanController.h"
 #include "graphics/Camera.h"

Modified: code/branches/core7/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/branches/core7/src/modules/notifications/NotificationManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/modules/notifications/NotificationManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -36,7 +36,7 @@
 #include "core/command/ConsoleCommand.h"
 #include "core/CoreIncludes.h"
 #include "core/LuaState.h"
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/ScopedSingletonManager.h"
 
 #include "interfaces/NotificationListener.h"
 

Modified: code/branches/core7/src/modules/pickup/PickupManager.cc
===================================================================
--- code/branches/core7/src/modules/pickup/PickupManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/modules/pickup/PickupManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -37,9 +37,9 @@
 #include "core/LuaState.h"
 #include "core/GUIManager.h"
 #include "core/class/Identifier.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "network/Host.h"
 #include "network/NetworkFunction.h"
-#include "util/ScopedSingletonManager.h"
 
 #include "infos/PlayerInfo.h"
 #include "interfaces/PickupCarrier.h"

Modified: code/branches/core7/src/modules/questsystem/QuestManager.cc
===================================================================
--- code/branches/core7/src/modules/questsystem/QuestManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/modules/questsystem/QuestManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -35,7 +35,7 @@
 
 #include "util/Exception.h"
 #include "util/OrxAssert.h"
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "core/command/ConsoleCommand.h"
 #include "core/GUIManager.h"
 #include "core/LuaState.h"

Modified: code/branches/core7/src/orxonox/CameraManager.cc
===================================================================
--- code/branches/core7/src/orxonox/CameraManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/CameraManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -34,10 +34,10 @@
 #include <OgreViewport.h>
 #include <OgreCompositorManager.h>
 
-#include "util/ScopedSingletonManager.h"
 #include "core/GameMode.h"
 #include "core/GraphicsManager.h"
 #include "core/object/ObjectList.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "tools/Shader.h"
 #include "graphics/Camera.h"
 

Modified: code/branches/core7/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/core7/src/orxonox/LevelManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/LevelManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -35,7 +35,7 @@
 
 #include <map>
 
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "core/commandline/CommandLineIncludes.h"
 #include "core/config/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"

Modified: code/branches/core7/src/orxonox/MoodManager.cc
===================================================================
--- code/branches/core7/src/orxonox/MoodManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/MoodManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -28,7 +28,7 @@
 
 #include "MoodManager.h"
 
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "core/config/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
 #include "core/Resource.h"

Modified: code/branches/core7/src/orxonox/PawnManager.cc
===================================================================
--- code/branches/core7/src/orxonox/PawnManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/PawnManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -28,8 +28,8 @@
 
 #include "PawnManager.h"
 
-#include "util/ScopedSingletonManager.h"
 #include "core/CoreIncludes.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "worldentities/pawns/Pawn.h"
 
 namespace orxonox

Modified: code/branches/core7/src/orxonox/PlayerManager.cc
===================================================================
--- code/branches/core7/src/orxonox/PlayerManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/PlayerManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -30,7 +30,7 @@
 
 #include "core/CoreIncludes.h"
 #include "core/GameMode.h"
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/ScopedSingletonManager.h"
 
 #include "Level.h"
 #include "LevelManager.h"

Modified: code/branches/core7/src/orxonox/ShipPartManager.cc
===================================================================
--- code/branches/core7/src/orxonox/ShipPartManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/ShipPartManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -28,8 +28,8 @@
 
 #include "ShipPartManager.h"
 
-#include "util/ScopedSingletonManager.h"
 #include "core/CoreIncludes.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "items/ShipPart.h"
 
 namespace orxonox

Modified: code/branches/core7/src/orxonox/chat/ChatHistory.cc
===================================================================
--- code/branches/core7/src/orxonox/chat/ChatHistory.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/chat/ChatHistory.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -27,7 +27,7 @@
  */
 
 #include "ChatHistory.h"
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/ScopedSingletonManager.h"
 
 #ifndef CHATTEST
 namespace orxonox

Modified: code/branches/core7/src/orxonox/chat/ChatInputHandler.cc
===================================================================
--- code/branches/core7/src/orxonox/chat/ChatInputHandler.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/chat/ChatInputHandler.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -46,7 +46,7 @@
 #   include <elements/CEGUIListboxTextItem.h>
 #endif
 
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "core/CoreIncludes.h"
 #include "core/GUIManager.h"
 #include "core/command/ConsoleCommandIncludes.h"

Modified: code/branches/core7/src/orxonox/chat/ChatManager.cc
===================================================================
--- code/branches/core7/src/orxonox/chat/ChatManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/chat/ChatManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -29,8 +29,8 @@
 #include "ChatManager.h"
 #include "ChatListener.h"
 
-#include "util/ScopedSingletonManager.h"
 #include "core/CoreIncludes.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "core/command/ConsoleCommandIncludes.h"
 #include "network/Host.h"
 

Modified: code/branches/core7/src/orxonox/overlays/InGameConsole.cc
===================================================================
--- code/branches/core7/src/orxonox/overlays/InGameConsole.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/overlays/InGameConsole.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -44,12 +44,12 @@
 #include "util/Convert.h"
 #include "util/Math.h"
 #include "util/DisplayStringConversions.h"
-#include "util/ScopedSingletonManager.h"
 #include "util/output/MemoryWriter.h"
 #include "util/output/OutputManager.h"
 #include "core/CoreIncludes.h"
 #include "core/config/ConfigValueIncludes.h"
 #include "core/command/ConsoleCommandIncludes.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "core/GUIManager.h"
 #include "core/input/InputManager.h"
 #include "core/input/InputState.h"

Modified: code/branches/core7/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/core7/src/orxonox/sound/SoundManager.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/src/orxonox/sound/SoundManager.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -37,7 +37,7 @@
 #include "util/Exception.h"
 #include "util/Math.h"
 #include "util/Clock.h"
-#include "util/ScopedSingletonManager.h"
+#include "core/singleton/ScopedSingletonManager.h"
 #include "core/config/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
 #include "core/GameMode.h"

Modified: code/branches/core7/test/core/CMakeLists.txt
===================================================================
--- code/branches/core7/test/core/CMakeLists.txt	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/test/core/CMakeLists.txt	2015-04-27 21:08:26 UTC (rev 10407)
@@ -27,6 +27,7 @@
     object/ObjectListIteratorTest.cc
     object/SmartPtrTest.cc
     object/WeakPtrTest.cc
+    singleton/ScopeTest.cc
 )
 ADD_DEPENDENCIES(all_tests core_test)
 

Copied: code/branches/core7/test/core/singleton/ScopeTest.cc (from rev 10406, code/branches/core7/test/util/ScopeTest.cc)
===================================================================
--- code/branches/core7/test/core/singleton/ScopeTest.cc	                        (rev 0)
+++ code/branches/core7/test/core/singleton/ScopeTest.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -0,0 +1,84 @@
+#include <gtest/gtest.h>
+#include "core/singleton/ScopedSingletonManager.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class TestSingletonRoot : public Singleton<TestSingletonRoot>
+        {
+            friend class Singleton<TestSingletonRoot>;
+            static TestSingletonRoot* singletonPtr_s;
+        };
+        class TestSingletonGraphics : public Singleton<TestSingletonGraphics>
+        {
+            friend class Singleton<TestSingletonGraphics>;
+            static TestSingletonGraphics* singletonPtr_s;
+        };
+
+        ManageScopedSingleton(TestSingletonRoot, ScopeID::Root, false);
+        ManageScopedSingleton(TestSingletonGraphics, ScopeID::Graphics, false);
+    }
+
+    TEST(Scope, ScopesDoNotExist)
+    {
+        EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
+        EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
+    }
+
+    TEST(Scope, SingletonsDoNotExist)
+    {
+        EXPECT_FALSE(TestSingletonRoot::exists());
+        EXPECT_FALSE(TestSingletonGraphics::exists());
+    }
+
+    TEST(Scope, RootScope)
+    {
+        EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
+        {   // create root scope
+            Scope<ScopeID::Root> scope;
+            EXPECT_TRUE(Scope<ScopeID::Root>::isActive());
+        }   // destroy root scope
+        EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
+    }
+
+    TEST(DISABLED_Scope, RootAndGraphicsScope)
+    {
+        EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
+        {   // create root scope
+            Scope<ScopeID::Root> scope;
+            EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
+            {   // create graphics scope
+                Scope<ScopeID::Graphics> scope;
+                EXPECT_TRUE(Scope<ScopeID::Graphics>::isActive());
+            }   // destroy graphics scope
+            EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
+        }   // destroy root scope
+        EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
+    }
+
+    TEST(Scope, RootSingleton)
+    {
+        EXPECT_FALSE(TestSingletonRoot::exists());
+        {   // create root scope
+            Scope<ScopeID::Root> scope;
+            EXPECT_TRUE(TestSingletonRoot::exists());
+        }   // destroy root scope
+        EXPECT_FALSE(TestSingletonRoot::exists());
+    }
+
+    TEST(DISABLED_Scope, RootAndGraphicsSingleton)
+    {
+        EXPECT_FALSE(TestSingletonGraphics::exists());
+        {   // create root scope
+            Scope<ScopeID::Root> scope;
+            EXPECT_FALSE(TestSingletonGraphics::exists());
+            {   // create graphics scope
+                Scope<ScopeID::Graphics> scope;
+                EXPECT_TRUE(TestSingletonGraphics::exists());
+            }   // destroy graphics scope
+            EXPECT_FALSE(TestSingletonGraphics::exists());
+        }   // destroy root scope
+        EXPECT_FALSE(TestSingletonGraphics::exists());
+    }
+}

Modified: code/branches/core7/test/util/CMakeLists.txt
===================================================================
--- code/branches/core7/test/util/CMakeLists.txt	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/test/util/CMakeLists.txt	2015-04-27 21:08:26 UTC (rev 10407)
@@ -12,7 +12,6 @@
     mboolTest.cc
     MultiTypeTest.cc
     OutputTest.cc
-    ScopeTest.cc
     SharedPtrTest.cc
     SingletonTest.cc
     SmallObjectAllocatorTest.cc

Deleted: code/branches/core7/test/util/ScopeTest.cc
===================================================================
--- code/branches/core7/test/util/ScopeTest.cc	2015-04-26 20:16:26 UTC (rev 10406)
+++ code/branches/core7/test/util/ScopeTest.cc	2015-04-27 21:08:26 UTC (rev 10407)
@@ -1,84 +0,0 @@
-#include <gtest/gtest.h>
-#include "util/ScopedSingletonManager.h"
-
-namespace orxonox
-{
-    namespace
-    {
-        class TestSingletonRoot : public Singleton<TestSingletonRoot>
-        {
-            friend class Singleton<TestSingletonRoot>;
-            static TestSingletonRoot* singletonPtr_s;
-        };
-        class TestSingletonGraphics : public Singleton<TestSingletonGraphics>
-        {
-            friend class Singleton<TestSingletonGraphics>;
-            static TestSingletonGraphics* singletonPtr_s;
-        };
-
-        ManageScopedSingleton(TestSingletonRoot, ScopeID::Root, false);
-        ManageScopedSingleton(TestSingletonGraphics, ScopeID::Graphics, false);
-    }
-
-    TEST(Scope, ScopesDoNotExist)
-    {
-        EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
-        EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
-    }
-
-    TEST(Scope, SingletonsDoNotExist)
-    {
-        EXPECT_FALSE(TestSingletonRoot::exists());
-        EXPECT_FALSE(TestSingletonGraphics::exists());
-    }
-
-    TEST(Scope, RootScope)
-    {
-        EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
-        {   // create root scope
-            Scope<ScopeID::Root> scope;
-            EXPECT_TRUE(Scope<ScopeID::Root>::isActive());
-        }   // destroy root scope
-        EXPECT_FALSE(Scope<ScopeID::Root>::isActive());
-    }
-
-    TEST(Scope, RootAndGraphicsScope)
-    {
-        EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
-        {   // create root scope
-            Scope<ScopeID::Root> scope;
-            EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
-            {   // create graphics scope
-                Scope<ScopeID::Graphics> scope;
-                EXPECT_TRUE(Scope<ScopeID::Graphics>::isActive());
-            }   // destroy graphics scope
-            EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
-        }   // destroy root scope
-        EXPECT_FALSE(Scope<ScopeID::Graphics>::isActive());
-    }
-
-    TEST(Scope, RootSingleton)
-    {
-        EXPECT_FALSE(TestSingletonRoot::exists());
-        {   // create root scope
-            Scope<ScopeID::Root> scope;
-            EXPECT_TRUE(TestSingletonRoot::exists());
-        }   // destroy root scope
-        EXPECT_FALSE(TestSingletonRoot::exists());
-    }
-
-    TEST(Scope, RootAndGraphicsSingleton)
-    {
-        EXPECT_FALSE(TestSingletonGraphics::exists());
-        {   // create root scope
-            Scope<ScopeID::Root> scope;
-            EXPECT_FALSE(TestSingletonGraphics::exists());
-            {   // create graphics scope
-                Scope<ScopeID::Graphics> scope;
-                EXPECT_TRUE(TestSingletonGraphics::exists());
-            }   // destroy graphics scope
-            EXPECT_FALSE(TestSingletonGraphics::exists());
-        }   // destroy root scope
-        EXPECT_FALSE(TestSingletonGraphics::exists());
-    }
-}




More information about the Orxonox-commit mailing list