Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10555


Ignore:
Timestamp:
Aug 29, 2015, 5:35:59 PM (5 years ago)
Author:
landauf
Message:

renamed SmartPtr to StrongPtr (now we have weak and strong pointers)

Location:
code/branches/core7
Files:
27 edited
2 moved

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/BaseObject.h

    r10298 r10555  
    5151#include "class/OrxonoxClass.h"
    5252#include "class/Super.h"
    53 #include "object/SmartPtr.h"
     53#include "object/StrongPtr.h"
    5454
    5555namespace orxonox
     
    138138                { return this->templates_; }
    139139
    140             inline void setNamespace(const SmartPtr<Namespace>& ns) { this->namespace_ = ns; }
    141             inline const SmartPtr<Namespace>& getNamespace() const { return this->namespace_; }
     140            inline void setNamespace(const StrongPtr<Namespace>& ns) { this->namespace_ = ns; }
     141            inline const StrongPtr<Namespace>& getNamespace() const { return this->namespace_; }
    142142
    143143            inline void setCreator(BaseObject* creator) { this->creator_ = creator; }
    144144            inline BaseObject* getCreator() const { return this->creator_; }
    145145
    146             inline void setScene(const SmartPtr<Scene>& scene, uint32_t sceneID) { this->scene_ = scene; this->sceneID_=sceneID; }
    147             inline const SmartPtr<Scene>& getScene() const { return this->scene_; }
     146            inline void setScene(const StrongPtr<Scene>& scene, uint32_t sceneID) { this->scene_ = scene; this->sceneID_=sceneID; }
     147            inline const StrongPtr<Scene>& getScene() const { return this->scene_; }
    148148            inline virtual uint32_t getSceneID() const { return this->sceneID_; }
    149149
    150             inline void setGametype(const SmartPtr<Gametype>& gametype)
     150            inline void setGametype(const StrongPtr<Gametype>& gametype)
    151151            {
    152152                if (gametype != this->gametype_)
     
    157157                }
    158158            }
    159             inline const SmartPtr<Gametype>& getGametype() const { return this->gametype_; }
     159            inline const StrongPtr<Gametype>& getGametype() const { return this->gametype_; }
    160160            inline Gametype* getOldGametype() const { return this->oldGametype_; }
    161161            virtual void changedGametype() {}
    162162
    163             inline void setLevel(const SmartPtr<Level>& level)
     163            inline void setLevel(const StrongPtr<Level>& level)
    164164            {
    165165                if (level != this->level_)
     
    169169                }
    170170            }
    171             inline const SmartPtr<Level>& getLevel() const { return this->level_; }
     171            inline const StrongPtr<Level>& getLevel() const { return this->level_; }
    172172            virtual void changedLevel() {}
    173173
     
    222222            std::map<std::string, std::string> xmlAttributes_; //!< Lowercase XML attributes
    223223            std::string            loaderIndentation_;         //!< Indentation of the debug output in the Loader
    224             SmartPtr<Namespace>    namespace_;
     224            StrongPtr<Namespace>   namespace_;
    225225            BaseObject*            creator_;
    226             SmartPtr<Scene>        scene_;
     226            StrongPtr<Scene>       scene_;
    227227            uint32_t               sceneID_;
    228             SmartPtr<Gametype>     gametype_;
     228            StrongPtr<Gametype>    gametype_;
    229229            Gametype*              oldGametype_;
    230             SmartPtr<Level>        level_;
     230            StrongPtr<Level>       level_;
    231231            std::set<Template*>    templates_;
    232232
  • code/branches/core7/src/libraries/core/CorePrereqs.h

    r10552 r10555  
    218218    class ScopedSingletonWrapper;
    219219    class SettingsConfigFile;
    220     template <class T>
    221     class SmartPtr;
    222220    class StaticallyInitializedInstance;
    223221    class StaticInitializationHandler;
    224222    class StaticInitializationManager;
     223    template <class T>
     224    class StrongPtr;
    225225    template <class T>
    226226    class SubclassIdentifier;
  • code/branches/core7/src/libraries/core/CoreStaticInitializationHandler.cc

    r10542 r10555  
    102102            identifiers.insert(&static_cast<StaticallyInitializedIdentifier*>(*it)->getIdentifier());
    103103
    104         // destroy objects. some objects may survive this at first because they still have smart pointers pointing at them. this is
    105         // ok as long as those smart pointers are held by objects that are also about to be destroyed in the same loop. this means
    106         // that objects within one module may reference each other by smart pointers. but it is not allowed that objects from another
    107         // module (which is not unloaded) uses smart pointers to point at objects inside the unloaded module. this will lead to a crash.
     104        // destroy objects. some objects may survive this at first because they still have strong pointers pointing at them. this is
     105        // ok as long as those strong pointers are held by objects that are also about to be destroyed in the same loop. this means
     106        // that objects within one module may reference each other by strong pointers. but it is not allowed that objects from another
     107        // module (which is not unloaded) uses strong pointers to point at objects inside the unloaded module. this will lead to a crash.
    108108        for (std::set<Identifier*>::iterator it = identifiers.begin(); it != identifiers.end(); ++it)
    109109            (*it)->destroyObjects();
    110110
    111         // check if all objects were really destroyed. this is not the case if an object is referenced by a smart pointer from another
     111        // check if all objects were really destroyed. this is not the case if an object is referenced by a strong pointer from another
    112112        // module (or if two objects inside this module reference each other). this will lead to a crash and must be fixed (e.g. by
    113113        // changing object dependencies; or by changing the logic that allows modules to be unloaded).
  • code/branches/core7/src/libraries/core/Namespace.cc

    r10298 r10555  
    4747        RegisterObject(Namespace);
    4848
    49         this->setNamespace(SmartPtr<Namespace>(this, false));
     49        this->setNamespace(StrongPtr<Namespace>(this, false));
    5050    }
    5151
  • code/branches/core7/src/libraries/core/object/DestroyLaterManager.cc

    r10464 r10555  
    5151    void DestroyLaterManager::postUpdate(const Clock& time)
    5252    {
    53         // clearing the list will destroy all smartpointers and thus all retained instances (as long as there are no other smart pointers pointing to them).
     53        // 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).
    5454        this->retainedInstances_.clear();
    5555    }
  • code/branches/core7/src/libraries/core/object/DestroyLaterManager.h

    r10419 r10555  
    3434#include "util/Singleton.h"
    3535#include "core/UpdateListener.h"
    36 #include "SmartPtr.h"
     36#include "StrongPtr.h"
    3737
    3838namespace orxonox
     
    5252
    5353        private:
    54             std::vector<SmartPtr<Destroyable> > retainedInstances_;
     54            std::vector<StrongPtr<Destroyable> > retainedInstances_;
    5555
    5656            static DestroyLaterManager* singletonPtr_s;
  • code/branches/core7/src/libraries/core/object/Destroyable.cc

    r10419 r10555  
    6161
    6262    /**
    63         @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.
    64         Always call destroy() instead of using 'delete' directly, otherwise smart pointers won't work.
     63        @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.
     64        Always call destroy() instead of using 'delete' directly, otherwise strong pointers won't work.
    6565    */
    6666    void Destroyable::destroy()
     
    8181    void Destroyable::destroyLater()
    8282    {
    83         // register in DestroyLaterManager - this ensures that a smartPtr points to this object and keeps it alive for a while
     83        // register in DestroyLaterManager - this ensures that a strongPtr points to this object and keeps it alive for a while
    8484        DestroyLaterManager::getInstance().retain(this);
    8585
    86         // request destruction -> object will be deleted after all smartPtrs (including the one in DestroyLaterManager) were destroyed.
     86        // request destruction -> object will be deleted after all strongPtrs (including the one in DestroyLaterManager) were destroyed.
    8787        this->destroy();
    8888    }
  • code/branches/core7/src/libraries/core/object/Destroyable.h

    r10419 r10555  
    3030    @file
    3131    @ingroup Object
    32     @brief Declaration of Destroyable, the base class of all objects which can be used with SmartPtr and WeakPtr.
     32    @brief Declaration of Destroyable, the base class of all objects which can be used with StrongPtr and WeakPtr.
    3333*/
    3434
     
    4343{
    4444    /**
    45         @brief Classes must inherit from this class if they should be used with SmartPtr or WeakPtr.
     45        @brief Classes must inherit from this class if they should be used with StrongPtr or WeakPtr.
    4646    */
    4747    class _CoreExport Destroyable
    4848    {
    4949        template <class T>
    50         friend class SmartPtr;
     50        friend class StrongPtr;
    5151
    5252        friend class DestructionListener;
     
    5959            void destroyLater();
    6060
    61             /// Returns the number of @ref orxonox::SmartPtr "smart pointers" that point to this object.
     61            /// Returns the number of @ref orxonox::StrongPtr "strong pointers" that point to this object.
    6262            inline unsigned int getReferenceCount() const
    6363                { return this->referenceCount_; }
    6464
    6565        protected:
    66             /// 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
     66            /// 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
    6767            /// prevent destruction. Don't call this function directly - use destroy() instead.
    6868            virtual void preDestroy() {}
    6969
    7070        private:
    71             /// Increments the reference counter (for smart pointers).
     71            /// Increments the reference counter (for strong pointers).
    7272            inline void incrementReferenceCount()
    7373                { ++this->referenceCount_; }
    74             /// Decrements the reference counter (for smart pointers).
     74            /// Decrements the reference counter (for strong pointers).
    7575            inline void decrementReferenceCount()
    7676            {
     
    8787                { this->destructionListeners_.erase(pointer); }
    8888
    89             int referenceCount_;                                    //!< Counts the references from smart pointers to this object
     89            int referenceCount_;                                    //!< Counts the references from strong pointers to this object
    9090            bool requestedDestruction_;                             //!< Becomes true after someone called delete on this object
    9191            std::set<DestructionListener*> destructionListeners_;   //!< All destruction listeners (for example weak pointers which point to this object and like to get notified if it dies)
  • code/branches/core7/src/libraries/core/object/StrongPtr.h

    r10553 r10555  
    3030
    3131/**
    32     @defgroup SmartPtr SmartPtr<T> and WeakPtr<T>
     32    @defgroup SmartPtr StrongPtr<T> and WeakPtr<T>
    3333    @ingroup Object
    3434*/
     
    3737    @file
    3838    @ingroup Object SmartPtr
    39     @brief Definition of SmartPtr<T>, wraps a pointer to an object and keeps it alive.
    40 
    41     @anchor SmartPtrExample
    42 
    43     orxonox::SmartPtr is an implementation of a smart pointer - it wraps a pointer to an
    44     object  and keeps this object alive until no SmartPtr points to this object anymore.
    45     In contrast to orxonox::SharedPtr, SmartPtr works only with classes that are derived
     39    @brief Definition of StrongPtr<T>, wraps a pointer to an object and keeps it alive.
     40
     41    @anchor StrongPtrExample
     42
     43    orxonox::StrongPtr is an implementation of a smart pointer - it wraps a pointer to an
     44    object  and keeps this object alive until no StrongPtr points to this object anymore.
     45    In contrast to orxonox::SharedPtr, StrongPtr works only with classes that are derived
    4646    from orxonox::Destroyable, because it's an intrusive implementation, meaning the
    4747    reference counter is stored in the object itself.
    4848
    49     It's possible to use normal pointers and smart pointers to an object simultaneously.
    50     You don't have to use SmartPtr all the time, you can create a SmartPtr for an object
     49    It's possible to use normal pointers and strong pointers to an object simultaneously.
     50    You don't have to use StrongPtr all the time, you can create a StrongPtr for an object
    5151    at any time and also convert it back to a normal pointer if you like. This is possible
    52     because the reference counter is stored in the object itself and not in SmartPtr (in
     52    because the reference counter is stored in the object itself and not in StrongPtr (in
    5353    contrast to SharedPtr).
    5454
    5555    @b Important: If you want to delete an object, you must not use @c delete @c object but
    56     rather @c object->destroy(). This function will check if there are smart pointers
    57     pointing to the object. If yes, the object will be kept alive until all smart pointes
     56    rather @c object->destroy(). This function will check if there are strong pointers
     57    pointing to the object. If yes, the object will be kept alive until all strong pointers
    5858    are destroyed. If no, the object is deleted instantly.
    5959
    60     If all smart pointers that point to an object are destroyed, but you never called
    61     @c object->destroy() before, the object will not be deleted! All a SmartPtr will do
     60    If all strong pointers that point to an object are destroyed, but you never called
     61    @c object->destroy() before, the object will not be deleted! All a StrongPtr will do
    6262    is to really just keep an object alive, but it will not delete it automatically
    6363    unless you tried to destroy it before.
     
    6868    {
    6969        public:
    70             void setObject(OtherClass* object)              // passes a normal pointer which will be stored in a SmartPtr
     70            void setObject(OtherClass* object)              // passes a normal pointer which will be stored in a StrongPtr
    7171                { this->object_ = object; }
    7272
    73             OtherClass* getObject() const                   // converts the SmartPtr to a normal pointer and returns it
     73            OtherClass* getObject() const                   // converts the StrongPtr to a normal pointer and returns it
    7474                { return this->object_; }
    7575
    7676        private:
    77             SmartPtr<OtherClass> object_;                   // a pointer to an instance of OtherClass is stored in a SmartPtr
     77            StrongPtr<OtherClass> object_;                  // a pointer to an instance of OtherClass is stored in a StrongPtr
    7878    };
    7979    @endcode
     
    8585    MyClass* myclass = new MyClass();                       // create an instance of MyClass
    8686    OtherClass* object = new OtherClass();                  // create an instance of OtherClass
    87     myclass->setObject(object);                             // the object is now stored in a SmartPtr inside myclass
    88 
    89     object->destroy();                                      // we try to destroy object, but there's still a SmartPtr pointing at it.
    90 
    91     # object still exists at this point (because a SmartPtr points at it)
    92 
    93     delete myclass;                                         // now we delete myclass, which also destroys the SmartPtr
    94 
    95     # object doesn't exist anymore (because the SmartPtr is now destroyed)
     87    myclass->setObject(object);                             // the object is now stored in a StrongPtr inside myclass
     88
     89    object->destroy();                                      // we try to destroy object, but there's still a StrongPtr pointing at it.
     90
     91    # object still exists at this point (because a StrongPtr points at it)
     92
     93    delete myclass;                                         // now we delete myclass, which also destroys the StrongPtr
     94
     95    # object doesn't exist anymore (because the StrongPtr is now destroyed)
    9696    @endcode
    9797
     
    100100    MyClass* myclass = new MyClass();                       // create an instance of MyClass
    101101    OtherClass* object = new OtherClass();                  // create an instance of OtherClass
    102     myclass->setObject(object);                             // the object is now stored in a SmartPtr inside myclass
    103 
    104     delete myclass;                                         // we delete myclass, which also destroys the SmartPtr
     102    myclass->setObject(object);                             // the object is now stored in a StrongPtr inside myclass
     103
     104    delete myclass;                                         // we delete myclass, which also destroys the StrongPtr
    105105
    106106    # object still exists at this point (because destroy() was not called yet)
     
    112112
    113113    Note that in any case @c object->destroy() has to be called to delete the object.
    114     However if a SmartPtr points at it, the destruction is delayed until all SmartPtr
     114    However if a StrongPtr points at it, the destruction is delayed until all StrongPtr
    115115    are destroyed.
    116116*/
    117117
    118 #ifndef _SmartPtr_H__
    119 #define _SmartPtr_H__
     118#ifndef _StrongPtr_H__
     119#define _StrongPtr_H__
    120120
    121121#include "core/CorePrereqs.h"
     
    129129{
    130130    /**
    131         @brief A smart pointer which wraps a pointer to an object and keeps this object alive as long as the smart pointer exists.
    132 
    133         @see See @ref SmartPtrExample "this description" for more information and an example.
     131        @brief A strong pointer which wraps a pointer to an object and keeps this object alive as long as the strong pointer exists.
     132
     133        @see See @ref StrongPtrExample "this description" for more information and an example.
    134134    */
    135135    template <class T>
    136     class SmartPtr
     136    class StrongPtr
    137137    {
    138138        public:
    139             /// Constructor: Initializes the smart pointer with a null pointer.
    140             inline SmartPtr() : pointer_(0), base_(0)
    141             {
    142             }
    143 
    144             /// 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)
    145             inline SmartPtr(T* pointer, bool bAddRef = true) : pointer_(pointer), base_(pointer)
     139            /// Constructor: Initializes the strong pointer with a null pointer.
     140            inline StrongPtr() : pointer_(0), base_(0)
     141            {
     142            }
     143
     144            /// 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)
     145            inline StrongPtr(T* pointer, bool bAddRef = true) : pointer_(pointer), base_(pointer)
    146146            {
    147147                if (this->base_ && bAddRef)
     
    150150
    151151            /// Copy-constructor
    152             inline SmartPtr(const SmartPtr& other) : pointer_(other.pointer_), base_(other.base_)
     152            inline StrongPtr(const StrongPtr& other) : pointer_(other.pointer_), base_(other.base_)
    153153            {
    154154                if (this->base_)
     
    156156            }
    157157
    158             /// Copy-constructor for smart pointers to objects of another class.
     158            /// Copy-constructor for strong pointers to objects of another class.
    159159            template <class O>
    160             inline SmartPtr(const SmartPtr<O>& other) : pointer_(other.get()), base_(other.base_)
     160            inline StrongPtr(const StrongPtr<O>& other) : pointer_(other.get()), base_(other.base_)
    161161            {
    162162                if (this->base_)
     
    164164            }
    165165
    166             /// Constructor: Initializes the smart pointer with the pointer that is stored in a WeakPtr.
     166            /// Constructor: Initializes the strong pointer with the pointer that is stored in a WeakPtr.
    167167            template <class O>
    168             inline SmartPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other.getBase())
     168            inline StrongPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other.getBase())
    169169            {
    170170                if (this->base_)
     
    173173
    174174            /// Destructor: Decrements the reference counter.
    175             inline ~SmartPtr()
     175            inline ~StrongPtr()
    176176            {
    177177                if (this->base_)
     
    180180
    181181            /// Assigns a new pointer.
    182             inline SmartPtr& operator=(T* pointer)
    183             {
    184                 SmartPtr(pointer).swap(*this);
     182            inline StrongPtr& operator=(T* pointer)
     183            {
     184                StrongPtr(pointer).swap(*this);
    185185                return *this;
    186186            }
    187187
    188             /// Assigns the wrapped pointer of another SmartPtr.
    189             inline SmartPtr& operator=(const SmartPtr& other)
    190             {
    191                 SmartPtr(other).swap(*this);
     188            /// Assigns the wrapped pointer of another StrongPtr.
     189            inline StrongPtr& operator=(const StrongPtr& other)
     190            {
     191                StrongPtr(other).swap(*this);
    192192                return *this;
    193193            }
    194194
    195             /// Assigns the wrapped pointer of a SmartPtr of another class
     195            /// Assigns the wrapped pointer of a StrongPtr of another class
    196196            template <class O>
    197             inline SmartPtr& operator=(const SmartPtr<O>& other)
    198             {
    199                 SmartPtr(other).swap(*this);
     197            inline StrongPtr& operator=(const StrongPtr<O>& other)
     198            {
     199                StrongPtr(other).swap(*this);
    200200                return *this;
    201201            }
     
    203203            /// Assigns the wrapped pointer of a WeakPtr.
    204204            template <class O>
    205             inline SmartPtr& operator=(const WeakPtr<O>& other)
    206             {
    207                 SmartPtr(other).swap(*this);
     205            inline StrongPtr& operator=(const WeakPtr<O>& other)
     206            {
     207                StrongPtr(other).swap(*this);
    208208                return *this;
    209209            }
     
    221221            }
    222222
    223             /// Implicitly converts the SmartPtr to a pointer of type @c T*
     223            /// Implicitly converts the StrongPtr to a pointer of type @c T*
    224224            inline operator T*() const
    225225            {
     
    247247            }
    248248
    249             /// Swaps the contents of two smart pointers.
    250             inline void swap(SmartPtr& other)
     249            /// Swaps the contents of two strong pointers.
     250            inline void swap(StrongPtr& other)
    251251            {
    252252                {
     
    262262            }
    263263
    264             /// Resets the smart pointer (equivalent to assigning a NULL pointer).
     264            /// Resets the strong pointer (equivalent to assigning a NULL pointer).
    265265            inline void reset()
    266266            {
    267                 SmartPtr().swap(*this);
     267                StrongPtr().swap(*this);
    268268            }
    269269
    270270        private:
    271271            T* pointer_;            ///< The wrapped pointer to an object of type @a T
    272             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)
     272            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)
    273273    };
    274274
    275     /// Swaps the contents of two smart pointers.
     275    /// Swaps the contents of two strong pointers.
    276276    template <class T>
    277     void swap(SmartPtr<T>& a, SmartPtr<T>& b)
     277    void swap(StrongPtr<T>& a, StrongPtr<T>& b)
    278278    {
    279279        a.swap(b);
    280280    }
    281281
    282     /// 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>.
     282    /// 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>.
    283283    template <class T, class U>
    284     SmartPtr<T> static_pointer_cast(const SmartPtr<U>& p)
     284    StrongPtr<T> static_pointer_cast(const StrongPtr<U>& p)
    285285    {
    286286        return static_cast<T*>(p.get());
    287287    }
    288288
    289     /// 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>.
     289    /// 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>.
    290290    template <class T, class U>
    291     SmartPtr<T> const_pointer_cast(const SmartPtr<U>& p)
     291    StrongPtr<T> const_pointer_cast(const StrongPtr<U>& p)
    292292    {
    293293        return const_cast<T*>(p.get());
    294294    }
    295295
    296     /// 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>.
     296    /// 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>.
    297297    template <class T, class U>
    298     SmartPtr<T> dynamic_pointer_cast(const SmartPtr<U>& p)
     298    StrongPtr<T> dynamic_pointer_cast(const StrongPtr<U>& p)
    299299    {
    300300        return orxonox_cast<T*>(p.get());
     
    302302}
    303303
    304 #endif /* _SmartPtr_H__ */
     304#endif /* _StrongPtr_H__ */
  • code/branches/core7/src/libraries/network/synchronisable/Serialise.h

    r9667 r10555  
    7878    }
    7979
    80     // These functions implement loading / saving / etc. for SmartPtr<T>
     80    // These functions implement loading / saving / etc. for StrongPtr<T>
    8181
    8282    /** @brief returns the size of the objectID needed to synchronise the pointer */
    83     template <class T> inline uint32_t returnSize( const SmartPtr<T>& )
     83    template <class T> inline uint32_t returnSize( const StrongPtr<T>& )
    8484    {
    8585        return sizeof(uint32_t);
     
    8787
    8888    /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */
    89     template <class T> inline void loadAndIncrease( const SmartPtr<T>& variable, uint8_t*& mem )
     89    template <class T> inline void loadAndIncrease( const StrongPtr<T>& variable, uint8_t*& mem )
    9090    {
    9191//         *const_cast<typename Loki::TypeTraits<T*>::UnqualifiedType*>(&variable) = dynamic_cast<T*>(variable->getSynchronisable( *(uint32_t*)(mem) ));
    92         *const_cast<typename Loki::TypeTraits<SmartPtr<T> >::UnqualifiedType*>(&variable) = orxonox_cast<T*>(T::getSynchronisable(*(uint32_t*)(mem)));
     92        *const_cast<typename Loki::TypeTraits<StrongPtr<T> >::UnqualifiedType*>(&variable) = orxonox_cast<T*>(T::getSynchronisable(*(uint32_t*)(mem)));
    9393        mem += returnSize( variable );
    9494    }
    9595
    9696    /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */
    97     template <class T> inline void saveAndIncrease( const SmartPtr<T>& variable, uint8_t*& mem )
     97    template <class T> inline void saveAndIncrease( const StrongPtr<T>& variable, uint8_t*& mem )
    9898    {
    9999        if ( variable.get() )
     
    105105
    106106    /** @brief checks whether the objectID of the variable is the same as in the bytestream */
    107     template <class T> inline  bool checkEquality( const SmartPtr<T>& variable, uint8_t* mem )
     107    template <class T> inline  bool checkEquality( const StrongPtr<T>& variable, uint8_t* mem )
    108108    {
    109109        if ( variable.get() )
     
    125125    {
    126126        //         *const_cast<typename Loki::TypeTraits<T*>::UnqualifiedType*>(&variable) = dynamic_cast<T*>(variable->getSynchronisable( *(uint32_t*)(mem) ));
    127         *const_cast<typename Loki::TypeTraits<SmartPtr<T> >::UnqualifiedType*>(&variable) = orxonox_cast<T*>(T::getSynchronisable(*(uint32_t*)(mem)));
     127        *const_cast<typename Loki::TypeTraits<StrongPtr<T> >::UnqualifiedType*>(&variable) = orxonox_cast<T*>(T::getSynchronisable(*(uint32_t*)(mem)));
    128128        mem += returnSize( variable );
    129129    }
  • code/branches/core7/src/modules/overlays/hud/HUDHealthBar.h

    r9667 r10555  
    115115        private:
    116116            WeakPtr<Pawn> owner_;
    117             SmartPtr<OverlayText> textoverlay_;
     117            StrongPtr<OverlayText> textoverlay_;
    118118            bool bUseBarColour_;
    119119            ColourValue textColour_;
  • code/branches/core7/src/modules/pickup/PickupSpawner.cc

    r9667 r10555  
    145145        if(GameMode::isMaster() && this->isActive())
    146146        {
    147             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)
     147            // TODO: why is this a WeakPtr when the comment says StrongPtr?
     148            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)
    148149
    149150            // Remove PickupCarriers from the blocked list if they have exceeded their time.
  • code/branches/core7/src/modules/pickup/items/ShrinkPickup.cc

    r9667 r10555  
    182182
    183183                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    184                 const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     184                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
    185185                int size = cameraPositions.size();
    186186                for(int index = 0; index < size; index++)
     
    208208
    209209                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    210                 const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     210                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
    211211                int size = cameraPositions.size();
    212212                for(int index = 0; index < size; index++)
     
    263263
    264264                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    265                 const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     265                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
    266266                int size = cameraPositions.size();
    267267                for(int index = 0; index < size; index++)
     
    304304
    305305                // Iterate over all camera positions and inversely move the camera to create a shrinking sensation.
    306                 const std::list< SmartPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
     306                const std::list< StrongPtr<CameraPosition> >& cameraPositions = pawn->getCameraPositions();
    307307                int size = cameraPositions.size();
    308308                for(int index = 0; index < size; index++)
  • code/branches/core7/src/modules/tetris/Tetris.cc

    r9834 r10555  
    104104        }
    105105
    106         for (std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
     106        for (std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
    107107            (*it)->destroy();
    108108        this->stones_.clear();
     
    136136            return false;
    137137
    138         for(std::list<SmartPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
     138        for(std::list<StrongPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
    139139        {
    140140            const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
     
    192192
    193193        // check for collisions with all stones
    194         for(std::list<SmartPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
     194        for(std::list<StrongPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
    195195        {
    196196            //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount());
     
    469469        {
    470470            stonesPerRow = 0;
    471             for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
    472             {
    473                 std::list<SmartPtr<TetrisStone> >::iterator it_temp = it++;
     471            for(std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
     472            {
     473                std::list<StrongPtr<TetrisStone> >::iterator it_temp = it++;
    474474                correctPosition = static_cast<unsigned int>(((*it_temp)->getPosition().y - 5)/this->center_->getStoneSize());
    475475                if(correctPosition == row)
     
    491491    void Tetris::clearRow(unsigned int row)
    492492    {// clear the full row
    493         for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
     493        for(std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); )
    494494        {
    495495            if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row)
     
    502502        }
    503503      // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug.
    504         for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
     504        for(std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
    505505        {
    506506            if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) > row)
  • code/branches/core7/src/modules/tetris/Tetris.h

    r9833 r10555  
    9494
    9595            WeakPtr<TetrisCenterpoint> center_; //!< The playing field.
    96             std::list<SmartPtr<TetrisStone> > stones_; //!< A list of all stones in play.
     96            std::list<StrongPtr<TetrisStone> > stones_; //!< A list of all stones in play.
    9797            WeakPtr<TetrisBrick> activeBrick_;
    9898            WeakPtr<TetrisBrick> futureBrick_;
  • code/branches/core7/src/orxonox/Scene.cc

    r10415 r10555  
    6262        RegisterObject(Scene);
    6363
    64         this->setScene(SmartPtr<Scene>(this, false), OBJECTID_UNKNOWN);
     64        this->setScene(StrongPtr<Scene>(this, false), OBJECTID_UNKNOWN);
    6565        this->bShadows_ = true;
    6666        this->bDebugDrawPhysics_ = false;
     
    366366    {
    367367        // get the WorldEntity pointers
    368         SmartPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
    369         SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
     368        StrongPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
     369        StrongPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
    370370
    371371        // get the CollisionShape pointers
  • code/branches/core7/src/orxonox/gametypes/Gametype.cc

    r10554 r10555  
    6161        RegisterObject(Gametype);
    6262
    63         this->setGametype(SmartPtr<Gametype>(this, false));
     63        this->setGametype(StrongPtr<Gametype>(this, false));
    6464
    6565        this->gtinfo_ = new GametypeInfo(context);
  • code/branches/core7/src/orxonox/interfaces/RadarViewable.h

    r9939 r10555  
    3737#include "util/Math.h"
    3838#include "core/class/OrxonoxInterface.h"
    39 #include "core/object/SmartPtr.h"
     39#include "core/object/StrongPtr.h"
    4040
    4141namespace orxonox
     
    163163        //Radar
    164164        const WorldEntity* wePtr_;
    165         SmartPtr<Radar> radar_;
     165        StrongPtr<Radar> radar_;
    166166        float radarObjectCamouflage_;
    167167        Shape radarObjectShape_;
  • code/branches/core7/src/orxonox/overlays/OverlayGroup.cc

    r10347 r10555  
    6161    OverlayGroup::~OverlayGroup()
    6262    {
    63         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     63        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    6464            (*it)->destroy();
    6565        this->hudElements_.clear();
     
    8585    void OverlayGroup::setScale(const Vector2& scale)
    8686    {
    87         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     87        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    8888            (*it)->scale(scale / this->scale_);
    8989        this->scale_ = scale;
     
    9393    void OverlayGroup::setScroll(const Vector2& scroll)
    9494    {
    95         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     95        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    9696            (*it)->scroll(scroll - this->scroll_);
    9797        this->scroll_ = scroll;
     
    106106    void OverlayGroup::addElement(OrxonoxOverlay* element)
    107107    {
    108         hudElements_.insert(SmartPtr<OrxonoxOverlay>(element));
     108        hudElements_.insert(StrongPtr<OrxonoxOverlay>(element));
    109109        element->setOverlayGroup( this );
    110110        if (this->owner_)
     
    122122    bool OverlayGroup::removeElement(OrxonoxOverlay* element)
    123123    {
    124         if(this->hudElements_.erase(SmartPtr<OrxonoxOverlay>(element)) == 0)
     124        if(this->hudElements_.erase(StrongPtr<OrxonoxOverlay>(element)) == 0)
    125125            return false;
    126126        return true;
     
    132132        if (index < this->hudElements_.size())
    133133        {
    134             std::set< SmartPtr<OrxonoxOverlay> >::const_iterator it = hudElements_.begin();
     134            std::set< StrongPtr<OrxonoxOverlay> >::const_iterator it = hudElements_.begin();
    135135            for (unsigned int i = 0; i != index; ++it, ++i)
    136136                ;
     
    146146        SUPER( OverlayGroup, changedVisibility );
    147147
    148         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     148        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    149149            (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
    150150    }
     
    155155        SUPER( OverlayGroup, changedGametype );
    156156
    157         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     157        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    158158            (*it)->setGametype(this->getGametype());
    159159    }
     
    163163        this->owner_ = owner;
    164164
    165         for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
     165        for (std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
    166166            (*it)->setOwner(owner);
    167167    }
  • code/branches/core7/src/orxonox/overlays/OverlayGroup.h

    r9667 r10555  
    6565        static void scrollGroup(const std::string& name, const Vector2& scroll);
    6666
    67         inline const std::set< SmartPtr<OrxonoxOverlay> >& getOverlays() const
     67        inline const std::set< StrongPtr<OrxonoxOverlay> >& getOverlays() const
    6868            { return this->hudElements_; }
    6969
     
    9292
    9393    private:
    94         std::set< SmartPtr<OrxonoxOverlay> > hudElements_;    //!< Contains all the OrxonoxOverlays of the this group.
     94        std::set< StrongPtr<OrxonoxOverlay> > hudElements_;    //!< Contains all the OrxonoxOverlays of the this group.
    9595        Vector2 scale_;                            //!< Current scale (independent of the elements).
    9696        Vector2 scroll_;                           //!< Current scrolling offset.
  • code/branches/core7/src/orxonox/sound/AmbientSound.cc

    r10380 r10555  
    5151        if (GameMode::playsSound())
    5252        {
    53             // Smoothly fade out by keeping a SmartPtr
     53            // Smoothly fade out by keeping a StrongPtr
    5454            SoundManager::getInstance().unregisterAmbientSound(this);
    5555        }
  • code/branches/core7/src/orxonox/sound/SoundBuffer.h

    r6764 r10555  
    4646        friend class SoundManager;
    4747#if !defined(_MSC_VER) || _MSC_VER >= 1500
    48         // Make sure nobody deletes an instance (using smart pointers)
     48        // Make sure nobody deletes an instance (using strong pointers)
    4949        template <class T>
    5050        friend void boost::checked_delete(T*);
  • code/branches/core7/src/orxonox/sound/SoundManager.cc

    r10464 r10555  
    165165    SoundManager::~SoundManager()
    166166    {
    167         // Erase fade lists because of the smart pointers
     167        // Erase fade lists because of the strong pointers
    168168        this->bDestructorCalled_ = true;
    169169        this->fadeInList_.clear();
     
    419419    }
    420420
    421     void SoundManager::fadeIn(const SmartPtr<AmbientSound>& sound)
     421    void SoundManager::fadeIn(const StrongPtr<AmbientSound>& sound)
    422422    {
    423423        // If we're already fading out --> remove that
    424         for (std::list<SmartPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++)
     424        for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++)
    425425        {
    426426            if (*it == sound)
     
    435435    }
    436436
    437     void SoundManager::fadeOut(const SmartPtr<AmbientSound>& sound)
     437    void SoundManager::fadeOut(const StrongPtr<AmbientSound>& sound)
    438438    {
    439439        // If we're already fading in --> remove that
    440         for (std::list<SmartPtr<AmbientSound> >::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++)
     440        for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++)
    441441        {
    442442            if (*it == sound)
     
    461461
    462462        // FADE IN
    463         for (std::list<SmartPtr<AmbientSound> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); )
     463        for (std::list<StrongPtr<AmbientSound> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); )
    464464        {
    465465            if ((*it)->getVolume() + this->crossFadeStep_*dt > 1.0f)
     
    476476
    477477        // FADE OUT
    478         for (std::list<SmartPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); )
     478        for (std::list<StrongPtr<AmbientSound> >::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); )
    479479        {
    480480            if ((*it)->getVolume() - this->crossFadeStep_*dt < 0.0f)
  • code/branches/core7/src/orxonox/sound/SoundManager.h

    r10413 r10555  
    4040#include "util/Singleton.h"
    4141#include "core/config/Configurable.h"
    42 #include "core/object/SmartPtr.h"
     42#include "core/object/StrongPtr.h"
    4343#include "core/UpdateListener.h"
    4444
     
    106106    private:
    107107        void processCrossFading(float dt);
    108         void fadeIn(const SmartPtr<AmbientSound>& sound);
    109         void fadeOut(const SmartPtr<AmbientSound>& sound);
     108        void fadeIn(const StrongPtr<AmbientSound>& sound);
     109        void fadeOut(const StrongPtr<AmbientSound>& sound);
    110110
    111111        void checkFadeStepValidity();
     
    129129        //! Absolute change per second (0.1 means 10% of the nominal volume) for cross fading
    130130        float                              crossFadeStep_;
    131         std::list<SmartPtr<AmbientSound> > fadeInList_;
    132         std::list<SmartPtr<AmbientSound> > fadeOutList_;
     131        std::list<StrongPtr<AmbientSound> > fadeInList_;
     132        std::list<StrongPtr<AmbientSound> > fadeOutList_;
    133133
    134134        // Volume related
  • code/branches/core7/src/orxonox/worldentities/ControllableEntity.cc

    r10478 r10555  
    108108                this->camera_->destroy();
    109109
    110             for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     110            for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    111111                (*it)->destroy();
    112112
     
    165165    {
    166166        unsigned int i = 0;
    167         for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     167        for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    168168        {
    169169            if (i == index)
     
    180180
    181181        unsigned int counter = 0;
    182         for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     182        for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    183183        {
    184184            if ((*it) == this->currentCameraPosition_)
     
    219219            else if (this->cameraPositions_.size() > 0)
    220220            {
    221                 for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     221                for (std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    222222                {
    223223                    if ((*it) == this->camera_->getParent())
     
    477477        if (parent)
    478478        {
    479             for (std::list<SmartPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
     479            for (std::list<StrongPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
    480480                if ((*it)->getIsAbsolute())
    481481                    parent->attach((*it));
  • code/branches/core7/src/orxonox/worldentities/ControllableEntity.h

    r9667 r10555  
    114114            void addCameraPosition(CameraPosition* position);
    115115            CameraPosition* getCameraPosition(unsigned int index) const;
    116             inline const std::list<SmartPtr<CameraPosition> >& getCameraPositions() const
     116            inline const std::list<StrongPtr<CameraPosition> >& getCameraPositions() const
    117117                { return this->cameraPositions_; }
    118118            unsigned int getCurrentCameraIndex() const;
     
    235235            bool bMouseLook_;
    236236            float mouseLookSpeed_;
    237             std::list<SmartPtr<CameraPosition> > cameraPositions_;
     237            std::list<StrongPtr<CameraPosition> > cameraPositions_;
    238238            CameraPosition* currentCameraPosition_;
    239239            std::string cameraPositionTemplate_;
  • code/branches/core7/src/orxonox/worldentities/WorldEntity.cc

    r10362 r10555  
    130130                WorldEntity* entity = *it;
    131131
    132                 // do this for all children, because even if getDeleteWithParent() returns true a child might still stay active due to smart pointers pointing to it
     132                // do this for all children, because even if getDeleteWithParent() returns true a child might still stay active due to strong pointers pointing to it
    133133                entity->setPosition(entity->getWorldPosition());
    134134                this->detach(entity); // detach also erases the element from the children set
  • code/branches/core7/test/core/CMakeLists.txt

    r10407 r10555  
    2626    object/ObjectListBaseTest.cc
    2727    object/ObjectListIteratorTest.cc
    28     object/SmartPtrTest.cc
     28    object/StrongPtrTest.cc
    2929    object/WeakPtrTest.cc
    3030    singleton/ScopeTest.cc
  • code/branches/core7/test/core/object/StrongPtrTest.cc

    r10553 r10555  
    11#include <gtest/gtest.h>
    2 #include "core/object/SmartPtr.h"
     2#include "core/object/StrongPtr.h"
    33
    44namespace orxonox
     
    1717    }
    1818
    19     TEST(SmartPtrTest, CanReferenceObject)
     19    TEST(StrongPtrTest, CanReferenceObject)
    2020    {
    2121        bool bla;
    2222        DestroyableTest* test = new DestroyableTest(bla);
    23         SmartPtr<DestroyableTest> smartPtr = test;
    24         EXPECT_EQ(test, smartPtr.get());
     23        StrongPtr<DestroyableTest> strongPtr = test;
     24        EXPECT_EQ(test, strongPtr.get());
    2525        test->destroy();
    2626    }
    2727
    28     TEST(SmartPtrTest, IncreasesReferenceCount)
     28    TEST(StrongPtrTest, IncreasesReferenceCount)
    2929    {
    3030        bool bla;
     
    3232        EXPECT_EQ(0u, test->getReferenceCount());
    3333        {
    34             SmartPtr<DestroyableTest> smartPtr = test;
     34            StrongPtr<DestroyableTest> strongPtr = test;
    3535            EXPECT_EQ(1u, test->getReferenceCount());
    3636        }
     
    3939    }
    4040
    41     TEST(SmartPtrTest, DestroyDeletesInstance)
     41    TEST(StrongPtrTest, DestroyDeletesInstance)
    4242    {
    4343        bool destroyed = false;
     
    4848    }
    4949
    50     TEST(SmartPtrTest, PreventsDestruction)
     50    TEST(StrongPtrTest, PreventsDestruction)
    5151    {
    5252        bool destroyed = false;
    5353        DestroyableTest* test = new DestroyableTest(destroyed);
    5454        EXPECT_FALSE(destroyed);
    55         SmartPtr<DestroyableTest> smartPtr = test;
     55        StrongPtr<DestroyableTest> strongPtr = test;
    5656        test->destroy();
    5757        EXPECT_FALSE(destroyed);
    5858    }
    5959
    60     TEST(SmartPtrTest, DestroysIfSmartPtrRemoved)
     60    TEST(StrongPtrTest, DestroysIfStrongPtrRemoved)
    6161    {
    6262        bool destroyed = false;
     
    6464        EXPECT_FALSE(destroyed);
    6565        {
    66             SmartPtr<DestroyableTest> smartPtr = test;
     66            StrongPtr<DestroyableTest> strongPtr = test;
    6767            test->destroy();
    6868            EXPECT_FALSE(destroyed);
     
    7171    }
    7272
    73     TEST(SmartPtrTest, DestroysIfAllSmartPtrsRemoved)
     73    TEST(StrongPtrTest, DestroysIfAllStrongPtrsRemoved)
    7474    {
    7575        bool destroyed = false;
     
    7777        EXPECT_FALSE(destroyed);
    7878        {
    79             SmartPtr<DestroyableTest> smartPtr1 = test;
     79            StrongPtr<DestroyableTest> strongPtr1 = test;
    8080            {
    81                 SmartPtr<DestroyableTest> smartPtr2 = test;
     81                StrongPtr<DestroyableTest> strongPtr2 = test;
    8282                {
    83                     SmartPtr<DestroyableTest> smartPtr3 = test;
     83                    StrongPtr<DestroyableTest> strongPtr3 = test;
    8484                    test->destroy();
    8585                    EXPECT_FALSE(destroyed);
     
    9292    }
    9393
    94     void isNull(const SmartPtr<DestroyableTest> smartPtr)
     94    void isNull(const StrongPtr<DestroyableTest> strongPtr)
    9595    {
    96         EXPECT_TRUE(smartPtr == NULL);
    97         EXPECT_TRUE(smartPtr == 0);
    98         EXPECT_TRUE(!smartPtr);
    99         EXPECT_FALSE(smartPtr != NULL);
    100         EXPECT_FALSE(smartPtr != 0);
    101         EXPECT_FALSE(smartPtr);
     96        EXPECT_TRUE(strongPtr == NULL);
     97        EXPECT_TRUE(strongPtr == 0);
     98        EXPECT_TRUE(!strongPtr);
     99        EXPECT_FALSE(strongPtr != NULL);
     100        EXPECT_FALSE(strongPtr != 0);
     101        EXPECT_FALSE(strongPtr);
    102102    }
    103103
    104     TEST(SmartPtrTest, IsNull)
     104    TEST(StrongPtrTest, IsNull)
    105105    {
    106106        {
    107             SmartPtr<DestroyableTest> smartPtr;
    108             isNull(smartPtr);
     107            StrongPtr<DestroyableTest> strongPtr;
     108            isNull(strongPtr);
    109109        }
    110110        {
    111             SmartPtr<DestroyableTest> smartPtr = NULL;
    112             isNull(smartPtr);
     111            StrongPtr<DestroyableTest> strongPtr = NULL;
     112            isNull(strongPtr);
    113113        }
    114114        {
    115             SmartPtr<DestroyableTest> smartPtr;
    116             smartPtr = NULL;
    117             isNull(smartPtr);
     115            StrongPtr<DestroyableTest> strongPtr;
     116            strongPtr = NULL;
     117            isNull(strongPtr);
    118118        }
    119119        {
    120             SmartPtr<DestroyableTest> smartPtr = 0;
    121             isNull(smartPtr);
     120            StrongPtr<DestroyableTest> strongPtr = 0;
     121            isNull(strongPtr);
    122122        }
    123123        {
    124             SmartPtr<DestroyableTest> smartPtr;
    125             smartPtr = 0;
    126             isNull(smartPtr);
     124            StrongPtr<DestroyableTest> strongPtr;
     125            strongPtr = 0;
     126            isNull(strongPtr);
    127127        }
    128128    }
    129129
    130     TEST(SmartPtrTest, IsNotNull)
     130    TEST(StrongPtrTest, IsNotNull)
    131131    {
    132132        bool destroyed = false;
    133133        DestroyableTest* test = new DestroyableTest(destroyed);
    134         SmartPtr<DestroyableTest> smartPtr = test;
    135         EXPECT_FALSE(smartPtr == NULL);
    136         EXPECT_FALSE(smartPtr == 0);
    137         EXPECT_FALSE(!smartPtr);
    138         EXPECT_TRUE(smartPtr != NULL);
    139         EXPECT_TRUE(smartPtr != 0);
    140         EXPECT_TRUE(smartPtr);
     134        StrongPtr<DestroyableTest> strongPtr = test;
     135        EXPECT_FALSE(strongPtr == NULL);
     136        EXPECT_FALSE(strongPtr == 0);
     137        EXPECT_FALSE(!strongPtr);
     138        EXPECT_TRUE(strongPtr != NULL);
     139        EXPECT_TRUE(strongPtr != 0);
     140        EXPECT_TRUE(strongPtr);
    141141        test->destroy();
    142142    }
Note: See TracChangeset for help on using the changeset viewer.