[Orxonox-commit 2494] r7201 - code/branches/consolecommands3/src/libraries/core
landauf at orxonox.net
landauf at orxonox.net
Sun Aug 22 00:48:55 CEST 2010
Author: landauf
Date: 2010-08-22 00:48:55 +0200 (Sun, 22 Aug 2010)
New Revision: 7201
Modified:
code/branches/consolecommands3/src/libraries/core/Executor.cc
code/branches/consolecommands3/src/libraries/core/Executor.h
code/branches/consolecommands3/src/libraries/core/Functor.h
code/branches/consolecommands3/src/libraries/core/FunctorPtr.h
code/branches/consolecommands3/src/libraries/core/SharedPtr.h
Log:
some cleanup in SharedPtr and its relatives
Modified: code/branches/consolecommands3/src/libraries/core/Executor.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/Executor.cc 2010-08-21 22:27:53 UTC (rev 7200)
+++ code/branches/consolecommands3/src/libraries/core/Executor.cc 2010-08-21 22:48:55 UTC (rev 7201)
@@ -38,19 +38,14 @@
namespace orxonox
{
- int Functor::instances_s = 0;
- int Executor::instances_s = 0;
-
Executor::Executor(const FunctorPtr& functor, const std::string& name)
{
this->functor_ = functor;
this->name_ = name;
- ++instances_s; COUT(0) << "executor ++: " << instances_s << std::endl;
}
Executor::~Executor()
{
- --instances_s; COUT(0) << "executor --: " << instances_s << std::endl;
}
MultiType Executor::parse(const std::string& params, bool* success, const std::string& delimiter) const
Modified: code/branches/consolecommands3/src/libraries/core/Executor.h
===================================================================
--- code/branches/consolecommands3/src/libraries/core/Executor.h 2010-08-21 22:27:53 UTC (rev 7200)
+++ code/branches/consolecommands3/src/libraries/core/Executor.h 2010-08-21 22:48:55 UTC (rev 7201)
@@ -108,9 +108,6 @@
FunctorPtr functor_;
std::string name_;
MultiType defaultValue_[MAX_FUNCTOR_ARGUMENTS];
-
- private:
- static int instances_s;
};
class _CoreExport ExecutorStatic : public Executor
Modified: code/branches/consolecommands3/src/libraries/core/Functor.h
===================================================================
--- code/branches/consolecommands3/src/libraries/core/Functor.h 2010-08-21 22:27:53 UTC (rev 7200)
+++ code/branches/consolecommands3/src/libraries/core/Functor.h 2010-08-21 22:48:55 UTC (rev 7201)
@@ -101,8 +101,8 @@
};
public:
- Functor() { ++instances_s; COUT(0) << "functor ++: " << instances_s << std::endl; }
- virtual ~Functor() { --instances_s; COUT(0) << "functor --: " << instances_s << std::endl; }
+ Functor() {}
+ virtual ~Functor() {}
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;
@@ -119,9 +119,6 @@
virtual void* getRawObjectPointer() const { return 0; }
virtual const std::type_info& getHeaderIdentifier() const = 0;
-
- private:
- static int instances_s;
};
class _CoreExport FunctorStatic : public Functor
Modified: code/branches/consolecommands3/src/libraries/core/FunctorPtr.h
===================================================================
--- code/branches/consolecommands3/src/libraries/core/FunctorPtr.h 2010-08-21 22:27:53 UTC (rev 7200)
+++ code/branches/consolecommands3/src/libraries/core/FunctorPtr.h 2010-08-21 22:48:55 UTC (rev 7201)
@@ -44,32 +44,8 @@
public:
inline FunctorMemberPtr() : SharedChildPtr<FunctorMember<T>, FunctorPtr>() {}
inline FunctorMemberPtr(FunctorMember<T>* pointer) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(pointer) {}
-// inline FunctorMemberPtr(const FunctorMemberPtr& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
-// template <class O>
-// inline FunctorMemberPtr(const SharedPtr<O>& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
-// template <class O>
-// inline FunctorMemberPtr(const SharedChildPtr<O, FunctorMember<T> >& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
inline FunctorMemberPtr(const SharedPtr<FunctorMember<T> >& other) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(other) {}
-
-/*
- inline const FunctorMemberPtr& operator=(const FunctorMemberPtr& other) { this->SharedChildPtr<FunctorMember<T>, FunctorPtr>::operator=(other); return *this; }
- template <class O>
- inline const FunctorMemberPtr& operator=(const SharedPtr<O>& other) { this->SharedChildPtr<FunctorMember<T>, FunctorPtr>::operator=(other); return *this; }
-*/
- private:
-// inline FunctorMemberPtr(FunctorMember<T>* pointer, int* counter) : SharedChildPtr<FunctorMember<T>, FunctorPtr>(pointer, counter) {}
};
-/*
- typedef SharedChildPtr<FunctorStatic, Functor> FunctorStaticPtr;
-
- template <class T>
- class FunctorMemberPtr : public SharedChildPtr<FunctorMember<T>, Functor>
- {
- public:
- inline FunctorMemberPtr() : SharedChildPtr<FunctorMember<T>, Functor>() {}
- inline FunctorMemberPtr(FunctorMember<T>* pointer) : SharedChildPtr<FunctorMember<T>, Functor>(pointer) {}
- };
-*/
}
#endif /* _FunctorPtr_H__ */
Modified: code/branches/consolecommands3/src/libraries/core/SharedPtr.h
===================================================================
--- code/branches/consolecommands3/src/libraries/core/SharedPtr.h 2010-08-21 22:27:53 UTC (rev 7200)
+++ code/branches/consolecommands3/src/libraries/core/SharedPtr.h 2010-08-21 22:48:55 UTC (rev 7201)
@@ -49,7 +49,6 @@
void destroy()
{
-// COUT(0) << "delete " << this->pointer_ << std::endl;
delete this->pointer_;
}
@@ -66,12 +65,10 @@
public:
inline SharedPtr() : pointer_(0), counter_(0), destroyer_(0)
{
-// COUT(0) << "SharedPtr (1): " << this->pointer_ << std::endl;
}
inline SharedPtr(T* pointer) : pointer_(pointer), counter_(0), destroyer_(0)
{
-// COUT(0) << "SharedPtr (2): " << this->pointer_ << std::endl;
if (this->pointer_)
{
this->counter_ = new int(1);
@@ -81,7 +78,6 @@
inline SharedPtr(const SharedPtr& other) : pointer_(other.pointer_), counter_(other.counter_), destroyer_(other.destroyer_)
{
-// COUT(0) << "SharedPtr (3): " << this->pointer_ << std::endl;
if (this->pointer_)
++(*this->counter_);
}
@@ -89,14 +85,12 @@
template <class O>
inline SharedPtr(const SharedPtr<O>& other) : pointer_(other.pointer_), counter_(other.counter_), destroyer_(other.destroyer_)
{
-// COUT(0) << "SharedPtr (4): " << this->pointer_ << std::endl;
if (this->pointer_)
++(*this->counter_);
}
inline ~SharedPtr()
{
-// COUT(0) << "~SharedPtr: " << this->pointer_ << std::endl;
if (this->pointer_)
{
--(*this->counter_);
@@ -112,7 +106,6 @@
inline const SharedPtr& operator=(const SharedPtr& other)
{
-// COUT(0) << "SharedPtr= (1)" << std::endl;
SharedPtr(other).swap(*this);
return *this;
}
@@ -120,7 +113,6 @@
template <class O>
inline const SharedPtr& operator=(const SharedPtr<O>& other)
{
-// COUT(0) << "SharedPtr= (2)" << std::endl;
SharedPtr(other).swap(*this);
return *this;
}
@@ -159,7 +151,6 @@
private:
inline SharedPtr(T* pointer, int* counter, SharedPtrDestroyer* destroyer) : pointer_(pointer), counter_(counter), destroyer_(destroyer)
{
-// COUT(0) << "SharedPtr (5): " << this->pointer_ << std::endl;
if (this->pointer_)
++(*this->counter_);
}
@@ -175,13 +166,8 @@
public:
inline SharedChildPtr() : Parent() {}
inline SharedChildPtr(T* pointer) : Parent(pointer) {}
-// inline SharedChildPtr(const SharedChildPtr& other) : Parent(other) {}
-// template <class O>
-// inline SharedChildPtr(const SharedChildPtr<O, T>& other) : Parent(other) {}
inline SharedChildPtr(const SharedPtr<T>& other) : Parent(other) {}
-// inline const SharedChildPtr& operator=(const SharedChildPtr& other) { Parent::operator=(other); return *this; }
-
inline T* operator->() const { return static_cast<T*>(Parent::operator->()); }
inline T& operator*() const { return *static_cast<T*>(Parent::operator->()); }
};
More information about the Orxonox-commit
mailing list