Urho3D::SharedPtr< T > Class Template Reference

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

#include <Ptr.h>

Collaboration diagram for Urho3D::SharedPtr< T >:
[legend]

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 T * () const
 Convert to a raw pointer.
 
void Reset ()
 Reset to null and release the object reference.
 
void Detach ()
 Detach without destroying the object even if the refcount goes zero. To be used for scripting language interoperation.
 
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 AddRef ()
 Add a reference to the object pointed to.
 
void ReleaseRef ()
 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:
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/Container/Ptr.h