Documentation
Urho3D::WeakPtr< T > Class Template Reference
Weak pointer template class with intrusive reference counting. Does not keep the object pointed to alive. More...
#include <Ptr.h>
Collaboration diagram for Urho3D::WeakPtr< T >:
Public Member Functions | |
WeakPtr () | |
Construct a null weak pointer. | |
WeakPtr (const WeakPtr< T > &rhs) | |
Copy-construct from another weak pointer. | |
WeakPtr (const SharedPtr< T > &rhs) | |
Construct from a shared pointer. | |
WeakPtr (T *ptr) | |
Construct from a raw pointer. | |
~WeakPtr () | |
Destruct. Release the weak reference to the object. | |
WeakPtr< T > & | operator= (const SharedPtr< T > &rhs) |
Assign from a shared pointer. | |
WeakPtr< T > & | operator= (const WeakPtr< T > &rhs) |
Assign from a weak pointer. | |
WeakPtr< T > & | operator= (T *ptr) |
Assign from a raw pointer. | |
SharedPtr< T > | Lock () const |
Convert to a shared pointer. If expired, return a null shared pointer. | |
T * | Get () const |
Return raw pointer. If expired, return null. | |
T * | operator-> () const |
Point to the object. | |
T & | operator* () const |
Dereference the object. | |
T & | operator[] (const int index) |
Subscript the object if applicable. | |
bool | operator== (const WeakPtr< T > &rhs) const |
Test for equality with another weak pointer. | |
bool | operator!= (const WeakPtr< T > &rhs) const |
Test for inequality with another weak pointer. | |
bool | operator< (const WeakPtr< T > &rhs) const |
Test for less than with another weak pointer. | |
operator T * () const | |
Convert to a raw pointer, null if the object is expired. | |
void | Reset () |
Reset to null and release the weak reference. | |
template<class U > | |
void | StaticCast (const WeakPtr< U > &rhs) |
Perform a static cast from a weak pointer of another type. | |
template<class U > | |
void | DynamicCast (const WeakPtr< U > &rhs) |
Perform a dynamic cast from a weak pointer of another type. | |
bool | Null () const |
Check if the pointer is null. | |
bool | NotNull () const |
Check if the pointer is not null. | |
int | Refs () const |
Return the object's reference count, or 0 if null pointer or if object has expired. | |
int | WeakRefs () const |
Return the object's weak reference count. | |
bool | Expired () const |
Return whether the object has expired. If null pointer, always return true. | |
RefCount * | RefCountPtr () const |
Return pointer to the RefCount structure. | |
unsigned | ToHash () const |
Return hash value for HashSet & HashMap. | |
Private Member Functions | |
template<class U > | |
WeakPtr< T > & | operator= (const WeakPtr< U > &rhs) |
Prevent direct assignment from a weak pointer of different type. | |
void | AddRef () |
Add a weak reference to the object pointed to. | |
void | ReleaseRef () |
Release the weak reference. Delete the Refcount structure if necessary. | |
Private Attributes | |
T * | ptr_ |
Pointer to the object. | |
RefCount * | refCount_ |
Pointer to the RefCount structure. | |
Detailed Description
template<class T>
class Urho3D::WeakPtr< T >
Weak pointer template class with intrusive reference counting. Does not keep the object pointed to alive.
The documentation for this class was generated from the following file:
- /home/travis/build/urho3d/Urho3D/Source/Urho3D/Container/Ptr.h