Changeset 9571 for code/branches/core6/src/libraries/core/object
- Timestamp:
- Mar 24, 2013, 9:03:22 PM (12 years ago)
- Location:
- code/branches/core6/src/libraries/core/object
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/object/SmartPtr.h
r9563 r9571 44 44 object and keeps this object alive until no SmartPtr points to this object anymore. 45 45 In contrast to orxonox::SharedPtr, SmartPtr works only with classes that are derived 46 from orxonox:: OrxonoxClass, because it's an intrusive implementation, meaning the46 from orxonox::Destroyable, because it's an intrusive implementation, meaning the 47 47 reference counter is stored in the object itself. 48 48 … … 78 78 }; 79 79 @endcode 80 In this example we assume that OtherClass is a child of OrxonoxClass. We don't care80 In this example we assume that OtherClass is a child of Destroyable. We don't care 81 81 about the inheritance of MyClass though. 82 82 … … 123 123 #include <cassert> 124 124 125 #include "core/ class/OrxonoxClass.h"125 #include "core/object/Destroyable.h" 126 126 #include "WeakPtr.h" 127 127 … … 227 227 } 228 228 229 /// Returns the wrapped pointer as @c OrxonoxClass*230 inline OrxonoxClass* getBase() const229 /// Returns the wrapped pointer as @c Destroyable* 230 inline Destroyable* getBase() const 231 231 { 232 232 return this->base_; … … 268 268 } 269 269 { 270 OrxonoxClass* temp = this->base_;270 Destroyable* temp = this->base_; 271 271 this->base_ = other.base_; 272 272 other.base_ = temp; … … 282 282 private: 283 283 T* pointer_; ///< The wrapped pointer to an object of type @a T 284 OrxonoxClass* base_; ///< The wrapped pointer, casted up to OrxonoxClass(this is needed because with just a T* pointer, SmartPtr couln't be used with forward declarations)284 Destroyable* base_; ///< The wrapped pointer, casted up to Destroyable (this is needed because with just a T* pointer, SmartPtr couln't be used with forward declarations) 285 285 }; 286 286 -
code/branches/core6/src/libraries/core/object/WeakPtr.h
r9563 r9571 40 40 destroyed. 41 41 42 WeakPtr works only with objects that are derived from orxonox:: OrxonoxClass, because42 WeakPtr works only with objects that are derived from orxonox::Destroyable, because 43 43 WeakPtr is intrusive and registers itself in the stored object, to get a notification if 44 44 the object is being deleted. … … 58 58 pointer->someFunction(); // this will not be executed 59 59 @endcode 60 In this example we assumed that MyClass is derived of OrxonoxClass(otherwise it couldn't60 In this example we assumed that MyClass is derived of Destroyable (otherwise it couldn't 61 61 be used with a WeakPtr). 62 62 … … 85 85 #include <cassert> 86 86 87 #include "core/ class/OrxonoxClass.h"87 #include "core/object/Destroyable.h" 88 88 #include "core/command/Functor.h" 89 89 … … 169 169 } 170 170 171 /// Returns the wrapped pointer as @c OrxonoxClass*172 inline OrxonoxClass* getBase() const171 /// Returns the wrapped pointer as @c Destroyable* 172 inline Destroyable* getBase() const 173 173 { 174 174 return this->base_; … … 213 213 } 214 214 { 215 OrxonoxClass* temp = this->base_;215 Destroyable* temp = this->base_; 216 216 this->base_ = other.base_; 217 217 other.base_ = temp; … … 241 241 242 242 private: 243 /// Will be called by OrxonoxClass::~OrxonoxClass() if the stored object is deleted. Resets the wrapped pointer and executes the callback.243 /// Will be called by Destroyable::~Destroyable() if the stored object is deleted. Resets the wrapped pointer and executes the callback. 244 244 inline void objectDeleted() 245 245 { … … 251 251 252 252 T* pointer_; ///< The wrapped pointer to an object of type @a T 253 OrxonoxClass* base_; ///< The wrapped pointer, casted up to OrxonoxClass(this is needed because with just a T* pointer, WeakPtr couln't be used with forward declarations)253 Destroyable* base_; ///< The wrapped pointer, casted up to Destroyable (this is needed because with just a T* pointer, WeakPtr couln't be used with forward declarations) 254 254 FunctorPtr callback_; ///< This callback will be executed if the stored object is deleted 255 255 };
Note: See TracChangeset
for help on using the changeset viewer.