Urho3D
Public Member Functions | Private Member Functions | Private Attributes
Urho3D::SharedPtr< T > Class Template Reference

Shared pointer template class with intrusive reference counting. More...

#include <Ptr.h>

List of all members.

Public Member Functions

 SharedPtr ()
 Construct a null shared pointer.
 SharedPtr (const SharedPtr< T > &rhs)
 Copy-construct from another shared pointer.
 SharedPtr (T *ptr)
 Construct from a raw pointer.
 ~SharedPtr ()
 Destruct. Release the object reference.
SharedPtr< T > & operator= (const SharedPtr< T > &rhs)
 Assign from another shared pointer.
SharedPtr< T > & operator= (T *ptr)
 Assign from a raw pointer.
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 SharedPtr< T > &rhs) const
 Test for less than with another shared pointer.
bool operator== (const SharedPtr< T > &rhs) const
 Test for equality with another shared pointer.
bool operator!= (const SharedPtr< T > &rhs) const
 Test for inequality with another shared pointer.
 operator bool () const
 Return true if the pointer is not null.
 operator T * () const
 Convert to a raw pointer.
void Reset ()
 Reset to null and release the object reference.
template<class U >
void StaticCast (const SharedPtr< U > &rhs)
 Perform a static cast from a shared pointer of another type.
template<class U >
void DynamicCast (const SharedPtr< U > &rhs)
 Perform a dynamic cast from a shared pointer of another type.
bool Null () const
 Check if the pointer is null.
bool NotNull () const
 Check if the pointer is not null.
T * Get () const
 Return the raw pointer.
int Refs () const
 Return the object's reference count, or 0 if the pointer is null.
int WeakRefs () const
 Return the object's weak reference count, or 0 if the pointer is null.
RefCountRefCountPtr () const
 Return pointer to the RefCount structure.
unsigned ToHash () const
 Return hash value for HashSet & HashMap.

Private Member Functions

template<class U >
SharedPtr< T > & operator= (const SharedPtr< U > &rhs)
 Prevent direct assignment from a shared pointer of another type.
void Release ()
 Release the object reference and delete it if necessary.

Private Attributes

T * ptr_
 Pointer to the object.

Detailed Description

template<class T>
class Urho3D::SharedPtr< T >

Shared pointer template class with intrusive reference counting.


The documentation for this class was generated from the following file: