Changeset 5791 for code/branches/core5/src/libraries
- Timestamp:
- Sep 26, 2009, 2:05:30 AM (15 years ago)
- Location:
- code/branches/core5/src/libraries
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/libraries/core/OrxonoxClass.cc
r5772 r5791 45 45 this->parents_ = 0; 46 46 this->metaList_ = new MetaObjectList(); 47 this->referenceCount_ = 0; 48 this->requestedDestruction_ = false; 47 49 } 48 50 … … 55 57 if (this->parents_) 56 58 delete this->parents_; 59 } 60 61 /** @brief Deletes the object if no smart pointers point to this object. Otherwise schedules the object to be deleted as soon as possible. */ 62 void OrxonoxClass::destroy() 63 { 64 if (this->referenceCount_ > 0) 65 this->requestedDestruction_ = true; 66 else 67 delete this; 57 68 } 58 69 -
code/branches/core5/src/libraries/core/OrxonoxClass.h
r5772 r5791 59 59 virtual ~OrxonoxClass(); 60 60 61 void destroy(); 62 61 63 /** @brief Function to collect the SetConfigValue-macro calls. */ 62 64 void setConfigValues() {}; … … 92 94 bool isDirectParentOf(const OrxonoxClass* object); 93 95 96 inline unsigned int getReferenceCount() const 97 { return this->referenceCount_; } 98 94 99 /** 95 100 @brief … … 117 122 118 123 private: 124 /** @brief Increments the reference counter (for smart pointers). */ 125 inline void incrementReferenceCount() 126 { ++this->referenceCount_; } 127 /** @brief Decrements the reference counter (for smart pointers). */ 128 inline void decrementReferenceCount() 129 { --this->referenceCount_; if (this->referenceCount_ == 0 && this->requestedDestruction_) { delete this; } } 130 119 131 Identifier* identifier_; //!< The Identifier of the object 120 132 std::set<const Identifier*>* parents_; //!< List of all parents of the object 121 133 MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in 134 unsigned int referenceCount_; //!< Counts the references from smart pointers to this object 135 bool requestedDestruction_; //!< Becomes true after someone called delete on this object 136 122 137 //! 'Fast map' that holds this-pointers of all derived types 123 138 std::vector<std::pair<unsigned int, void*> > objectPointers_; -
code/branches/core5/src/libraries/tools/Timer.h
r5738 r5791 143 143 @param exeuctor A executor of the function to call 144 144 */ 145 Timer(float interval, bool bLoop, T* object, ExecutorMember<T>* exeuctor, bool bKillAfterCall = false) 145 template <class O> 146 Timer(float interval, bool bLoop, T* object, ExecutorMember<O>* exeuctor, bool bKillAfterCall = false) 146 147 { 147 148 this->setTimer(interval, bLoop, object, exeuctor, bKillAfterCall); … … 155 156 @param exeuctor A executor of the function to call 156 157 */ 157 void setTimer(float interval, bool bLoop, T* object, ExecutorMember<T>* executor, bool bKillAfterCall = false) 158 template <class O> 159 void setTimer(float interval, bool bLoop, T* object, ExecutorMember<O>* executor, bool bKillAfterCall = false) 158 160 { 159 161 this->deleteExecutor();
Note: See TracChangeset
for help on using the changeset viewer.