![]() |
Public API Reference |
#include <weakref.h>
Public Methods | |
csWeakRef () | |
Construct an empty weak reference. More... | |
csWeakRef (T *newobj) | |
Construct a weak reference from a normal pointer. More... | |
csWeakRef (csWeakRef const &other) | |
Weak pointer copy constructor. More... | |
~csWeakRef () | |
Weak pointer destructor. More... | |
csWeakRef & | operator= (T *newobj) |
Assign a raw object reference to this weak reference. More... | |
csWeakRef & | operator= (csWeakRef const &other) |
Assign another object to this weak reference. More... | |
T * | operator-> () const |
Dereference underlying object. More... | |
operator T * () const | |
Cast weak reference to a pointer to the underlying object. More... | |
T & | operator * () const |
Dereference underlying object. More... | |
bool | IsValid () const |
Weak pointer validity check. More... | |
Friends | |
bool | operator== (const csWeakRef &r1, const csWeakRef &r2) |
Test if the two references point to same object. More... | |
bool | operator!= (const csWeakRef &r1, const csWeakRef &r2) |
Test if the two references point to different object. More... | |
bool | operator== (const csWeakRef &r1, T *obj) |
Test if object pointed to by reference is same as obj. More... | |
bool | operator!= (const csWeakRef &r1, T *obj) |
Test if object pointed to by reference is different from obj. More... | |
bool | operator== (T *obj, const csWeakRef &r1) |
Test if object pointed to by reference is same as obj. More... | |
bool | operator!= (T *obj, const csWeakRef &r1) |
Test if object pointed to by reference is different from obj. More... |
This is a reference to a reference counted object but in itself it doesn't increment the ref counter. As soon as the object is destroyed (i.e. the last REAL reference to it is removed) all weak references pointing to that object are cleared. This kind of reference is useful if you want to maintain some kind of cached objects that can safely be removed as soon as the last reference to it is gone.
Note: this class assumes that the T type implements the following two functions:
Definition at line 39 of file weakref.h.
|
Construct an empty weak reference.
|
|
Construct a weak reference from a normal pointer.
|
|
Weak pointer copy constructor.
|
|
Weak pointer destructor.
|
|
Weak pointer validity check. Returns true if weak reference is pointing at an actual object, otherwise returns false. |
|
Dereference underlying object.
|
|
Cast weak reference to a pointer to the underlying object.
|
|
Dereference underlying object.
|
|
Assign another object to this weak reference.
|
|
Assign a raw object reference to this weak reference.
Definition at line 78 of file weakref.h. Referenced by operator=. |
|
Test if object pointed to by reference is different from obj.
|
|
Test if object pointed to by reference is different from obj.
|
|
Test if the two references point to different object.
|
|
Test if object pointed to by reference is same as obj.
|
|
Test if object pointed to by reference is same as obj.
|
|
Test if the two references point to same object.
|