Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 21, 2010, 4:54:29 PM (14 years ago)
Author:
landauf
Message:

Changed implementation of SharedPtr, it's now non-intrusive and uses an allocated counter instead. Hence it's possible to create an instance of SharedPtr<T> even if T is only known from a forward declaration. Also changed some parts of the code to reflect the inheritance of the underlying object pointers without using inheritance in the SharedPtr itself.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/Executor.h

    r7192 r7196  
    3636#include "util/MultiType.h"
    3737#include "Functor.h"
     38#include "ExecutorPtr.h"
    3839
    3940namespace orxonox
     
    112113
    113114        private:
    114             inline void incrementReferenceCount()
    115                 { ++this->references_; }
    116             inline void decrementReferenceCount()
    117                 { --this->references_; if (this->references_ == 0) delete this; }
    118 
    119             int references_;
    120115            static int instances_s;
    121116    };
     
    198193    };
    199194
    200 
    201 
    202     typedef SharedPtr<Executor> ExecutorPtr;
    203 
    204     typedef SharedChildPtr<ExecutorStatic, Executor> ExecutorStaticPtr;
    205 
    206     template <class T>
    207     class ExecutorMemberPtr : public SharedChildPtr<ExecutorMember<T>, Executor>
    208     {
    209         public:
    210             inline ExecutorMemberPtr() : SharedChildPtr<ExecutorMember<T>, Executor>() {}
    211             inline ExecutorMemberPtr(ExecutorMember<T>* pointer) : SharedChildPtr<ExecutorMember<T>, Executor>(pointer) {}
    212 //            inline ExecutorMemberPtr(const ExecutorMemberPtr& other) : SharedChildPtr<ExecutorMember<T>, Executor>(other) {}
    213     };
    214 
    215 
    216 
    217195    inline Executor* createExecutor(Functor* functor, const std::string& name = "")
    218196    {
Note: See TracChangeset for help on using the changeset viewer.