Dry
|
Shared array pointer template class. Uses non-intrusive reference counting. More...
#include <Dry/Container/ArrayPtr.h>
Public Member Functions | |
SharedArrayPtr () | |
Construct a null shared array pointer. | |
SharedArrayPtr (const SharedArrayPtr< T > &rhs) | |
Copy-construct from another shared array pointer. | |
SharedArrayPtr (T *ptr) | |
Construct from a raw pointer. | |
~SharedArrayPtr () | |
Destruct. Release the array reference. | |
SharedArrayPtr< T > & | operator= (const SharedArrayPtr< T > &rhs) |
Assign from another shared array pointer. | |
SharedArrayPtr< T > & | operator= (T *ptr) |
Assign from a raw pointer. | |
T * | operator-> () const |
Point to the array. | |
T & | operator* () const |
Dereference the array. | |
T & | operator[] (int index) |
Subscript the array. | |
bool | operator== (const SharedArrayPtr< T > &rhs) const |
Test for equality with another shared array pointer. | |
bool | operator!= (const SharedArrayPtr< T > &rhs) const |
Test for inequality with another shared array pointer. | |
bool | operator< (const SharedArrayPtr< T > &rhs) const |
Test for less than with another array pointer. | |
operator T* () const | |
Convert to a raw pointer. | |
void | Reset () |
Reset to null and release the array reference. | |
template<class U > | |
void | StaticCast (const SharedArrayPtr< U > &rhs) |
Perform a static cast from a shared array pointer of another type. | |
template<class U > | |
void | ReinterpretCast (const SharedArrayPtr< U > &rhs) |
Perform a reinterpret cast from a shared array 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 array's reference count, or 0 if the pointer is null. | |
int | WeakRefs () const |
Return the array's weak reference count, or 0 if the pointer is null. | |
RefCount * | RefCountPtr () const |
Return pointer to the RefCount structure. | |
unsigned | ToHash () const |
Return hash value for HashSet & HashMap. | |
Private Member Functions | |
template<class U > | |
SharedArrayPtr< T > & | operator= (const SharedArrayPtr< U > &rhs) |
Prevent direct assignment from a shared array pointer of different type. | |
void | AddRef () |
Add a reference to the array pointed to. | |
void | ReleaseRef () |
Release the array reference and delete it and the RefCount structure if necessary. | |
Private Attributes | |
T * | ptr_ |
Pointer to the array. | |
RefCount * | refCount_ |
Pointer to the RefCount structure. | |
Shared array pointer template class. Uses non-intrusive reference counting.