- Timestamp:
- Aug 20, 2010, 2:59:20 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/Functor.h
r7189 r7192 38 38 #include "util/Debug.h" 39 39 #include "util/MultiType.h" 40 #include "SharedPtr.h" 40 41 41 42 namespace orxonox … … 88 89 class _CoreExport Functor 89 90 { 91 friend class SharedPtr<Functor>; 92 90 93 public: 91 94 struct Type … … 101 104 102 105 public: 103 Functor() {}104 virtual ~Functor() { }106 Functor() : references_(0) { ++instances_s; COUT(0) << "functor ++: " << instances_s << std::endl; } 107 virtual ~Functor() { --instances_s; COUT(0) << "functor --: " << instances_s << std::endl; } 105 108 106 109 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 122 120 123 virtual const std::type_info& getHeaderIdentifier() const = 0; 124 125 private: 126 inline void incrementReferenceCount() 127 { ++this->references_; } 128 inline void decrementReferenceCount() 129 { --this->references_; if (this->references_ == 0) delete this; } 130 131 int references_; 132 static int instances_s; 121 133 }; 122 134 … … 200 212 T* object_; 201 213 const T* constObject_; 214 }; 215 216 217 218 typedef SharedPtr<Functor> FunctorPtr; 219 220 typedef SharedChildPtr<FunctorStatic, Functor> FunctorStaticPtr; 221 222 template <class T> 223 class FunctorMemberPtr : public SharedChildPtr<FunctorMember<T>, Functor> 224 { 225 public: 226 inline FunctorMemberPtr() : SharedChildPtr<FunctorMember<T>, Functor>() {} 227 inline FunctorMemberPtr(FunctorMember<T>* pointer) : SharedChildPtr<FunctorMember<T>, Functor>(pointer) {} 228 // inline FunctorMemberPtr(const FunctorMemberPtr& other) : SharedChildPtr<FunctorMember<T>, Functor>(other) {} 202 229 }; 203 230
Note: See TracChangeset
for help on using the changeset viewer.