Changeset 9571 for code/branches/core6/src/libraries
- Timestamp:
- Mar 24, 2013, 9:03:22 PM (12 years ago)
- Location:
- code/branches/core6/src/libraries
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core6/src/libraries/core/command/Functor.h
r9563 r9571 120 120 #include "util/Output.h" 121 121 #include "util/MultiType.h" 122 #include "core/ class/OrxonoxClass.h"122 #include "core/object/Destroyable.h" 123 123 #include "FunctorPtr.h" 124 124 … … 303 303 /// Casts the object and registers as destruction listener. 304 304 inline void registerObject(O* object) 305 { OrxonoxClass* base = dynamic_cast<OrxonoxClass*>(object); if (base) { this->registerAsDestructionListener(base); } }305 { Destroyable* base = dynamic_cast<Destroyable*>(object); if (base) { this->registerAsDestructionListener(base); } } 306 306 /// Casts the object and unregisters as destruction listener. 307 307 inline void unregisterObject(O* object) 308 { OrxonoxClass* base = dynamic_cast<OrxonoxClass*>(object); if (base) { this->unregisterAsDestructionListener(base); } }309 310 /// Will be called by OrxonoxClass::~OrxonoxClass() if the stored object is deleted and the Functor is in safe mode.308 { Destroyable* base = dynamic_cast<Destroyable*>(object); if (base) { this->unregisterAsDestructionListener(base); } } 309 310 /// Will be called by Destroyable::~Destroyable() if the stored object is deleted and the Functor is in safe mode. 311 311 inline void objectDeleted() 312 312 { this->object_ = 0; } -
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 }; -
code/branches/core6/src/libraries/util/ScopedSingletonManager.h
r8858 r9571 68 68 namespace orxonox 69 69 { 70 class OrxonoxClass;70 class Destroyable; 71 71 72 72 /** … … 166 166 } 167 167 168 //! Destroys the singleton instance - overloaded for OrxonoxClass, calls OrxonoxClass::destroy()169 void destroy( OrxonoxClass*)168 //! Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy() 169 void destroy(Destroyable*) 170 170 { 171 171 singletonPtr_->destroy(); … … 246 246 } 247 247 248 //! Destroys the singleton instance - overloaded for OrxonoxClass, calls OrxonoxClass::destroy()249 void destroy( OrxonoxClass*)248 //! Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy() 249 void destroy(Destroyable*) 250 250 { 251 251 singletonPtr_->destroy();
Note: See TracChangeset
for help on using the changeset viewer.