This is an object shared by all the weak pointers that point to the same ReferenceCount object. More...
#include "weakReferenceList.h"
Public Member Functions | |
~WeakReferenceList () | |
The destructor tells all of the owned references that we're gone. More... | |
void | add_callback (WeakPointerCallback *callback, void *data) |
Adds the callback to the list of callbacks that will be called when the underlying pointer is deleted. More... | |
void | ref () const |
Increases the number of weak references. More... | |
void | remove_callback (WeakPointerCallback *callback) |
Intended to be called only by WeakPointerTo (or by any class implementing a weak reference-counting pointer), this removes the indicated PointerToVoid structure from the list of such structures that are maintaining a weak pointer to this object. More... | |
bool | unref () const |
Decreases the number of weak references. More... | |
bool | was_deleted () const |
Returns true if the object represented has been deleted, ie. More... | |
Public Attributes | |
MutexImpl | _lock |
Friends | |
class | ReferenceCount |
This is an object shared by all the weak pointers that point to the same ReferenceCount object.
It is created whenever a weak reference to an object is created, and can outlive the object until all weak references have disappeared.
Definition at line 29 of file weakReferenceList.h.
WeakReferenceList::~WeakReferenceList | ( | ) |
The destructor tells all of the owned references that we're gone.
Definition at line 29 of file weakReferenceList.cxx.
void WeakReferenceList::add_callback | ( | WeakPointerCallback * | callback, |
void * | data | ||
) |
Adds the callback to the list of callbacks that will be called when the underlying pointer is deleted.
If it has already been deleted, it will be called immediately.
The data pointer can be an arbitrary pointer and is passed as only argument to the callback.
Definition at line 44 of file weakReferenceList.cxx.
Referenced by WeakPointerToVoid::add_callback().
|
inline |
Increases the number of weak references.
Definition at line 20 of file weakReferenceList.I.
References AtomicAdjustDummyImpl::inc().
void WeakReferenceList::remove_callback | ( | WeakPointerCallback * | callback | ) |
Intended to be called only by WeakPointerTo (or by any class implementing a weak reference-counting pointer), this removes the indicated PointerToVoid structure from the list of such structures that are maintaining a weak pointer to this object.
Definition at line 70 of file weakReferenceList.cxx.
Referenced by WeakPointerToVoid::remove_callback().
|
inline |
Decreases the number of weak references.
Returns true if, after this, there are still any weak or strong references remaining, or false if this structure should be deleted right away.
Definition at line 32 of file weakReferenceList.I.
References AtomicAdjustDummyImpl::dec().
Referenced by WeakPointerToBase< T >::clear().
|
inline |
Returns true if the object represented has been deleted, ie.
there are only weak references left pointing to the object.
Definition at line 43 of file weakReferenceList.I.
References AtomicAdjustDummyImpl::get().
Referenced by WeakPointerToVoid::add_callback(), WeakPointerToVoid::is_valid_pointer(), WeakPointerToBase< T >::output(), and WeakPointerToVoid::was_deleted().