Changeset 11071 for code/trunk/src/libraries/core/object
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/object/ClassFactory.h
r9667 r11071 53 53 { 54 54 public: 55 virtual ~Factory() {} 55 Factory() = default; 56 virtual ~Factory() = default; 56 57 virtual Identifiable* fabricate(Context* context) = 0; 57 58 }; -
code/trunk/src/libraries/core/object/Context.cc
r10624 r11071 40 40 RegisterClass(Context); 41 41 42 Context* Context::rootContext_s = 0;42 Context* Context::rootContext_s = nullptr; 43 43 44 44 Context* getContextForInitializationOfOtherContexts() … … 46 46 static size_t count = 0; 47 47 // the first time this is called, ++count returns 1 and the context is created 48 // the second time this is called, ++count returns 2 and NULLis returned because we're in the constructor of the context itself48 // the second time this is called, ++count returns 2 and nullptr is returned because we're in the constructor of the context itself 49 49 // for each future call the context (now completely created) is returned 50 50 if (++count == 2) 51 return NULL;51 return nullptr; 52 52 else 53 53 { 54 static Context context( NULL);54 static Context context(nullptr); 55 55 return &context; 56 56 } … … 70 70 // unregister context from object lists before object lists are destroyed 71 71 this->unregisterObject(); 72 for ( size_t i = 0; i < this->objectLists_.size(); ++i)73 delete this->objectLists_[i];72 for (ObjectListBase* objectList : this->objectLists_) 73 delete objectList; 74 74 } 75 75 … … 82 82 { 83 83 delete Context::rootContext_s; 84 Context::rootContext_s = NULL;84 Context::rootContext_s = nullptr; 85 85 } 86 86 87 87 /*static*/ Context* Context::getRootContext() 88 88 { 89 OrxVerify(Context::rootContext_s != NULL, "Root Context is undefined");89 OrxVerify(Context::rootContext_s != nullptr, "Root Context is undefined"); 90 90 return Context::rootContext_s; 91 91 } … … 105 105 ObjectListBase* objectList = this->getObjectList(identifier); 106 106 delete objectList; 107 this->objectLists_[identifier->getClassID()] = NULL;107 this->objectLists_[identifier->getClassID()] = nullptr; 108 108 } 109 109 } -
code/trunk/src/libraries/core/object/DestroyLaterManager.h
r10624 r11071 45 45 virtual ~DestroyLaterManager(); 46 46 47 virtual void preUpdate(const Clock& time) { /*no action*/ }48 virtual void postUpdate(const Clock& time) ;47 virtual void preUpdate(const Clock& time) override { /*no action*/ } 48 virtual void postUpdate(const Clock& time) override; 49 49 50 50 void retain(Destroyable* instance) … … 52 52 53 53 private: 54 std::vector<StrongPtr<Destroyable> 54 std::vector<StrongPtr<Destroyable>> retainedInstances_; 55 55 56 56 static DestroyLaterManager* singletonPtr_s; -
code/trunk/src/libraries/core/object/Destroyable.cc
r11019 r11071 54 54 Destroyable::~Destroyable() 55 55 { 56 if (!this->requestedDestruction_ && !IdentifierManager::getInstance().isCreatingHierarchy())56 if (!this->requestedDestruction_ && IdentifierManager::exists() && !IdentifierManager::getInstance().isCreatingHierarchy()) 57 57 orxout(internal_warning) << "Deleted destroyable object without destroy()" << endl; 58 58 … … 70 70 void Destroyable::destroy() 71 71 { 72 assert(this); // Just in case someone tries to delete a NULL pointer72 assert(this); // Just in case someone tries to delete a nullptr 73 73 this->requestedDestruction_ = true; 74 74 if (this->referenceCount_ == 0) -
code/trunk/src/libraries/core/object/Iterator.h
r10624 r11071 70 70 */ 71 71 template <class T> 72 class Iterator : public IteratorBase<T, Iterator<T> 72 class Iterator : public IteratorBase<T, Iterator<T>> 73 73 { 74 74 public: … … 76 76 @brief Constructor: Sets the element, whereon the iterator points, to zero. 77 77 */ 78 inline Iterator() : IteratorBase<T, Iterator<T> >() {} 79 80 /** 81 @brief Constructor: Sets this element to a given element 82 @param element The element 83 */ 84 inline Iterator(ObjectListBaseElement* element) : IteratorBase<T, Iterator<T> >(element) {} 78 inline Iterator() : IteratorBase<T, Iterator<T>>() {} 85 79 86 80 /** … … 88 82 @param other The other Iterator 89 83 */ 90 inline Iterator(const IteratorBase<T, Iterator<T> >& other) : IteratorBase<T, Iterator<T> >(other) {} 84 template <class OT, class OI> 85 inline Iterator(const IteratorBase<OT, OI>& other) : IteratorBase<T, Iterator<T>>(other) {} 91 86 92 87 /** -
code/trunk/src/libraries/core/object/IteratorBase.h
r10624 r11071 37 37 38 38 #include "core/CorePrereqs.h" 39 40 #include <boost/static_assert.hpp>41 #include <boost/type_traits/is_base_of.hpp>42 39 43 40 #include "ObjectListBase.h" … … 52 49 class IteratorBase : public ObjectListElementRemovalListener 53 50 { 54 BOOST_STATIC_ASSERT((boost::is_base_of<Listable, T>::value));55 56 p rotected:51 static_assert(std::is_base_of<Listable, T>::value, "IteratorBase can only be used with Listables"); 52 53 public: 57 54 /** 58 55 @brief Constructor: Sets the element, whereon the iterator points, to the given element. 59 This constructor is protected and only for internal usage (don't mess with the BaseElements directly). 60 */ 61 inline IteratorBase(ObjectListBaseElement* element = NULL) 56 */ 57 inline IteratorBase(ObjectListElement<T>* element = nullptr) 62 58 { 63 59 this->element_ = element; … … 65 61 } 66 62 67 68 public:69 /**70 @brief Constructor: Sets the element, whereon the iterator points, to the given element.71 */72 inline IteratorBase(ObjectListElement<T>* element)73 {74 this->element_ = element;75 this->registerIterator();76 }77 78 63 /** 79 64 @brief Constructor: Sets the element, whereon the iterator points, to the given element of another type. 80 65 The element's type O must be a derivative of the Iterator's type T. 81 66 */ 82 template <class O> 83 inline IteratorBase(ObjectListElement<O>* element) 84 { 85 (void)static_cast<T*>((O*)NULL); // Check type: The element's type O must be a derivative of the Iterator's type T. 86 this->element_ = element; 87 this->registerIterator(); 88 } 89 90 /** 91 @brief Constructor: Sets this element to the element of another Iterator. 92 @param other The other Iterator 93 */ 94 inline IteratorBase(const IteratorBase& other) 95 { 96 this->element_ = other.element_; 67 template <class OT, class OI> 68 inline IteratorBase(const IteratorBase<OT, OI>& other) 69 { 70 this->element_ = other.getElement(); 97 71 this->registerIterator(); 98 72 } … … 172 146 @return True if the Iterator points to an existing object. 173 147 */ 174 inline operator bool() const175 { 176 return (this->element_ != NULL);148 inline explicit operator bool() const 149 { 150 return (this->element_ != nullptr); 177 151 } 178 152 … … 201 175 @param object The object to compare with 202 176 */ 203 virtual void removedElement(ObjectListBaseElement* element) 177 virtual void removedElement(ObjectListBaseElement* element) override 204 178 { 205 179 if (this->element_ == element) 206 180 this->operator++(); 181 } 182 183 inline ObjectListBaseElement* getElement() const 184 { 185 return this->element_; 207 186 } 208 187 … … 226 205 } 227 206 else 228 this->list_ = NULL;207 this->list_ = nullptr; 229 208 } 230 209 -
code/trunk/src/libraries/core/object/Listable.cc
r10624 r11071 44 44 @brief Constructor: Allocates space in the element list. 45 45 */ 46 Listable::Listable() 46 Listable::Listable() : Listable(Context::getRootContext()) 47 47 { 48 this->context_ = Context::getRootContext();49 this->elements_.reserve(6);50 51 RegisterObject(Listable);52 48 } 53 49 … … 76 72 void Listable::unregisterObject() 77 73 { 78 for ( size_t i = 0; i < this->elements_.size(); ++i)79 Listable::deleteObjectListElement( this->elements_[i]);74 for (ObjectListBaseElement* element : this->elements_) 75 Listable::deleteObjectListElement(element); 80 76 this->elements_.clear(); 81 77 } … … 91 87 this->elements_.clear(); 92 88 93 for ( size_t i = 0; i < copy.size(); ++i)89 for (ObjectListBaseElement* element : copy) 94 90 { 95 copy[i]->changeContext(this->context_, context);96 Listable::deleteObjectListElement( copy[i]);91 element->changeContext(this->context_, context); 92 Listable::deleteObjectListElement(element); 97 93 } 98 94 -
code/trunk/src/libraries/core/object/Listable.h
r9667 r11071 40 40 #include <vector> 41 41 42 #include "util/SmallObjectAllocator.h" 42 43 #include "core/class/Identifiable.h" 43 44 -
code/trunk/src/libraries/core/object/ObjectList.h
r10624 r11071 47 47 #include "core/CorePrereqs.h" 48 48 49 #include <boost/static_assert.hpp>50 #include <boost/type_traits/is_base_of.hpp>51 52 49 #include "ObjectListBase.h" 53 50 #include "ObjectListIterator.h" … … 69 66 class ObjectList 70 67 { 71 BOOST_STATIC_ASSERT((boost::is_base_of<Listable, T>::value));68 static_assert(std::is_base_of<Listable, T>::value, "ObjectList can only be used with Listables"); 72 69 73 70 public: 74 71 typedef ObjectListIterator<T> iterator; 75 72 76 /// Returns the size of the list (for the root context) 77 inline static size_t size() 78 { return size(Context::getRootContext()); } 73 ObjectList() : ObjectList(Context::getRootContext()) {} 74 ObjectList(Context* context) : ObjectList(context->getObjectList<T>()) {} 75 ObjectList(ObjectListBase* list) : list_(list) {} 76 79 77 /// Returns the size of the list 80 inline static size_t size(Context* context) 81 { 82 return context->getObjectList<T>()->size(); 83 } 78 inline size_t size() 79 { return this->list_->size(); } 84 80 85 /// Returns an Iterator to the first element in the list (for the root context).86 inline static ObjectListElement<T>* begin()87 { return begin(Context::getRootContext()); }88 81 /// Returns an Iterator to the first element in the list. 89 inline static ObjectListElement<T>* begin(Context* context)90 { 91 ObjectListBase* list = context->getObjectList<T>();92 return static_cast<ObjectListElement<T>*>(list->begin());93 }82 inline ObjectListIterator<T> begin() 83 { return static_cast<ObjectListElement<T>*>(this->list_->begin()); } 84 /// Returns an Iterator to the element after the last element in the list. 85 inline ObjectListIterator<T> end() 86 { return static_cast<ObjectListElement<T>*>(this->list_->end()); } 94 87 95 /// Returns an Iterator to the element after the last element in the list (for the root context). 96 inline static ObjectListElement<T>* end() 97 { return end(Context::getRootContext()); } 98 /// Returns an Iterator to the element after the last element in the list. 99 inline static ObjectListElement<T>* end(Context* context) 100 { 101 ObjectListBase* list = context->getObjectList<T>(); 102 return static_cast<ObjectListElement<T>*>(list->end()); 103 } 88 /// Returns an Iterator to the last element in the list. 89 inline ObjectListIterator<T> rbegin() 90 { return static_cast<ObjectListElement<T>*>(this->list_->rbegin()); } 91 /// Returns an Iterator to the element before the first element in the list. 92 inline ObjectListIterator<T> rend() 93 { return static_cast<ObjectListElement<T>*>(this->list_->rend()); } 104 94 105 /// Returns an Iterator to the last element in the list (for the root context). 106 inline static ObjectListElement<T>* rbegin() 107 { return rbegin(Context::getRootContext()); } 108 /// Returns an Iterator to the last element in the list. 109 inline static ObjectListElement<T>* rbegin(Context* context) 110 { 111 ObjectListBase* list = context->getObjectList<T>(); 112 return static_cast<ObjectListElement<T>*>(list->rbegin()); 113 } 114 115 /// Returns an Iterator to the element before the first element in the list (for the root context). 116 inline static ObjectListElement<T>* rend() 117 { return rend(Context::getRootContext()); } 118 /// Returns an Iterator to the element before the first element in the list. 119 inline static ObjectListElement<T>* rend(Context* context) 120 { 121 ObjectListBase* list = context->getObjectList<T>(); 122 return static_cast<ObjectListElement<T>*>(list->rend()); 123 } 95 private: 96 ObjectListBase* list_; 124 97 }; 125 98 } -
code/trunk/src/libraries/core/object/ObjectListBase.cc
r9975 r11071 58 58 ObjectListBase::ObjectListBase() 59 59 { 60 this->first_ = 0;61 this->last_ = 0;60 this->first_ = nullptr; 61 this->last_ = nullptr; 62 62 this->size_ = 0; 63 63 } … … 73 73 ObjectListBaseElement* next = current->next_; 74 74 75 current->list_ = 0;76 current->next_ = 0;77 current->prev_ = 0;75 current->list_ = nullptr; 76 current->next_ = nullptr; 77 current->prev_ = nullptr; 78 78 79 79 current = next; … … 92 92 void ObjectListBase::notifyRemovalListeners(ObjectListBaseElement* element) const 93 93 { 94 for ( std::vector<ObjectListElementRemovalListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)95 (*it)->removedElement(element);94 for (ObjectListElementRemovalListener* listener : this->listeners_) 95 listener->removedElement(element); 96 96 } 97 97 … … 155 155 this->first_ = element->next_; // If there is no prev_, we deleted the first object and have to update the first_ pointer of the list 156 156 157 element->list_ = 0;158 element->next_ = 0;159 element->prev_ = 0;157 element->list_ = nullptr; 158 element->next_ = nullptr; 159 element->prev_ = nullptr; 160 160 --this->size_; 161 161 } -
code/trunk/src/libraries/core/object/ObjectListBase.h
r9667 r11071 57 57 @param objectBase The object to store 58 58 */ 59 ObjectListBaseElement(Listable* object) : next_( 0), prev_(0), objectBase_(object), list_(0) {}59 ObjectListBaseElement(Listable* object) : next_(nullptr), prev_(nullptr), objectBase_(object), list_(nullptr) {} 60 60 virtual ~ObjectListBaseElement() { this->removeFromList(); } 61 61 … … 82 82 ObjectListElement(T* object) : ObjectListBaseElement(static_cast<Listable*>(object)), object_(object) {} 83 83 84 virtual void changeContext(Context* oldContext, Context* newContext) 84 virtual void changeContext(Context* oldContext, Context* newContext) override 85 85 { 86 86 // add object to new context, but only if this element belongs exactly to the old context (and not to a sub-context to avoid re-adding objects … … 104 104 { 105 105 public: 106 virtual ~ObjectListElementRemovalListener() {} 106 ObjectListElementRemovalListener() = default; 107 virtual ~ObjectListElementRemovalListener() = default; 107 108 virtual void removedElement(ObjectListBaseElement* element) = 0; 108 109 }; … … 136 137 inline ObjectListBaseElement* begin() const { return this->first_; } 137 138 /// Returns a pointer to the element after the last element in the list. Works only with Iterator. 138 inline ObjectListBaseElement* end() const { return 0; }139 inline ObjectListBaseElement* end() const { return nullptr; } 139 140 /// Returns a pointer to the last element in the list. Works only with Iterator. 140 141 inline ObjectListBaseElement* rbegin() const { return this->last_; } 141 142 /// Returns a pointer to the element in front of the first element in the list. Works only with Iterator. 142 inline ObjectListBaseElement* rend() const { return 0; }143 inline ObjectListBaseElement* rend() const { return nullptr; } 143 144 144 145 inline void registerRemovalListener(ObjectListElementRemovalListener* listener) { this->listeners_.push_back(listener); } -
code/trunk/src/libraries/core/object/ObjectListIterator.h
r10624 r11071 41 41 Usage: 42 42 @code 43 for (ObjectListIterator<myClass> it = ObjectList<myClass>::begin(); it != ObjectList<myClass>::end(); ++it) 43 ObjectList<myClass> list; 44 for (ObjectListIterator<myClass> it = list.begin(); it != list.end(); ++it) 44 45 { 45 46 it->someFunction(...); … … 68 69 */ 69 70 template <class T> 70 class ObjectListIterator : public IteratorBase<T, ObjectListIterator<T> 71 class ObjectListIterator : public IteratorBase<T, ObjectListIterator<T>> 71 72 { 72 73 public: … … 74 75 @brief Constructor: Sets the element, whereon the ObjectListIterator points, to zero. 75 76 */ 76 inline ObjectListIterator() : IteratorBase<T, ObjectListIterator<T> 77 inline ObjectListIterator() : IteratorBase<T, ObjectListIterator<T>>() {} 77 78 78 79 /** … … 80 81 @param element The element to start with 81 82 */ 82 inline ObjectListIterator(ObjectListElement<T>* element) : IteratorBase<T, ObjectListIterator<T> 83 inline ObjectListIterator(ObjectListElement<T>* element) : IteratorBase<T, ObjectListIterator<T>>(element) {} 83 84 84 85 /** … … 86 87 @param other The other ObjectListIterator 87 88 */ 88 inline ObjectListIterator(const IteratorBase<T, ObjectListIterator<T> >& other) : IteratorBase<T, ObjectListIterator<T> >(other) {} 89 template <class OI> 90 inline ObjectListIterator(const IteratorBase<T, OI>& other) : IteratorBase<T, ObjectListIterator<T>>(other) {} 89 91 90 92 /** -
code/trunk/src/libraries/core/object/StrongPtr.h
r10624 r11071 43 43 orxonox::StrongPtr is an implementation of a smart pointer - it wraps a pointer to an 44 44 object and keeps this object alive until no StrongPtr points to this object anymore. 45 In contrast to orxonox::SharedPtr, StrongPtr works only with classes that are derived45 In contrast to std::shared_ptr, StrongPtr works only with classes that are derived 46 46 from orxonox::Destroyable, because it's an intrusive implementation, meaning the 47 47 reference counter is stored in the object itself. … … 51 51 at any time and also convert it back to a normal pointer if you like. This is possible 52 52 because the reference counter is stored in the object itself and not in StrongPtr (in 53 contrast to SharedPtr).53 contrast to std::shared_ptr). 54 54 55 55 @b Important: If you want to delete an object, you must not use @c delete @c object but … … 138 138 public: 139 139 /// Constructor: Initializes the strong pointer with a null pointer. 140 inline StrongPtr() : pointer_( 0), base_(0)140 inline StrongPtr() : pointer_(nullptr), base_(nullptr) 141 141 { 142 142 } … … 158 158 /// Copy-constructor for strong pointers to objects of another class. 159 159 template <class O> 160 inline StrongPtr(const StrongPtr<O>& other) : pointer_(other.get()), base_(other. base_)160 inline StrongPtr(const StrongPtr<O>& other) : pointer_(other.get()), base_(other.getBase()) 161 161 { 162 162 if (this->base_) … … 172 172 } 173 173 174 /// Move-constructor 175 inline StrongPtr(StrongPtr&& other) : pointer_(other.pointer_), base_(other.base_) 176 { 177 other.pointer_ = nullptr; 178 other.base_ = nullptr; 179 } 180 174 181 /// Destructor: Decrements the reference counter. 175 182 inline ~StrongPtr() … … 187 194 188 195 /// Assigns the wrapped pointer of another StrongPtr. 189 inline StrongPtr& operator=( const StrongPtr&other)190 { 191 StrongPtr(other).swap(*this);196 inline StrongPtr& operator=(StrongPtr other) 197 { 198 other.swap(*this); 192 199 return *this; 193 200 } … … 230 237 inline T* operator->() const 231 238 { 232 assert(this->pointer_ != 0);239 assert(this->pointer_ != nullptr); 233 240 return this->pointer_; 234 241 } … … 237 244 inline T& operator*() const 238 245 { 239 assert(this->pointer_ != 0);246 assert(this->pointer_ != nullptr); 240 247 return *this->pointer_; 241 248 } 242 249 243 /// Returns true if the wrapped pointer is NULL.244 inline bool operator!() const245 { 246 return (this->pointer_ == 0);250 /// Returns true if the pointer is not nullptr. 251 inline explicit operator bool() const 252 { 253 return (this->pointer_ != nullptr); 247 254 } 248 255 … … 262 269 } 263 270 264 /// Resets the strong pointer (equivalent to assigning a NULL pointer).271 /// Resets the strong pointer (equivalent to assigning a nullptr). 265 272 inline void reset() 266 273 { -
code/trunk/src/libraries/core/object/WeakPtr.h
r10624 r11071 37 37 38 38 A WeakPtr wraps a pointer to an object. If the object gets deleted, the WeakPtr becomes 39 NULL. This can be used to store pointers to objects without knowing when they will be39 nullptr. This can be used to store pointers to objects without knowing when they will be 40 40 destroyed. 41 41 … … 50 50 WeakPtr<MyClass> pointer = object; // create a WeakPtr and assign the object 51 51 52 if (pointer) // checks if pointer is not NULL(which is true)52 if (pointer) // checks if pointer is not nullptr (which is true) 53 53 pointer->someFunction(); // calls MyClass::someFunction() 54 54 55 55 object->destroy(); // calls destroy() which deletes the object 56 56 57 if (pointer) // checks if pointer is not NULL(which is now false)57 if (pointer) // checks if pointer is not nullptr (which is now false) 58 58 pointer->someFunction(); // this will not be executed 59 59 @endcode … … 91 91 { 92 92 /** 93 @brief WeakPtr wraps a pointer to an object, which becomes NULLif the object is deleted.93 @brief WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted. 94 94 95 95 @see See @ref WeakPtrExample "this description" for more information and an example. … … 100 100 public: 101 101 /// Constructor: Initializes the weak pointer with a null pointer. 102 inline WeakPtr() : pointer_( 0), base_(0), callback_(0)102 inline WeakPtr() : pointer_(nullptr), base_(nullptr), callback_(nullptr) 103 103 { 104 104 } 105 105 106 106 /// Constructor: Initializes the weak pointer with a pointer to an object. 107 inline WeakPtr(T* pointer) : pointer_(pointer), base_(pointer), callback_( 0)107 inline WeakPtr(T* pointer) : pointer_(pointer), base_(pointer), callback_(nullptr) 108 108 { 109 109 this->registerAsDestructionListener(this->base_); … … 111 111 112 112 /// Copy-constructor 113 inline WeakPtr(const WeakPtr& other) : pointer_(other.pointer_), base_(other.base_), callback_( 0)113 inline WeakPtr(const WeakPtr& other) : pointer_(other.pointer_), base_(other.base_), callback_(nullptr) 114 114 { 115 115 this->registerAsDestructionListener(this->base_); … … 118 118 /// Copy-constructor for weak pointers to objects of another class. 119 119 template <class O> 120 inline WeakPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other. base_), callback_(0)120 inline WeakPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other.getBase()), callback_(nullptr) 121 121 { 122 122 this->registerAsDestructionListener(this->base_); … … 124 124 125 125 /// Destructor 126 inline virtual~WeakPtr()126 virtual inline ~WeakPtr() 127 127 { 128 128 this->unregisterAsDestructionListener(this->base_); … … 137 137 138 138 /// Assigns the wrapped pointer of another WeakPtr. 139 inline WeakPtr& operator=( const WeakPtr&other)140 { 141 WeakPtr(other).swap(*this);139 inline WeakPtr& operator=(WeakPtr other) 140 { 141 other.swap(*this); 142 142 return *this; 143 143 } … … 172 172 inline T* operator->() const 173 173 { 174 assert(this->pointer_ != 0);174 assert(this->pointer_ != nullptr); 175 175 return this->pointer_; 176 176 } … … 179 179 inline T& operator*() const 180 180 { 181 assert(this->pointer_ != 0);181 assert(this->pointer_ != nullptr); 182 182 return *this->pointer_; 183 183 } 184 184 185 /// Returns true if the wrapped pointer is NULL.186 inline bool operator!() const187 { 188 return (this->pointer_ == 0);185 /// Returns true if the pointer is not nullptr. 186 inline explicit operator bool() const 187 { 188 return (this->pointer_ != nullptr); 189 189 } 190 190 … … 210 210 } 211 211 212 /// Resets the weak pointer (equivalent to assigning a NULL pointer).212 /// Resets the weak pointer (equivalent to assigning a nullptr). 213 213 inline void reset() 214 214 { … … 230 230 private: 231 231 /// Will be called by Destroyable::~Destroyable() if the stored object is deleted. Resets the wrapped pointer and executes the callback. 232 inline void objectDeleted()233 { 234 this->base_ = 0;235 this->pointer_ = 0;232 virtual inline void objectDeleted() override 233 { 234 this->base_ = nullptr; 235 this->pointer_ = nullptr; 236 236 if (this->callback_) 237 237 (*this->callback_)();
Note: See TracChangeset
for help on using the changeset viewer.