[Orxonox-commit 5896] r10555 - in code/branches/core7: src/libraries/core src/libraries/core/object src/libraries/network/synchronisable src/modules/overlays/hud src/modules/pickup src/modules/pickup/items src/modules/tetris src/orxonox src/orxonox/gametypes src/orxonox/interfaces src/orxonox/overlays src/orxonox/sound src/orxonox/worldentities test/core test/core/object

landauf at orxonox.net landauf at orxonox.net
Sat Aug 29 17:36:00 CEST 2015


Author: landauf
Date: 2015-08-29 17:35:59 +0200 (Sat, 29 Aug 2015)
New Revision: 10555

Added:
   code/branches/core7/src/libraries/core/object/StrongPtr.h
   code/branches/core7/test/core/object/StrongPtrTest.cc
Removed:
   code/branches/core7/src/libraries/core/object/SmartPtr.h
   code/branches/core7/test/core/object/SmartPtrTest.cc
Modified:
   code/branches/core7/src/libraries/core/BaseObject.h
   code/branches/core7/src/libraries/core/CorePrereqs.h
   code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.cc
   code/branches/core7/src/libraries/core/Namespace.cc
   code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc
   code/branches/core7/src/libraries/core/object/DestroyLaterManager.h
   code/branches/core7/src/libraries/core/object/Destroyable.cc
   code/branches/core7/src/libraries/core/object/Destroyable.h
   code/branches/core7/src/libraries/network/synchronisable/Serialise.h
   code/branches/core7/src/modules/overlays/hud/HUDHealthBar.h
   code/branches/core7/src/modules/pickup/PickupSpawner.cc
   code/branches/core7/src/modules/pickup/items/ShrinkPickup.cc
   code/branches/core7/src/modules/tetris/Tetris.cc
   code/branches/core7/src/modules/tetris/Tetris.h
   code/branches/core7/src/orxonox/Scene.cc
   code/branches/core7/src/orxonox/gametypes/Gametype.cc
   code/branches/core7/src/orxonox/interfaces/RadarViewable.h
   code/branches/core7/src/orxonox/overlays/OverlayGroup.cc
   code/branches/core7/src/orxonox/overlays/OverlayGroup.h
   code/branches/core7/src/orxonox/sound/AmbientSound.cc
   code/branches/core7/src/orxonox/sound/SoundBuffer.h
   code/branches/core7/src/orxonox/sound/SoundManager.cc
   code/branches/core7/src/orxonox/sound/SoundManager.h
   code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc
   code/branches/core7/src/orxonox/worldentities/ControllableEntity.h
   code/branches/core7/src/orxonox/worldentities/WorldEntity.cc
   code/branches/core7/test/core/CMakeLists.txt
Log:
renamed SmartPtr to StrongPtr (now we have weak and strong pointers)

Modified: code/branches/core7/src/libraries/core/BaseObject.h
===================================================================
--- code/branches/core7/src/libraries/core/BaseObject.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/libraries/core/BaseObject.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -50,7 +50,7 @@
 #include "util/mbool.h"
 #include "class/OrxonoxClass.h"
 #include "class/Super.h"
-#include "object/SmartPtr.h"
+#include "object/StrongPtr.h"
 
 namespace orxonox
 {
@@ -137,17 +137,17 @@
             inline const std::set<Template*>& getTemplates() const
                 { return this->templates_; }
 
-            inline void setNamespace(const SmartPtr<Namespace>& ns) { this->namespace_ = ns; }
-            inline const SmartPtr<Namespace>& getNamespace() const { return this->namespace_; }
+            inline void setNamespace(const StrongPtr<Namespace>& ns) { this->namespace_ = ns; }
+            inline const StrongPtr<Namespace>& getNamespace() const { return this->namespace_; }
 
             inline void setCreator(BaseObject* creator) { this->creator_ = creator; }
             inline BaseObject* getCreator() const { return this->creator_; }
 
-            inline void setScene(const SmartPtr<Scene>& scene, uint32_t sceneID) { this->scene_ = scene; this->sceneID_=sceneID; }
-            inline const SmartPtr<Scene>& getScene() const { return this->scene_; }
+            inline void setScene(const StrongPtr<Scene>& scene, uint32_t sceneID) { this->scene_ = scene; this->sceneID_=sceneID; }
+            inline const StrongPtr<Scene>& getScene() const { return this->scene_; }
             inline virtual uint32_t getSceneID() const { return this->sceneID_; }
 
-            inline void setGametype(const SmartPtr<Gametype>& gametype)
+            inline void setGametype(const StrongPtr<Gametype>& gametype)
             {
                 if (gametype != this->gametype_)
                 {
@@ -156,11 +156,11 @@
                     this->changedGametype();
                 }
             }
-            inline const SmartPtr<Gametype>& getGametype() const { return this->gametype_; }
+            inline const StrongPtr<Gametype>& getGametype() const { return this->gametype_; }
             inline Gametype* getOldGametype() const { return this->oldGametype_; }
             virtual void changedGametype() {}
 
-            inline void setLevel(const SmartPtr<Level>& level)
+            inline void setLevel(const StrongPtr<Level>& level)
             {
                 if (level != this->level_)
                 {
@@ -168,7 +168,7 @@
                     this->changedLevel();
                 }
             }
-            inline const SmartPtr<Level>& getLevel() const { return this->level_; }
+            inline const StrongPtr<Level>& getLevel() const { return this->level_; }
             virtual void changedLevel() {}
 
             void addEventSource(BaseObject* source, const std::string& state);
@@ -221,13 +221,13 @@
             Element*               lastLoadedXMLElement_;      //!< Non 0 if the TinyXML attributes have already been copied to our own lowercase map
             std::map<std::string, std::string> xmlAttributes_; //!< Lowercase XML attributes
             std::string            loaderIndentation_;         //!< Indentation of the debug output in the Loader
-            SmartPtr<Namespace>    namespace_;
+            StrongPtr<Namespace>   namespace_;
             BaseObject*            creator_;
-            SmartPtr<Scene>        scene_;
+            StrongPtr<Scene>       scene_;
             uint32_t               sceneID_;
-            SmartPtr<Gametype>     gametype_;
+            StrongPtr<Gametype>    gametype_;
             Gametype*              oldGametype_;
-            SmartPtr<Level>        level_;
+            StrongPtr<Level>       level_;
             std::set<Template*>    templates_;
 
             std::map<BaseObject*, std::string>  eventSources_;           //!< List of objects which send events to this object, mapped to the state which they affect

Modified: code/branches/core7/src/libraries/core/CorePrereqs.h
===================================================================
--- code/branches/core7/src/libraries/core/CorePrereqs.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/libraries/core/CorePrereqs.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -217,12 +217,12 @@
     class ScopeManager;
     class ScopedSingletonWrapper;
     class SettingsConfigFile;
-    template <class T>
-    class SmartPtr;
     class StaticallyInitializedInstance;
     class StaticInitializationHandler;
     class StaticInitializationManager;
     template <class T>
+    class StrongPtr;
+    template <class T>
     class SubclassIdentifier;
     class Template;
     class Thread;

Modified: code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.cc
===================================================================
--- code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -101,14 +101,14 @@
         for (std::set<StaticallyInitializedInstance*>::const_iterator it = instances.begin(); it != instances.end(); ++it)
             identifiers.insert(&static_cast<StaticallyInitializedIdentifier*>(*it)->getIdentifier());
 
-        // destroy objects. some objects may survive this at first because they still have smart pointers pointing at them. this is
-        // ok as long as those smart pointers are held by objects that are also about to be destroyed in the same loop. this means
-        // that objects within one module may reference each other by smart pointers. but it is not allowed that objects from another
-        // module (which is not unloaded) uses smart pointers to point at objects inside the unloaded module. this will lead to a crash.
+        // destroy objects. some objects may survive this at first because they still have strong pointers pointing at them. this is
+        // ok as long as those strong pointers are held by objects that are also about to be destroyed in the same loop. this means
+        // that objects within one module may reference each other by strong pointers. but it is not allowed that objects from another
+        // module (which is not unloaded) uses strong pointers to point at objects inside the unloaded module. this will lead to a crash.
         for (std::set<Identifier*>::iterator it = identifiers.begin(); it != identifiers.end(); ++it)
             (*it)->destroyObjects();
 
-        // check if all objects were really destroyed. this is not the case if an object is referenced by a smart pointer from another
+        // check if all objects were really destroyed. this is not the case if an object is referenced by a strong pointer from another
         // module (or if two objects inside this module reference each other). this will lead to a crash and must be fixed (e.g. by
         // changing object dependencies; or by changing the logic that allows modules to be unloaded).
         for (std::set<Identifier*>::iterator it = identifiers.begin(); it != identifiers.end(); ++it)

Modified: code/branches/core7/src/libraries/core/Namespace.cc
===================================================================
--- code/branches/core7/src/libraries/core/Namespace.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/libraries/core/Namespace.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -46,7 +46,7 @@
     {
         RegisterObject(Namespace);
 
-        this->setNamespace(SmartPtr<Namespace>(this, false));
+        this->setNamespace(StrongPtr<Namespace>(this, false));
     }
 
     Namespace::~Namespace()

Modified: code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc
===================================================================
--- code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -50,7 +50,7 @@
 
     void DestroyLaterManager::postUpdate(const Clock& time)
     {
-        // clearing the list will destroy all smartpointers and thus all retained instances (as long as there are no other smart pointers pointing to them).
+        // clearing the list will destroy all strong pointers and thus all retained instances (as long as there are no other strong pointers pointing to them).
         this->retainedInstances_.clear();
     }
 }

Modified: code/branches/core7/src/libraries/core/object/DestroyLaterManager.h
===================================================================
--- code/branches/core7/src/libraries/core/object/DestroyLaterManager.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/libraries/core/object/DestroyLaterManager.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -33,7 +33,7 @@
 
 #include "util/Singleton.h"
 #include "core/UpdateListener.h"
-#include "SmartPtr.h"
+#include "StrongPtr.h"
 
 namespace orxonox
 {
@@ -51,7 +51,7 @@
                 { this->retainedInstances_.push_back(instance); }
 
         private:
-            std::vector<SmartPtr<Destroyable> > retainedInstances_;
+            std::vector<StrongPtr<Destroyable> > retainedInstances_;
 
             static DestroyLaterManager* singletonPtr_s;
     };

Modified: code/branches/core7/src/libraries/core/object/Destroyable.cc
===================================================================
--- code/branches/core7/src/libraries/core/object/Destroyable.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/libraries/core/object/Destroyable.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -60,8 +60,8 @@
     }
 
     /**
-        @brief Deletes the object if no @ref orxonox::SmartPtr "smart pointers" point to this object. Otherwise schedules the object to be deleted as soon as possible.
-        Always call destroy() instead of using 'delete' directly, otherwise smart pointers won't work.
+        @brief Deletes the object if no @ref orxonox::StrongPtr "strong pointers" point to this object. Otherwise schedules the object to be deleted as soon as possible.
+        Always call destroy() instead of using 'delete' directly, otherwise strong pointers won't work.
     */
     void Destroyable::destroy()
     {
@@ -80,10 +80,10 @@
      */
     void Destroyable::destroyLater()
     {
-        // register in DestroyLaterManager - this ensures that a smartPtr points to this object and keeps it alive for a while
+        // register in DestroyLaterManager - this ensures that a strongPtr points to this object and keeps it alive for a while
         DestroyLaterManager::getInstance().retain(this);
 
-        // request destruction -> object will be deleted after all smartPtrs (including the one in DestroyLaterManager) were destroyed.
+        // request destruction -> object will be deleted after all strongPtrs (including the one in DestroyLaterManager) were destroyed.
         this->destroy();
     }
 }

Modified: code/branches/core7/src/libraries/core/object/Destroyable.h
===================================================================
--- code/branches/core7/src/libraries/core/object/Destroyable.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/libraries/core/object/Destroyable.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -29,7 +29,7 @@
 /**
     @file
     @ingroup Object
-    @brief Declaration of Destroyable, the base class of all objects which can be used with SmartPtr and WeakPtr.
+    @brief Declaration of Destroyable, the base class of all objects which can be used with StrongPtr and WeakPtr.
 */
 
 #ifndef _Destroyable_H__
@@ -42,12 +42,12 @@
 namespace orxonox
 {
     /**
-        @brief Classes must inherit from this class if they should be used with SmartPtr or WeakPtr.
+        @brief Classes must inherit from this class if they should be used with StrongPtr or WeakPtr.
     */
     class _CoreExport Destroyable
     {
         template <class T>
-        friend class SmartPtr;
+        friend class StrongPtr;
 
         friend class DestructionListener;
 
@@ -58,20 +58,20 @@
             void destroy();
             void destroyLater();
 
-            /// Returns the number of @ref orxonox::SmartPtr "smart pointers" that point to this object.
+            /// Returns the number of @ref orxonox::StrongPtr "strong pointers" that point to this object.
             inline unsigned int getReferenceCount() const
                 { return this->referenceCount_; }
 
         protected:
-            /// This virtual function is called if destroy() is called and no SmartPtr points to this object. Used in some cases to create a new SmartPtr to
+            /// This virtual function is called if destroy() is called and no StrongPtr points to this object. Used in some cases to create a new StrongPtr to
             /// prevent destruction. Don't call this function directly - use destroy() instead.
             virtual void preDestroy() {}
 
         private:
-            /// Increments the reference counter (for smart pointers).
+            /// Increments the reference counter (for strong pointers).
             inline void incrementReferenceCount()
                 { ++this->referenceCount_; }
-            /// Decrements the reference counter (for smart pointers).
+            /// Decrements the reference counter (for strong pointers).
             inline void decrementReferenceCount()
             {
                 --this->referenceCount_;
@@ -86,7 +86,7 @@
             inline void unregisterDestructionListener(DestructionListener* pointer)
                 { this->destructionListeners_.erase(pointer); }
 
-            int referenceCount_;                                    //!< Counts the references from smart pointers to this object
+            int referenceCount_;                                    //!< Counts the references from strong pointers to this object
             bool requestedDestruction_;                             //!< Becomes true after someone called delete on this object
             std::set<DestructionListener*> destructionListeners_;   //!< All destruction listeners (for example weak pointers which point to this object and like to get notified if it dies)
     };

Deleted: code/branches/core7/src/libraries/core/object/SmartPtr.h
===================================================================
--- code/branches/core7/src/libraries/core/object/SmartPtr.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/libraries/core/object/SmartPtr.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -1,304 +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:
- *      ...
- *
- */
-
-// Inspired by boost::intrusive_ptr by Peter Dimov
-
-/**
-    @defgroup SmartPtr SmartPtr<T> and WeakPtr<T>
-    @ingroup Object
-*/
-
-/**
-    @file
-    @ingroup Object SmartPtr
-    @brief Definition of SmartPtr<T>, wraps a pointer to an object and keeps it alive.
-
-    @anchor SmartPtrExample
-
-    orxonox::SmartPtr is an implementation of a smart pointer - it wraps a pointer to an
-    object  and keeps this object alive until no SmartPtr points to this object anymore.
-    In contrast to orxonox::SharedPtr, SmartPtr works only with classes that are derived
-    from orxonox::Destroyable, because it's an intrusive implementation, meaning the
-    reference counter is stored in the object itself.
-
-    It's possible to use normal pointers and smart pointers to an object simultaneously.
-    You don't have to use SmartPtr all the time, you can create a SmartPtr for an object
-    at any time and also convert it back to a normal pointer if you like. This is possible
-    because the reference counter is stored in the object itself and not in SmartPtr (in
-    contrast to SharedPtr).
-
-    @b Important: If you want to delete an object, you must not use @c delete @c object but
-    rather @c object->destroy(). This function will check if there are smart pointers
-    pointing to the object. If yes, the object will be kept alive until all smart pointes
-    are destroyed. If no, the object is deleted instantly.
-
-    If all smart pointers that point to an object are destroyed, but you never called
-    @c object->destroy() before, the object will not be deleted! All a SmartPtr will do
-    is to really just keep an object alive, but it will not delete it automatically
-    unless you tried to destroy it before.
-
-    Example:
-    @code
-    class MyClass                                           // class declaration
-    {
-        public:
-            void setObject(OtherClass* object)              // passes a normal pointer which will be stored in a SmartPtr
-                { this->object_ = object; }
-
-            OtherClass* getObject() const                   // converts the SmartPtr to a normal pointer and returns it
-                { return this->object_; }
-
-        private:
-            SmartPtr<OtherClass> object_;                   // a pointer to an instance of OtherClass is stored in a SmartPtr
-    };
-    @endcode
-    In this example we assume that OtherClass is a child of Destroyable. We don't care
-    about the inheritance of MyClass though.
-
-    Now we create an instance of MyClass and assign a pointer to an instance of OtherClass:
-    @code
-    MyClass* myclass = new MyClass();                       // create an instance of MyClass
-    OtherClass* object = new OtherClass();                  // create an instance of OtherClass
-    myclass->setObject(object);                             // the object is now stored in a SmartPtr inside myclass
-
-    object->destroy();                                      // we try to destroy object, but there's still a SmartPtr pointing at it.
-
-    # object still exists at this point (because a SmartPtr points at it)
-
-    delete myclass;                                         // now we delete myclass, which also destroys the SmartPtr
-
-    # object doesn't exist anymore (because the SmartPtr is now destroyed)
-    @endcode
-
-    Now we look at the same example, but we first delete myclass, then destroy object:
-    @code
-    MyClass* myclass = new MyClass();                       // create an instance of MyClass
-    OtherClass* object = new OtherClass();                  // create an instance of OtherClass
-    myclass->setObject(object);                             // the object is now stored in a SmartPtr inside myclass
-
-    delete myclass;                                         // we delete myclass, which also destroys the SmartPtr
-
-    # object still exists at this point (because destroy() was not called yet)
-
-    object->destroy();                                      // now we try to destroy object, which works instantly
-
-    # object doesn't exist anymore (because we just destroyed it)
-    @endcode
-
-    Note that in any case @c object->destroy() has to be called to delete the object.
-    However if a SmartPtr points at it, the destruction is delayed until all SmartPtr
-    are destroyed.
-*/
-
-#ifndef _SmartPtr_H__
-#define _SmartPtr_H__
-
-#include "core/CorePrereqs.h"
-
-#include <cassert>
-
-#include "core/object/Destroyable.h"
-#include "WeakPtr.h"
-
-namespace orxonox
-{
-    /**
-        @brief A smart pointer which wraps a pointer to an object and keeps this object alive as long as the smart pointer exists.
-
-        @see See @ref SmartPtrExample "this description" for more information and an example.
-    */
-    template <class T>
-    class SmartPtr
-    {
-        public:
-            /// Constructor: Initializes the smart pointer with a null pointer.
-            inline SmartPtr() : pointer_(0), base_(0)
-            {
-            }
-
-            /// Constructor: Initializes the smart pointer with a pointer to an object. @param pointer The pointer @param bAddRef If true, the reference counter is increased. Don't set this to false unless you know exactly what you're doing! (for example to avoid circular references if the @c this pointer of the possessing object is stored)
-            inline SmartPtr(T* pointer, bool bAddRef = true) : pointer_(pointer), base_(pointer)
-            {
-                if (this->base_ && bAddRef)
-                    this->base_->incrementReferenceCount();
-            }
-
-            /// Copy-constructor
-            inline SmartPtr(const SmartPtr& other) : pointer_(other.pointer_), base_(other.base_)
-            {
-                if (this->base_)
-                    this->base_->incrementReferenceCount();
-            }
-
-            /// Copy-constructor for smart pointers to objects of another class.
-            template <class O>
-            inline SmartPtr(const SmartPtr<O>& other) : pointer_(other.get()), base_(other.base_)
-            {
-                if (this->base_)
-                    this->base_->incrementReferenceCount();
-            }
-
-            /// Constructor: Initializes the smart pointer with the pointer that is stored in a WeakPtr.
-            template <class O>
-            inline SmartPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other.getBase())
-            {
-                if (this->base_)
-                    this->base_->incrementReferenceCount();
-            }
-
-            /// Destructor: Decrements the reference counter.
-            inline ~SmartPtr()
-            {
-                if (this->base_)
-                    this->base_->decrementReferenceCount();
-            }
-
-            /// Assigns a new pointer.
-            inline SmartPtr& operator=(T* pointer)
-            {
-                SmartPtr(pointer).swap(*this);
-                return *this;
-            }
-
-            /// Assigns the wrapped pointer of another SmartPtr.
-            inline SmartPtr& operator=(const SmartPtr& other)
-            {
-                SmartPtr(other).swap(*this);
-                return *this;
-            }
-
-            /// Assigns the wrapped pointer of a SmartPtr of another class
-            template <class O>
-            inline SmartPtr& operator=(const SmartPtr<O>& other)
-            {
-                SmartPtr(other).swap(*this);
-                return *this;
-            }
-
-            /// Assigns the wrapped pointer of a WeakPtr.
-            template <class O>
-            inline SmartPtr& operator=(const WeakPtr<O>& other)
-            {
-                SmartPtr(other).swap(*this);
-                return *this;
-            }
-
-            /// Returns the wrapped pointer as @c T*
-            inline T* get() const
-            {
-                return this->pointer_;
-            }
-
-            /// Returns the wrapped pointer as @c Destroyable*
-            inline Destroyable* getBase() const
-            {
-                return this->base_;
-            }
-
-            /// Implicitly converts the SmartPtr to a pointer of type @c T*
-            inline operator T*() const
-            {
-                return this->pointer_;
-            }
-
-            /// Overloaded operator, returns a pointer to the stored object.
-            inline T* operator->() const
-            {
-                assert(this->pointer_ != 0);
-                return this->pointer_;
-            }
-
-            /// Overloaded operator, returns a reference to the stored object.
-            inline T& operator*() const
-            {
-                assert(this->pointer_ != 0);
-                return *this->pointer_;
-            }
-
-            /// Returns true if the wrapped pointer is NULL.
-            inline bool operator!() const
-            {
-                return (this->pointer_ == 0);
-            }
-
-            /// Swaps the contents of two smart pointers.
-            inline void swap(SmartPtr& other)
-            {
-                {
-                    T* temp = this->pointer_;
-                    this->pointer_ = other.pointer_;
-                    other.pointer_ = temp;
-                }
-                {
-                    Destroyable* temp = this->base_;
-                    this->base_ = other.base_;
-                    other.base_ = temp;
-                }
-            }
-
-            /// Resets the smart pointer (equivalent to assigning a NULL pointer).
-            inline void reset()
-            {
-                SmartPtr().swap(*this);
-            }
-
-        private:
-            T* pointer_;            ///< The wrapped pointer to an object of type @a T
-            Destroyable* base_;    ///< The wrapped pointer, casted up to Destroyable (this is needed because with just a T* pointer, SmartPtr couln't be used with forward declarations)
-    };
-
-    /// Swaps the contents of two smart pointers.
-    template <class T>
-    void swap(SmartPtr<T>& a, SmartPtr<T>& b)
-    {
-        a.swap(b);
-    }
-
-    /// Uses a static_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new SmartPtr<T>.
-    template <class T, class U>
-    SmartPtr<T> static_pointer_cast(const SmartPtr<U>& p)
-    {
-        return static_cast<T*>(p.get());
-    }
-
-    /// Uses a const_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new SmartPtr<T>.
-    template <class T, class U>
-    SmartPtr<T> const_pointer_cast(const SmartPtr<U>& p)
-    {
-        return const_cast<T*>(p.get());
-    }
-
-    /// Uses a dynamic_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new SmartPtr<T>.
-    template <class T, class U>
-    SmartPtr<T> dynamic_pointer_cast(const SmartPtr<U>& p)
-    {
-        return orxonox_cast<T*>(p.get());
-    }
-}
-
-#endif /* _SmartPtr_H__ */

Copied: code/branches/core7/src/libraries/core/object/StrongPtr.h (from rev 10553, code/branches/core7/src/libraries/core/object/SmartPtr.h)
===================================================================
--- code/branches/core7/src/libraries/core/object/StrongPtr.h	                        (rev 0)
+++ code/branches/core7/src/libraries/core/object/StrongPtr.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -0,0 +1,304 @@
+/*
+ *   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:
+ *      ...
+ *
+ */
+
+// Inspired by boost::intrusive_ptr by Peter Dimov
+
+/**
+    @defgroup SmartPtr StrongPtr<T> and WeakPtr<T>
+    @ingroup Object
+*/
+
+/**
+    @file
+    @ingroup Object SmartPtr
+    @brief Definition of StrongPtr<T>, wraps a pointer to an object and keeps it alive.
+
+    @anchor StrongPtrExample
+
+    orxonox::StrongPtr is an implementation of a smart pointer - it wraps a pointer to an
+    object  and keeps this object alive until no StrongPtr points to this object anymore.
+    In contrast to orxonox::SharedPtr, StrongPtr works only with classes that are derived
+    from orxonox::Destroyable, because it's an intrusive implementation, meaning the
+    reference counter is stored in the object itself.
+
+    It's possible to use normal pointers and strong pointers to an object simultaneously.
+    You don't have to use StrongPtr all the time, you can create a StrongPtr for an object
+    at any time and also convert it back to a normal pointer if you like. This is possible
+    because the reference counter is stored in the object itself and not in StrongPtr (in
+    contrast to SharedPtr).
+
+    @b Important: If you want to delete an object, you must not use @c delete @c object but
+    rather @c object->destroy(). This function will check if there are strong pointers
+    pointing to the object. If yes, the object will be kept alive until all strong pointers
+    are destroyed. If no, the object is deleted instantly.
+
+    If all strong pointers that point to an object are destroyed, but you never called
+    @c object->destroy() before, the object will not be deleted! All a StrongPtr will do
+    is to really just keep an object alive, but it will not delete it automatically
+    unless you tried to destroy it before.
+
+    Example:
+    @code
+    class MyClass                                           // class declaration
+    {
+        public:
+            void setObject(OtherClass* object)              // passes a normal pointer which will be stored in a StrongPtr
+                { this->object_ = object; }
+
+            OtherClass* getObject() const                   // converts the StrongPtr to a normal pointer and returns it
+                { return this->object_; }
+
+        private:
+            StrongPtr<OtherClass> object_;                  // a pointer to an instance of OtherClass is stored in a StrongPtr
+    };
+    @endcode
+    In this example we assume that OtherClass is a child of Destroyable. We don't care
+    about the inheritance of MyClass though.
+
+    Now we create an instance of MyClass and assign a pointer to an instance of OtherClass:
+    @code
+    MyClass* myclass = new MyClass();                       // create an instance of MyClass
+    OtherClass* object = new OtherClass();                  // create an instance of OtherClass
+    myclass->setObject(object);                             // the object is now stored in a StrongPtr inside myclass
+
+    object->destroy();                                      // we try to destroy object, but there's still a StrongPtr pointing at it.
+
+    # object still exists at this point (because a StrongPtr points at it)
+
+    delete myclass;                                         // now we delete myclass, which also destroys the StrongPtr
+
+    # object doesn't exist anymore (because the StrongPtr is now destroyed)
+    @endcode
+
+    Now we look at the same example, but we first delete myclass, then destroy object:
+    @code
+    MyClass* myclass = new MyClass();                       // create an instance of MyClass
+    OtherClass* object = new OtherClass();                  // create an instance of OtherClass
+    myclass->setObject(object);                             // the object is now stored in a StrongPtr inside myclass
+
+    delete myclass;                                         // we delete myclass, which also destroys the StrongPtr
+
+    # object still exists at this point (because destroy() was not called yet)
+
+    object->destroy();                                      // now we try to destroy object, which works instantly
+
+    # object doesn't exist anymore (because we just destroyed it)
+    @endcode
+
+    Note that in any case @c object->destroy() has to be called to delete the object.
+    However if a StrongPtr points at it, the destruction is delayed until all StrongPtr
+    are destroyed.
+*/
+
+#ifndef _StrongPtr_H__
+#define _StrongPtr_H__
+
+#include "core/CorePrereqs.h"
+
+#include <cassert>
+
+#include "core/object/Destroyable.h"
+#include "WeakPtr.h"
+
+namespace orxonox
+{
+    /**
+        @brief A strong pointer which wraps a pointer to an object and keeps this object alive as long as the strong pointer exists.
+
+        @see See @ref StrongPtrExample "this description" for more information and an example.
+    */
+    template <class T>
+    class StrongPtr
+    {
+        public:
+            /// Constructor: Initializes the strong pointer with a null pointer.
+            inline StrongPtr() : pointer_(0), base_(0)
+            {
+            }
+
+            /// Constructor: Initializes the strong pointer with a pointer to an object. @param pointer The pointer @param bAddRef If true, the reference counter is increased. Don't set this to false unless you know exactly what you're doing! (for example to avoid circular references if the @c this pointer of the possessing object is stored)
+            inline StrongPtr(T* pointer, bool bAddRef = true) : pointer_(pointer), base_(pointer)
+            {
+                if (this->base_ && bAddRef)
+                    this->base_->incrementReferenceCount();
+            }
+
+            /// Copy-constructor
+            inline StrongPtr(const StrongPtr& other) : pointer_(other.pointer_), base_(other.base_)
+            {
+                if (this->base_)
+                    this->base_->incrementReferenceCount();
+            }
+
+            /// Copy-constructor for strong pointers to objects of another class.
+            template <class O>
+            inline StrongPtr(const StrongPtr<O>& other) : pointer_(other.get()), base_(other.base_)
+            {
+                if (this->base_)
+                    this->base_->incrementReferenceCount();
+            }
+
+            /// Constructor: Initializes the strong pointer with the pointer that is stored in a WeakPtr.
+            template <class O>
+            inline StrongPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other.getBase())
+            {
+                if (this->base_)
+                    this->base_->incrementReferenceCount();
+            }
+
+            /// Destructor: Decrements the reference counter.
+            inline ~StrongPtr()
+            {
+                if (this->base_)
+                    this->base_->decrementReferenceCount();
+            }
+
+            /// Assigns a new pointer.
+            inline StrongPtr& operator=(T* pointer)
+            {
+                StrongPtr(pointer).swap(*this);
+                return *this;
+            }
+
+            /// Assigns the wrapped pointer of another StrongPtr.
+            inline StrongPtr& operator=(const StrongPtr& other)
+            {
+                StrongPtr(other).swap(*this);
+                return *this;
+            }
+
+            /// Assigns the wrapped pointer of a StrongPtr of another class
+            template <class O>
+            inline StrongPtr& operator=(const StrongPtr<O>& other)
+            {
+                StrongPtr(other).swap(*this);
+                return *this;
+            }
+
+            /// Assigns the wrapped pointer of a WeakPtr.
+            template <class O>
+            inline StrongPtr& operator=(const WeakPtr<O>& other)
+            {
+                StrongPtr(other).swap(*this);
+                return *this;
+            }
+
+            /// Returns the wrapped pointer as @c T*
+            inline T* get() const
+            {
+                return this->pointer_;
+            }
+
+            /// Returns the wrapped pointer as @c Destroyable*
+            inline Destroyable* getBase() const
+            {
+                return this->base_;
+            }
+
+            /// Implicitly converts the StrongPtr to a pointer of type @c T*
+            inline operator T*() const
+            {
+                return this->pointer_;
+            }
+
+            /// Overloaded operator, returns a pointer to the stored object.
+            inline T* operator->() const
+            {
+                assert(this->pointer_ != 0);
+                return this->pointer_;
+            }
+
+            /// Overloaded operator, returns a reference to the stored object.
+            inline T& operator*() const
+            {
+                assert(this->pointer_ != 0);
+                return *this->pointer_;
+            }
+
+            /// Returns true if the wrapped pointer is NULL.
+            inline bool operator!() const
+            {
+                return (this->pointer_ == 0);
+            }
+
+            /// Swaps the contents of two strong pointers.
+            inline void swap(StrongPtr& other)
+            {
+                {
+                    T* temp = this->pointer_;
+                    this->pointer_ = other.pointer_;
+                    other.pointer_ = temp;
+                }
+                {
+                    Destroyable* temp = this->base_;
+                    this->base_ = other.base_;
+                    other.base_ = temp;
+                }
+            }
+
+            /// Resets the strong pointer (equivalent to assigning a NULL pointer).
+            inline void reset()
+            {
+                StrongPtr().swap(*this);
+            }
+
+        private:
+            T* pointer_;            ///< The wrapped pointer to an object of type @a T
+            Destroyable* base_;    ///< The wrapped pointer, casted up to Destroyable (this is needed because with just a T* pointer, StrongPtr couln't be used with forward declarations)
+    };
+
+    /// Swaps the contents of two strong pointers.
+    template <class T>
+    void swap(StrongPtr<T>& a, StrongPtr<T>& b)
+    {
+        a.swap(b);
+    }
+
+    /// Uses a static_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new StrongPtr<T>.
+    template <class T, class U>
+    StrongPtr<T> static_pointer_cast(const StrongPtr<U>& p)
+    {
+        return static_cast<T*>(p.get());
+    }
+
+    /// Uses a const_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new StrongPtr<T>.
+    template <class T, class U>
+    StrongPtr<T> const_pointer_cast(const StrongPtr<U>& p)
+    {
+        return const_cast<T*>(p.get());
+    }
+
+    /// Uses a dynamic_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new StrongPtr<T>.
+    template <class T, class U>
+    StrongPtr<T> dynamic_pointer_cast(const StrongPtr<U>& p)
+    {
+        return orxonox_cast<T*>(p.get());
+    }
+}
+
+#endif /* _StrongPtr_H__ */

Modified: code/branches/core7/src/libraries/network/synchronisable/Serialise.h
===================================================================
--- code/branches/core7/src/libraries/network/synchronisable/Serialise.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/libraries/network/synchronisable/Serialise.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -77,24 +77,24 @@
             return variable == variable->getSynchronisable(*(uint32_t*)(mem));
     }
 
-    // These functions implement loading / saving / etc. for SmartPtr<T>
+    // These functions implement loading / saving / etc. for StrongPtr<T>
 
     /** @brief returns the size of the objectID needed to synchronise the pointer */
-    template <class T> inline uint32_t returnSize( const SmartPtr<T>& )
+    template <class T> inline uint32_t returnSize( const StrongPtr<T>& )
     {
         return sizeof(uint32_t);
     }
 
     /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */
-    template <class T> inline void loadAndIncrease( const SmartPtr<T>& variable, uint8_t*& mem )
+    template <class T> inline void loadAndIncrease( const StrongPtr<T>& variable, uint8_t*& mem )
     {
 //         *const_cast<typename Loki::TypeTraits<T*>::UnqualifiedType*>(&variable) = dynamic_cast<T*>(variable->getSynchronisable( *(uint32_t*)(mem) ));
-        *const_cast<typename Loki::TypeTraits<SmartPtr<T> >::UnqualifiedType*>(&variable) = orxonox_cast<T*>(T::getSynchronisable(*(uint32_t*)(mem)));
+        *const_cast<typename Loki::TypeTraits<StrongPtr<T> >::UnqualifiedType*>(&variable) = orxonox_cast<T*>(T::getSynchronisable(*(uint32_t*)(mem)));
         mem += returnSize( variable );
     }
 
     /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */
-    template <class T> inline void saveAndIncrease( const SmartPtr<T>& variable, uint8_t*& mem )
+    template <class T> inline void saveAndIncrease( const StrongPtr<T>& variable, uint8_t*& mem )
     {
         if ( variable.get() )
             *(uint32_t*)(mem) = static_cast<uint32_t>(variable->getObjectID());
@@ -104,7 +104,7 @@
     }
 
     /** @brief checks whether the objectID of the variable is the same as in the bytestream */
-    template <class T> inline  bool checkEquality( const SmartPtr<T>& variable, uint8_t* mem )
+    template <class T> inline  bool checkEquality( const StrongPtr<T>& variable, uint8_t* mem )
     {
         if ( variable.get() )
             return *(uint32_t*)(mem) == variable->getObjectID();
@@ -124,7 +124,7 @@
     template <class T> inline void loadAndIncrease( const WeakPtr<T>& variable, uint8_t*& mem )
     {
         //         *const_cast<typename Loki::TypeTraits<T*>::UnqualifiedType*>(&variable) = dynamic_cast<T*>(variable->getSynchronisable( *(uint32_t*)(mem) ));
-        *const_cast<typename Loki::TypeTraits<SmartPtr<T> >::UnqualifiedType*>(&variable) = orxonox_cast<T*>(T::getSynchronisable(*(uint32_t*)(mem)));
+        *const_cast<typename Loki::TypeTraits<StrongPtr<T> >::UnqualifiedType*>(&variable) = orxonox_cast<T*>(T::getSynchronisable(*(uint32_t*)(mem)));
         mem += returnSize( variable );
     }
 

Modified: code/branches/core7/src/modules/overlays/hud/HUDHealthBar.h
===================================================================
--- code/branches/core7/src/modules/overlays/hud/HUDHealthBar.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/modules/overlays/hud/HUDHealthBar.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -114,7 +114,7 @@
 
         private:
             WeakPtr<Pawn> owner_;
-            SmartPtr<OverlayText> textoverlay_;
+            StrongPtr<OverlayText> textoverlay_;
             bool bUseBarColour_;
             ColourValue textColour_;
     };

Modified: code/branches/core7/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/branches/core7/src/modules/pickup/PickupSpawner.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/modules/pickup/PickupSpawner.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -144,7 +144,8 @@
         // If the PickupSpawner is active.
         if(GameMode::isMaster() && this->isActive())
         {
-            WeakPtr<PickupSpawner> spawner = this; // Create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup)
+            // TODO: why is this a WeakPtr when the comment says StrongPtr?
+            WeakPtr<PickupSpawner> spawner = this; // Create a strong pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup)
 
             // Remove PickupCarriers from the blocked list if they have exceeded their time.
             for(std::map<PickupCarrier*, std::time_t>::iterator it = this->blocked_.begin(); it != this->blocked_.end(); )

Modified: code/branches/core7/src/modules/pickup/items/ShrinkPickup.cc
===================================================================
--- code/branches/core7/src/modules/pickup/items/ShrinkPickup.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/modules/pickup/items/ShrinkPickup.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -181,7 +181,7 @@
                 pawn->setMass(pawn->getMass()*factor);
 
                 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
-                const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
+                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
                 int size = cameraPositions.size();
                 for(int index = 0; index < size; index++)
                 {
@@ -207,7 +207,7 @@
                 pawn->setMass(pawn->getMass()*this->shrinkFactor_);
 
                 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
-                const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
+                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
                 int size = cameraPositions.size();
                 for(int index = 0; index < size; index++)
                 {
@@ -262,7 +262,7 @@
                 pawn->setMass(pawn->getMass()*factor);
 
                 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
-                const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
+                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
                 int size = cameraPositions.size();
                 for(int index = 0; index < size; index++)
                 {
@@ -303,7 +303,7 @@
                 pawn->setMass(pawn->getMass()*factor);
 
                 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
-                const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
+                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
                 int size = cameraPositions.size();
                 for(int index = 0; index < size; index++)
                 {

Modified: code/branches/core7/src/modules/tetris/Tetris.cc
===================================================================
--- code/branches/core7/src/modules/tetris/Tetris.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/modules/tetris/Tetris.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -103,7 +103,7 @@
             this->futureBrick_ = 0;
         }
 
-        for (std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
+        for (std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
             (*it)->destroy();
         this->stones_.clear();
     }
@@ -135,7 +135,7 @@
         else if(position.x > (this->center_->getWidth()-0.5)*this->center_->getStoneSize()) //!< If the stone touches the right edge of the level
             return false;
 
-        for(std::list<SmartPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
+        for(std::list<StrongPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
         {
             const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
 
@@ -191,7 +191,7 @@
         assert(stone);
 
         // check for collisions with all stones
-        for(std::list<SmartPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
+        for(std::list<StrongPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
         {
             //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount());
             const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
@@ -468,9 +468,9 @@
         for (unsigned int row = 0; row < this->center_->getHeight(); row++)
         {
             stonesPerRow = 0;
-            for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
+            for(std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
             {
-                std::list<SmartPtr<TetrisStone> >::iterator it_temp = it++;
+                std::list<StrongPtr<TetrisStone> >::iterator it_temp = it++;
                 correctPosition = static_cast<unsigned int>(((*it_temp)->getPosition().y - 5)/this->center_->getStoneSize());
                 if(correctPosition == row)
                 {
@@ -490,7 +490,7 @@
 
     void Tetris::clearRow(unsigned int row)
     {// clear the full row
-        for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
+        for(std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
         {
             if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row)
             {
@@ -501,7 +501,7 @@
                 ++it;
         }
       // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug.
-        for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
+        for(std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
         {
             if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) > row)
                 (*it)->setPosition((*it)->getPosition()-Vector3(0,10,0));

Modified: code/branches/core7/src/modules/tetris/Tetris.h
===================================================================
--- code/branches/core7/src/modules/tetris/Tetris.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/modules/tetris/Tetris.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -93,7 +93,7 @@
             PlayerInfo* player_;
 
             WeakPtr<TetrisCenterpoint> center_; //!< The playing field.
-            std::list<SmartPtr<TetrisStone> > stones_; //!< A list of all stones in play.
+            std::list<StrongPtr<TetrisStone> > stones_; //!< A list of all stones in play.
             WeakPtr<TetrisBrick> activeBrick_;
             WeakPtr<TetrisBrick> futureBrick_;
 

Modified: code/branches/core7/src/orxonox/Scene.cc
===================================================================
--- code/branches/core7/src/orxonox/Scene.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/Scene.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -61,7 +61,7 @@
     {
         RegisterObject(Scene);
 
-        this->setScene(SmartPtr<Scene>(this, false), OBJECTID_UNKNOWN);
+        this->setScene(StrongPtr<Scene>(this, false), OBJECTID_UNKNOWN);
         this->bShadows_ = true;
         this->bDebugDrawPhysics_ = false;
         this->debugDrawer_ = NULL;
@@ -365,8 +365,8 @@
                                              int index0, const btCollisionObject* colObj1, int partId1, int index1)
     {
         // get the WorldEntity pointers
-        SmartPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
-        SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
+        StrongPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
+        StrongPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
 
         // get the CollisionShape pointers
         const btCollisionShape* cs0 = colObj0->getCollisionShape();

Modified: code/branches/core7/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/branches/core7/src/orxonox/gametypes/Gametype.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/gametypes/Gametype.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -60,7 +60,7 @@
     {
         RegisterObject(Gametype);
 
-        this->setGametype(SmartPtr<Gametype>(this, false));
+        this->setGametype(StrongPtr<Gametype>(this, false));
 
         this->gtinfo_ = new GametypeInfo(context);
         this->gtinfo_->setGametype(this);

Modified: code/branches/core7/src/orxonox/interfaces/RadarViewable.h
===================================================================
--- code/branches/core7/src/orxonox/interfaces/RadarViewable.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/interfaces/RadarViewable.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -36,7 +36,7 @@
 
 #include "util/Math.h"
 #include "core/class/OrxonoxInterface.h"
-#include "core/object/SmartPtr.h"
+#include "core/object/StrongPtr.h"
 
 namespace orxonox
 {
@@ -162,7 +162,7 @@
 
         //Radar
         const WorldEntity* wePtr_;
-        SmartPtr<Radar> radar_;
+        StrongPtr<Radar> radar_;
         float radarObjectCamouflage_;
         Shape radarObjectShape_;
         std::string radarObjectDescription_;

Modified: code/branches/core7/src/orxonox/overlays/OverlayGroup.cc
===================================================================
--- code/branches/core7/src/orxonox/overlays/OverlayGroup.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/overlays/OverlayGroup.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -60,7 +60,7 @@
 
     OverlayGroup::~OverlayGroup()
     {
-        for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
             (*it)->destroy();
         this->hudElements_.clear();
     }
@@ -84,7 +84,7 @@
     //! Scales every element in the set.
     void OverlayGroup::setScale(const Vector2& scale)
     {
-        for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
             (*it)->scale(scale / this->scale_);
         this->scale_ = scale;
     }
@@ -92,7 +92,7 @@
     //! Scrolls every element in the set.
     void OverlayGroup::setScroll(const Vector2& scroll)
     {
-        for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
             (*it)->scroll(scroll - this->scroll_);
         this->scroll_ = scroll;
     }
@@ -105,7 +105,7 @@
     */
     void OverlayGroup::addElement(OrxonoxOverlay* element)
     {
-        hudElements_.insert(SmartPtr<OrxonoxOverlay>(element));
+        hudElements_.insert(StrongPtr<OrxonoxOverlay>(element));
         element->setOverlayGroup( this );
         if (this->owner_)
             element->setOwner(this->owner_);
@@ -121,7 +121,7 @@
     */
     bool OverlayGroup::removeElement(OrxonoxOverlay* element)
     {
-        if(this->hudElements_.erase(SmartPtr<OrxonoxOverlay>(element)) == 0)
+        if(this->hudElements_.erase(StrongPtr<OrxonoxOverlay>(element)) == 0)
             return false;
         return true;
     }
@@ -131,7 +131,7 @@
     {
         if (index < this->hudElements_.size())
         {
-            std::set< SmartPtr<OrxonoxOverlay> >::const_iterator it = hudElements_.begin();
+            std::set< StrongPtr<OrxonoxOverlay> >::const_iterator it = hudElements_.begin();
             for (unsigned int i = 0; i != index; ++it, ++i)
                 ;
             return it->get();
@@ -145,7 +145,7 @@
     {
         SUPER( OverlayGroup, changedVisibility );
 
-        for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
             (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
     }
 
@@ -154,7 +154,7 @@
     {
         SUPER( OverlayGroup, changedGametype );
 
-        for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
             (*it)->setGametype(this->getGametype());
     }
 
@@ -162,7 +162,7 @@
     {
         this->owner_ = owner;
 
-        for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
             (*it)->setOwner(owner);
     }
 

Modified: code/branches/core7/src/orxonox/overlays/OverlayGroup.h
===================================================================
--- code/branches/core7/src/orxonox/overlays/OverlayGroup.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/overlays/OverlayGroup.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -64,7 +64,7 @@
         static void scaleGroup(const std::string& name, float scale);
         static void scrollGroup(const std::string& name, const Vector2& scroll);
 
-        inline const std::set< SmartPtr<OrxonoxOverlay> >& getOverlays() const
+        inline const std::set< StrongPtr<OrxonoxOverlay> >& getOverlays() const
             { return this->hudElements_; }
 
         virtual void changedVisibility();
@@ -91,7 +91,7 @@
         OrxonoxOverlay* getElement(unsigned int index);
 
     private:
-        std::set< SmartPtr<OrxonoxOverlay> > hudElements_;    //!< Contains all the OrxonoxOverlays of the this group.
+        std::set< StrongPtr<OrxonoxOverlay> > hudElements_;    //!< Contains all the OrxonoxOverlays of the this group.
         Vector2 scale_;                            //!< Current scale (independent of the elements).
         Vector2 scroll_;                           //!< Current scrolling offset.
         BaseObject* owner_;                        //!< The owner of this OverlayGroup

Modified: code/branches/core7/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/branches/core7/src/orxonox/sound/AmbientSound.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/sound/AmbientSound.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -50,7 +50,7 @@
     {
         if (GameMode::playsSound())
         {
-            // Smoothly fade out by keeping a SmartPtr
+            // Smoothly fade out by keeping a StrongPtr
             SoundManager::getInstance().unregisterAmbientSound(this);
         }
     }

Modified: code/branches/core7/src/orxonox/sound/SoundBuffer.h
===================================================================
--- code/branches/core7/src/orxonox/sound/SoundBuffer.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/sound/SoundBuffer.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -45,7 +45,7 @@
     {
         friend class SoundManager;
 #if !defined(_MSC_VER) || _MSC_VER >= 1500
-        // Make sure nobody deletes an instance (using smart pointers)
+        // Make sure nobody deletes an instance (using strong pointers)
         template <class T>
         friend void boost::checked_delete(T*);
 #endif

Modified: code/branches/core7/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/core7/src/orxonox/sound/SoundManager.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/sound/SoundManager.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -164,7 +164,7 @@
 
     SoundManager::~SoundManager()
     {
-        // Erase fade lists because of the smart pointers
+        // Erase fade lists because of the strong pointers
         this->bDestructorCalled_ = true;
         this->fadeInList_.clear();
         this->fadeOutList_.clear();
@@ -418,10 +418,10 @@
         }
     }
 
-    void SoundManager::fadeIn(const SmartPtr<AmbientSound>& sound)
+    void SoundManager::fadeIn(const StrongPtr<AmbientSound>& sound)
     {
         // If we're already fading out --> remove that
-        for (std::list<SmartPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++)
+        for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++)
         {
             if (*it == sound)
             {
@@ -434,10 +434,10 @@
             this->fadeInList_.push_back(sound);
     }
 
-    void SoundManager::fadeOut(const SmartPtr<AmbientSound>& sound)
+    void SoundManager::fadeOut(const StrongPtr<AmbientSound>& sound)
     {
         // If we're already fading in --> remove that
-        for (std::list<SmartPtr<AmbientSound> >::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++)
+        for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++)
         {
             if (*it == sound)
             {
@@ -460,7 +460,7 @@
         }
 
         // FADE IN
-        for (std::list<SmartPtr<AmbientSound> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); )
+        for (std::list<StrongPtr<AmbientSound> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); )
         {
             if ((*it)->getVolume() + this->crossFadeStep_*dt > 1.0f)
             {
@@ -475,7 +475,7 @@
         }
 
         // FADE OUT
-        for (std::list<SmartPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); )
+        for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); )
         {
             if ((*it)->getVolume() - this->crossFadeStep_*dt < 0.0f)
             {

Modified: code/branches/core7/src/orxonox/sound/SoundManager.h
===================================================================
--- code/branches/core7/src/orxonox/sound/SoundManager.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/sound/SoundManager.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -39,7 +39,7 @@
 
 #include "util/Singleton.h"
 #include "core/config/Configurable.h"
-#include "core/object/SmartPtr.h"
+#include "core/object/StrongPtr.h"
 #include "core/UpdateListener.h"
 
 // tolua_begin
@@ -105,8 +105,8 @@
 
     private:
         void processCrossFading(float dt);
-        void fadeIn(const SmartPtr<AmbientSound>& sound);
-        void fadeOut(const SmartPtr<AmbientSound>& sound);
+        void fadeIn(const StrongPtr<AmbientSound>& sound);
+        void fadeOut(const StrongPtr<AmbientSound>& sound);
 
         void checkFadeStepValidity();
 
@@ -128,8 +128,8 @@
         AmbientList                        ambientSounds_;
         //! Absolute change per second (0.1 means 10% of the nominal volume) for cross fading
         float                              crossFadeStep_;
-        std::list<SmartPtr<AmbientSound> > fadeInList_;
-        std::list<SmartPtr<AmbientSound> > fadeOutList_;
+        std::list<StrongPtr<AmbientSound> > fadeInList_;
+        std::list<StrongPtr<AmbientSound> > fadeOutList_;
 
         // Volume related
         float volume_[3];

Modified: code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -107,7 +107,7 @@
             if (this->camera_)
                 this->camera_->destroy();
 
-            for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
+            for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
                 (*it)->destroy();
 
             if (this->getScene()->getSceneManager())
@@ -164,7 +164,7 @@
     CameraPosition* ControllableEntity::getCameraPosition(unsigned int index) const
     {
         unsigned int i = 0;
-        for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
+        for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
         {
             if (i == index)
                 return (*it);
@@ -179,7 +179,7 @@
             return 0;
 
         unsigned int counter = 0;
-        for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
+        for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
         {
             if ((*it) == this->currentCameraPosition_)
                 break;
@@ -218,7 +218,7 @@
             }
             else if (this->cameraPositions_.size() > 0)
             {
-                for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
+                for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
                 {
                     if ((*it) == this->camera_->getParent())
                     {
@@ -476,7 +476,7 @@
         WorldEntity* parent = this->getParent();
         if (parent)
         {
-            for (std::list<SmartPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
+            for (std::list<StrongPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
                 if ((*it)->getIsAbsolute())
                     parent->attach((*it));
         }

Modified: code/branches/core7/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/branches/core7/src/orxonox/worldentities/ControllableEntity.h	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/worldentities/ControllableEntity.h	2015-08-29 15:35:59 UTC (rev 10555)
@@ -113,7 +113,7 @@
 
             void addCameraPosition(CameraPosition* position);
             CameraPosition* getCameraPosition(unsigned int index) const;
-            inline const std::list<SmartPtr<CameraPosition> >& getCameraPositions() const
+            inline const std::list<StrongPtr<CameraPosition> >& getCameraPositions() const
                 { return this->cameraPositions_; }
             unsigned int getCurrentCameraIndex() const;
             bool setCameraPosition(unsigned int index);
@@ -234,7 +234,7 @@
             Camera* camera_;
             bool bMouseLook_;
             float mouseLookSpeed_;
-            std::list<SmartPtr<CameraPosition> > cameraPositions_;
+            std::list<StrongPtr<CameraPosition> > cameraPositions_;
             CameraPosition* currentCameraPosition_;
             std::string cameraPositionTemplate_;
             Controller* xmlcontroller_;

Modified: code/branches/core7/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/branches/core7/src/orxonox/worldentities/WorldEntity.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/src/orxonox/worldentities/WorldEntity.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -129,7 +129,7 @@
             {
                 WorldEntity* entity = *it;
 
-                // do this for all children, because even if getDeleteWithParent() returns true a child might still stay active due to smart pointers pointing to it
+                // do this for all children, because even if getDeleteWithParent() returns true a child might still stay active due to strong pointers pointing to it
                 entity->setPosition(entity->getWorldPosition());
                 this->detach(entity); // detach also erases the element from the children set
 

Modified: code/branches/core7/test/core/CMakeLists.txt
===================================================================
--- code/branches/core7/test/core/CMakeLists.txt	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/test/core/CMakeLists.txt	2015-08-29 15:35:59 UTC (rev 10555)
@@ -25,7 +25,7 @@
     object/ListableTest.cc
     object/ObjectListBaseTest.cc
     object/ObjectListIteratorTest.cc
-    object/SmartPtrTest.cc
+    object/StrongPtrTest.cc
     object/WeakPtrTest.cc
     singleton/ScopeTest.cc
 )

Deleted: code/branches/core7/test/core/object/SmartPtrTest.cc
===================================================================
--- code/branches/core7/test/core/object/SmartPtrTest.cc	2015-08-29 14:23:00 UTC (rev 10554)
+++ code/branches/core7/test/core/object/SmartPtrTest.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -1,143 +0,0 @@
-#include <gtest/gtest.h>
-#include "core/object/SmartPtr.h"
-
-namespace orxonox
-{
-    namespace
-    {
-        class DestroyableTest : public Destroyable
-        {
-            public:
-                DestroyableTest(bool& destroyed) : destroyed_(destroyed) { destroyed_ = false; }
-                virtual ~DestroyableTest() { destroyed_ = true; }
-
-            private:
-                bool& destroyed_;
-        };
-    }
-
-    TEST(SmartPtrTest, CanReferenceObject)
-    {
-        bool bla;
-        DestroyableTest* test = new DestroyableTest(bla);
-        SmartPtr<DestroyableTest> smartPtr = test;
-        EXPECT_EQ(test, smartPtr.get());
-        test->destroy();
-    }
-
-    TEST(SmartPtrTest, IncreasesReferenceCount)
-    {
-        bool bla;
-        DestroyableTest* test = new DestroyableTest(bla);
-        EXPECT_EQ(0u, test->getReferenceCount());
-        {
-            SmartPtr<DestroyableTest> smartPtr = test;
-            EXPECT_EQ(1u, test->getReferenceCount());
-        }
-        EXPECT_EQ(0u, test->getReferenceCount());
-        test->destroy();
-    }
-
-    TEST(SmartPtrTest, DestroyDeletesInstance)
-    {
-        bool destroyed = false;
-        DestroyableTest* test = new DestroyableTest(destroyed);
-        EXPECT_FALSE(destroyed);
-        test->destroy();
-        EXPECT_TRUE(destroyed);
-    }
-
-    TEST(SmartPtrTest, PreventsDestruction)
-    {
-        bool destroyed = false;
-        DestroyableTest* test = new DestroyableTest(destroyed);
-        EXPECT_FALSE(destroyed);
-        SmartPtr<DestroyableTest> smartPtr = test;
-        test->destroy();
-        EXPECT_FALSE(destroyed);
-    }
-
-    TEST(SmartPtrTest, DestroysIfSmartPtrRemoved)
-    {
-        bool destroyed = false;
-        DestroyableTest* test = new DestroyableTest(destroyed);
-        EXPECT_FALSE(destroyed);
-        {
-            SmartPtr<DestroyableTest> smartPtr = test;
-            test->destroy();
-            EXPECT_FALSE(destroyed);
-        }
-        EXPECT_TRUE(destroyed);
-    }
-
-    TEST(SmartPtrTest, DestroysIfAllSmartPtrsRemoved)
-    {
-        bool destroyed = false;
-        DestroyableTest* test = new DestroyableTest(destroyed);
-        EXPECT_FALSE(destroyed);
-        {
-            SmartPtr<DestroyableTest> smartPtr1 = test;
-            {
-                SmartPtr<DestroyableTest> smartPtr2 = test;
-                {
-                    SmartPtr<DestroyableTest> smartPtr3 = test;
-                    test->destroy();
-                    EXPECT_FALSE(destroyed);
-                }
-                EXPECT_FALSE(destroyed);
-            }
-            EXPECT_FALSE(destroyed);
-        }
-        EXPECT_TRUE(destroyed);
-    }
-
-    void isNull(const SmartPtr<DestroyableTest> smartPtr)
-    {
-        EXPECT_TRUE(smartPtr == NULL);
-        EXPECT_TRUE(smartPtr == 0);
-        EXPECT_TRUE(!smartPtr);
-        EXPECT_FALSE(smartPtr != NULL);
-        EXPECT_FALSE(smartPtr != 0);
-        EXPECT_FALSE(smartPtr);
-    }
-
-    TEST(SmartPtrTest, IsNull)
-    {
-        {
-            SmartPtr<DestroyableTest> smartPtr;
-            isNull(smartPtr);
-        }
-        {
-            SmartPtr<DestroyableTest> smartPtr = NULL;
-            isNull(smartPtr);
-        }
-        {
-            SmartPtr<DestroyableTest> smartPtr;
-            smartPtr = NULL;
-            isNull(smartPtr);
-        }
-        {
-            SmartPtr<DestroyableTest> smartPtr = 0;
-            isNull(smartPtr);
-        }
-        {
-            SmartPtr<DestroyableTest> smartPtr;
-            smartPtr = 0;
-            isNull(smartPtr);
-        }
-    }
-
-    TEST(SmartPtrTest, IsNotNull)
-    {
-        bool destroyed = false;
-        DestroyableTest* test = new DestroyableTest(destroyed);
-        SmartPtr<DestroyableTest> smartPtr = test;
-        EXPECT_FALSE(smartPtr == NULL);
-        EXPECT_FALSE(smartPtr == 0);
-        EXPECT_FALSE(!smartPtr);
-        EXPECT_TRUE(smartPtr != NULL);
-        EXPECT_TRUE(smartPtr != 0);
-        EXPECT_TRUE(smartPtr);
-        test->destroy();
-    }
-}

Copied: code/branches/core7/test/core/object/StrongPtrTest.cc (from rev 10553, code/branches/core7/test/core/object/SmartPtrTest.cc)
===================================================================
--- code/branches/core7/test/core/object/StrongPtrTest.cc	                        (rev 0)
+++ code/branches/core7/test/core/object/StrongPtrTest.cc	2015-08-29 15:35:59 UTC (rev 10555)
@@ -0,0 +1,143 @@
+#include <gtest/gtest.h>
+#include "core/object/StrongPtr.h"
+
+namespace orxonox
+{
+    namespace
+    {
+        class DestroyableTest : public Destroyable
+        {
+            public:
+                DestroyableTest(bool& destroyed) : destroyed_(destroyed) { destroyed_ = false; }
+                virtual ~DestroyableTest() { destroyed_ = true; }
+
+            private:
+                bool& destroyed_;
+        };
+    }
+
+    TEST(StrongPtrTest, CanReferenceObject)
+    {
+        bool bla;
+        DestroyableTest* test = new DestroyableTest(bla);
+        StrongPtr<DestroyableTest> strongPtr = test;
+        EXPECT_EQ(test, strongPtr.get());
+        test->destroy();
+    }
+
+    TEST(StrongPtrTest, IncreasesReferenceCount)
+    {
+        bool bla;
+        DestroyableTest* test = new DestroyableTest(bla);
+        EXPECT_EQ(0u, test->getReferenceCount());
+        {
+            StrongPtr<DestroyableTest> strongPtr = test;
+            EXPECT_EQ(1u, test->getReferenceCount());
+        }
+        EXPECT_EQ(0u, test->getReferenceCount());
+        test->destroy();
+    }
+
+    TEST(StrongPtrTest, DestroyDeletesInstance)
+    {
+        bool destroyed = false;
+        DestroyableTest* test = new DestroyableTest(destroyed);
+        EXPECT_FALSE(destroyed);
+        test->destroy();
+        EXPECT_TRUE(destroyed);
+    }
+
+    TEST(StrongPtrTest, PreventsDestruction)
+    {
+        bool destroyed = false;
+        DestroyableTest* test = new DestroyableTest(destroyed);
+        EXPECT_FALSE(destroyed);
+        StrongPtr<DestroyableTest> strongPtr = test;
+        test->destroy();
+        EXPECT_FALSE(destroyed);
+    }
+
+    TEST(StrongPtrTest, DestroysIfStrongPtrRemoved)
+    {
+        bool destroyed = false;
+        DestroyableTest* test = new DestroyableTest(destroyed);
+        EXPECT_FALSE(destroyed);
+        {
+            StrongPtr<DestroyableTest> strongPtr = test;
+            test->destroy();
+            EXPECT_FALSE(destroyed);
+        }
+        EXPECT_TRUE(destroyed);
+    }
+
+    TEST(StrongPtrTest, DestroysIfAllStrongPtrsRemoved)
+    {
+        bool destroyed = false;
+        DestroyableTest* test = new DestroyableTest(destroyed);
+        EXPECT_FALSE(destroyed);
+        {
+            StrongPtr<DestroyableTest> strongPtr1 = test;
+            {
+                StrongPtr<DestroyableTest> strongPtr2 = test;
+                {
+                    StrongPtr<DestroyableTest> strongPtr3 = test;
+                    test->destroy();
+                    EXPECT_FALSE(destroyed);
+                }
+                EXPECT_FALSE(destroyed);
+            }
+            EXPECT_FALSE(destroyed);
+        }
+        EXPECT_TRUE(destroyed);
+    }
+
+    void isNull(const StrongPtr<DestroyableTest> strongPtr)
+    {
+        EXPECT_TRUE(strongPtr == NULL);
+        EXPECT_TRUE(strongPtr == 0);
+        EXPECT_TRUE(!strongPtr);
+        EXPECT_FALSE(strongPtr != NULL);
+        EXPECT_FALSE(strongPtr != 0);
+        EXPECT_FALSE(strongPtr);
+    }
+
+    TEST(StrongPtrTest, IsNull)
+    {
+        {
+            StrongPtr<DestroyableTest> strongPtr;
+            isNull(strongPtr);
+        }
+        {
+            StrongPtr<DestroyableTest> strongPtr = NULL;
+            isNull(strongPtr);
+        }
+        {
+            StrongPtr<DestroyableTest> strongPtr;
+            strongPtr = NULL;
+            isNull(strongPtr);
+        }
+        {
+            StrongPtr<DestroyableTest> strongPtr = 0;
+            isNull(strongPtr);
+        }
+        {
+            StrongPtr<DestroyableTest> strongPtr;
+            strongPtr = 0;
+            isNull(strongPtr);
+        }
+    }
+
+    TEST(StrongPtrTest, IsNotNull)
+    {
+        bool destroyed = false;
+        DestroyableTest* test = new DestroyableTest(destroyed);
+        StrongPtr<DestroyableTest> strongPtr = test;
+        EXPECT_FALSE(strongPtr == NULL);
+        EXPECT_FALSE(strongPtr == 0);
+        EXPECT_FALSE(!strongPtr);
+        EXPECT_TRUE(strongPtr != NULL);
+        EXPECT_TRUE(strongPtr != 0);
+        EXPECT_TRUE(strongPtr);
+        test->destroy();
+    }
+}




More information about the Orxonox-commit mailing list