Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7201 for code/branches


Ignore:
Timestamp:
Aug 22, 2010, 12:48:55 AM (14 years ago)
Author:
landauf
Message:

some cleanup in SharedPtr and its relatives

Location:
code/branches/consolecommands3/src/libraries/core
Files:
5 edited

Legend:

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

    r7200 r7201  
    3939namespace orxonox
    4040{
    41     int Functor::instances_s = 0;
    42     int Executor::instances_s = 0;
    43 
    4441    Executor::Executor(const FunctorPtr& functor, const std::string& name)
    4542    {
    4643        this->functor_ = functor;
    4744        this->name_ = name;
    48         ++instances_s; COUT(0) << "executor ++: " << instances_s << std::endl;
    4945    }
    5046
    5147    Executor::~Executor()
    5248    {
    53         --instances_s; COUT(0) << "executor --: " << instances_s << std::endl;
    5449    }
    5550
  • code/branches/consolecommands3/src/libraries/core/Executor.h

    r7200 r7201  
    109109            std::string name_;
    110110            MultiType defaultValue_[MAX_FUNCTOR_ARGUMENTS];
    111 
    112         private:
    113             static int instances_s;
    114111    };
    115112
  • code/branches/consolecommands3/src/libraries/core/Functor.h

    r7198 r7201  
    102102
    103103        public:
    104             Functor() { ++instances_s; COUT(0) << "functor ++: " << instances_s << std::endl; }
    105             virtual ~Functor() { --instances_s; COUT(0) << "functor --: " << instances_s << std::endl; }
     104            Functor() {}
     105            virtual ~Functor() {}
    106106
    107107            virtual MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
     
    120120
    121121            virtual const std::type_info& getHeaderIdentifier() const = 0;
    122 
    123         private:
    124             static int instances_s;
    125122    };
    126123
  • code/branches/consolecommands3/src/libraries/core/FunctorPtr.h

    r7197 r7201  
    4545            inline FunctorMemberPtr() : SharedChildPtr<FunctorMember<T>, FunctorPtr>() {}
    4646            inline FunctorMemberPtr(FunctorMember<T>* pointer) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(pointer) {}
    47 //            inline FunctorMemberPtr(const FunctorMemberPtr& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
    48 //            template <class O>
    49 //            inline FunctorMemberPtr(const SharedPtr<O>& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
    50 //            template <class O>
    51 //            inline FunctorMemberPtr(const SharedChildPtr<O, FunctorMember<T> >& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
    5247            inline FunctorMemberPtr(const SharedPtr<FunctorMember<T> >& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
    53 
    54 /*
    55             inline const FunctorMemberPtr& operator=(const FunctorMemberPtr& other) { this->SharedChildPtr<FunctorMember<T>, FunctorPtr>::operator=(other); return *this; }
    56             template <class O>
    57             inline const FunctorMemberPtr& operator=(const SharedPtr<O>& other) { this->SharedChildPtr<FunctorMember<T>, FunctorPtr>::operator=(other); return *this; }
    58 */
    59         private:
    60 //            inline FunctorMemberPtr(FunctorMember<T>* pointer, int* counter) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(pointer, counter) {}
    6148    };
    62 /*
    63     typedef SharedChildPtr<FunctorStatic, Functor> FunctorStaticPtr;
    64 
    65     template <class T>
    66     class FunctorMemberPtr : public SharedChildPtr<FunctorMember<T>, Functor>
    67     {
    68         public:
    69             inline FunctorMemberPtr() : SharedChildPtr<FunctorMember<T>, Functor>() {}
    70             inline FunctorMemberPtr(FunctorMember<T>* pointer) : SharedChildPtr<FunctorMember<T>, Functor>(pointer) {}
    71     };
    72 */
    7349}
    7450
  • code/branches/consolecommands3/src/libraries/core/SharedPtr.h

    r7197 r7201  
    5050            void destroy()
    5151            {
    52 //                COUT(0) << "delete " << this->pointer_ << std::endl;
    5352                delete this->pointer_;
    5453            }
     
    6766            inline SharedPtr() : pointer_(0), counter_(0), destroyer_(0)
    6867            {
    69 //                COUT(0) << "SharedPtr (1): " << this->pointer_ << std::endl;
    7068            }
    7169
    7270            inline SharedPtr(T* pointer) : pointer_(pointer), counter_(0), destroyer_(0)
    7371            {
    74 //                COUT(0) << "SharedPtr (2): " << this->pointer_ << std::endl;
    7572                if (this->pointer_)
    7673                {
     
    8279            inline SharedPtr(const SharedPtr& other) : pointer_(other.pointer_), counter_(other.counter_), destroyer_(other.destroyer_)
    8380            {
    84 //                COUT(0) << "SharedPtr (3): " << this->pointer_ << std::endl;
    8581                if (this->pointer_)
    8682                    ++(*this->counter_);
     
    9086            inline SharedPtr(const SharedPtr<O>& other) : pointer_(other.pointer_), counter_(other.counter_), destroyer_(other.destroyer_)
    9187            {
    92 //                COUT(0) << "SharedPtr (4): " << this->pointer_ << std::endl;
    9388                if (this->pointer_)
    9489                    ++(*this->counter_);
     
    9792            inline ~SharedPtr()
    9893            {
    99 //                COUT(0) << "~SharedPtr: " << this->pointer_ << std::endl;
    10094                if (this->pointer_)
    10195                {
     
    113107            inline const SharedPtr& operator=(const SharedPtr& other)
    114108            {
    115 //                COUT(0) << "SharedPtr= (1)" << std::endl;
    116109                SharedPtr(other).swap(*this);
    117110                return *this;
     
    121114            inline const SharedPtr& operator=(const SharedPtr<O>& other)
    122115            {
    123 //                COUT(0) << "SharedPtr= (2)" << std::endl;
    124116                SharedPtr(other).swap(*this);
    125117                return *this;
     
    160152            inline SharedPtr(T* pointer, int* counter, SharedPtrDestroyer* destroyer) : pointer_(pointer), counter_(counter), destroyer_(destroyer)
    161153            {
    162 //                COUT(0) << "SharedPtr (5): " << this->pointer_ << std::endl;
    163154                if (this->pointer_)
    164155                    ++(*this->counter_);
     
    176167            inline SharedChildPtr() : Parent() {}
    177168            inline SharedChildPtr(T* pointer) : Parent(pointer) {}
    178 //            inline SharedChildPtr(const SharedChildPtr& other) : Parent(other) {}
    179 //            template <class O>
    180 //            inline SharedChildPtr(const SharedChildPtr<O, T>& other) : Parent(other) {}
    181169            inline SharedChildPtr(const SharedPtr<T>& other) : Parent(other) {}
    182 
    183 //            inline const SharedChildPtr& operator=(const SharedChildPtr& other) { Parent::operator=(other); return *this; }
    184170
    185171            inline T* operator->() const { return static_cast<T*>(Parent::operator->()); }
Note: See TracChangeset for help on using the changeset viewer.