Ion
|
A WeakReferentPtr is a weak reference to an instance of some class derived from Referent. More...
#include "weakreferent.h"
Public Types | |
typedef ReferentPtr< T >::Type | ReferentPtrType |
Public Member Functions | |
WeakReferentPtr () | |
WeakReferentPtr (T *ptr) | |
WeakReferentPtr (const ReferentPtrType &ref_ptr) | |
WeakReferentPtr (const WeakReferentPtr &other) | |
Copy constructor. More... | |
ReferentPtrType | Acquire () const |
Attempts to construct a ReferentPtr of the reference. More... | |
void | Reset () |
Set this WeakPointer to not refer to anything. More... | |
WeakReferentPtr< T > & | operator= (const ReferentPtrType &p) |
Allow assignment from a SharedPtr of the same type. More... | |
bool | operator== (const WeakReferentPtr &p) const |
The equality operator returns true if the proxies are the same. More... | |
bool | operator!= (const WeakReferentPtr &p) const |
The inequality operator returns true if the proxies differ. More... | |
int | GetUnderlyingRefCountUnsynchronized () const |
This function returns the reference count of the underlying referent that points to. More... | |
A WeakReferentPtr is a weak reference to an instance of some class derived from Referent.
It returns a ReferentPtr instance through the Acquire() call, which is the only way to access the underlying instance. This ReferentPtr will only be valid (non-NULL) if there are valid ReferentPtrs that still point to the underlying instance. Note that a WeakReferentPtr requires a ReferentPtr to the instance to already exist; WeakReferentPtrs are useless on their own, and will free any non-ref'd pointers passed to them (see Reset(), below).
Like SharedPtr, WeakReferentPtr is not thread-safe; synchronization must be used to ensure that an instance can only be accessed by one thread at a time.
Definition at line 182 of file weakreferent.h.
typedef ReferentPtr<T>::Type ion::base::WeakReferentPtr< T >::ReferentPtrType |
Definition at line 184 of file weakreferent.h.
|
inline |
Definition at line 186 of file weakreferent.h.
|
inlineexplicit |
Definition at line 187 of file weakreferent.h.
|
inlineexplicit |
Definition at line 188 of file weakreferent.h.
|
inline |
Copy constructor.
Definition at line 192 of file weakreferent.h.
|
inline |
Attempts to construct a ReferentPtr of the reference.
This is required to perform operations on the pointer. The construction is successful only if there are already existing ReferentPtrs to the instance. If successful, the returned ReferentPtr will have the normal lifetime guarantees. If it fails, it returns a NULL ReferentPtr, meaning that the Referent has already been deleted.
Definition at line 201 of file weakreferent.h.
|
inline |
This function returns the reference count of the underlying referent that points to.
This function performs no synchronization, and should only be considered accurate when called from the underlying referent's destructor.
Definition at line 273 of file weakreferent.h.
|
inline |
The inequality operator returns true if the proxies differ.
Definition at line 266 of file weakreferent.h.
|
inline |
Allow assignment from a SharedPtr of the same type.
Definition at line 255 of file weakreferent.h.
|
inline |
The equality operator returns true if the proxies are the same.
Definition at line 261 of file weakreferent.h.
|
inline |
Set this WeakPointer to not refer to anything.
Definition at line 250 of file weakreferent.h.
Referenced by ion::base::WeakReferentPtr< FramebufferObject >::operator=(), ion::base::WeakReferentPtr< FramebufferObject >::Reset(), and ion::base::WeakReferentPtr< FramebufferObject >::WeakReferentPtr().