OpenCurves
0.9
|
A pointer wrapper for a reference counted object such as RefCountObject
.
More...
#include <refcountptr.h>
Public Member Functions | |
RefCountPtr () | |
Default constructor to a null pointer. | |
RefCountPtr (T *ptr) | |
Constructor using the template type, incrementing the reference count of ptr . More... | |
template<class Q > | |
RefCountPtr (Q *ptr) | |
Constructor using a different pointer type. More... | |
RefCountPtr (const RefCountPtr &other) | |
Copy constructor. More... | |
template<class Q > | |
RefCountPtr (const RefCountPtr< Q > &other) | |
Copy constructor using a different pointer type. More... | |
RefCountPtr (RefCountPtr &&other) | |
Move constructor. More... | |
~RefCountPtr () | |
Destructor: calls release() . | |
void | release () |
Explicitly releases the internal pointer, making this object null. More... | |
T * | ptr () |
Access the internal pointer. More... | |
const T * | ptr () const |
Access the internal pointer. More... | |
T & | operator* () |
Dereference operator. More... | |
const T & | operator* () const |
Dereference operator. More... | |
T * | operator-> () |
Dereference call operator. More... | |
const T * | operator-> () const |
Dereference call operator. More... | |
operator bool () const | |
Cast to bool operator. More... | |
bool | operator! () const |
Negation operator. More... | |
bool | operator== (const RefCountPtr &other) |
Equality operator. More... | |
bool | operator!= (const RefCountPtr &other) |
Inequality operator. More... | |
RefCountPtr & | operator= (const RefCountPtr &other) |
Assignment operator. More... | |
RefCountPtr & | operator= (T *ptr) |
Assignment operator. More... | |
template<class Q > | |
RefCountPtr & | operator= (Q *ptr) |
Assignment operator to a derivation of T . More... | |
template<class Q > | |
RefCountPtr< T > & | operator= (Q *ptr) |
A pointer wrapper for a reference counted object such as RefCountObject
.
The template type must support the following:
addReference()
method : increment the reference count by 1.decReference()
method : decrement the reference count by 1, deleting the object when zero.It is recommended that the supported type be constructed with a reference count of zero, allowing the RefCountPtr
to increment it to 1.
|
inline |
Constructor using the template type, incrementing the reference count of ptr
.
ptr | The object to point to. Null is handled (equivalent to the default constructor). |
Constructor using a different pointer type.
Type Q
must be able to be up-cast to T
.
Q | The object type to construct from. T must be in the inheritance hierarchy of Q . |
ptr | The object to point to. Null is handled (equivalent to the default constructor). |
|
inline |
Copy constructor.
other | The object to copy. |
plotutil::RefCountPtr< T >::RefCountPtr | ( | const RefCountPtr< Q > & | other | ) |
Copy constructor using a different pointer type.
Type Q
must be able to be up-cast to T
.
Q | The object type to construct from. T must be in the inheritance hierarchy of Q . |
other | The object to copy. |
|
inline |
Move constructor.
other | The object to move construct from. |
|
inline |
Cast to bool operator.
True if non null.
|
inline |
Negation operator.
True if null.
|
inline |
Inequality operator.
other | The object to compare to. |
|
inline |
Dereference operator.
Do not use if null.
|
inline |
Dereference operator.
Do not use if null.
|
inline |
Dereference call operator.
Do not use if null.
|
inline |
Dereference call operator.
Do not use if null.
|
inline |
Assignment operator.
Releases current reference and attains new reference as required.
other | The new object to point to. |
|
inline |
Assignment operator.
Releases current reference and attains new reference as required.
ptr | The new object to point to. Handles null pointers. |
Assignment operator to a derivation of T
.
Releases current reference and attains new reference as required.
Q | The object type to construct from. T must be in the inheritance hierarchy of Q . |
ptr | The object to point to. Null is handled (equivalent to the default constructor). |
|
inline |
Equality operator.
other | The object to compare to. |
|
inline |
Access the internal pointer.
|
inline |
Access the internal pointer.
|
inline |
Explicitly releases the internal pointer, making this object null.
The reference count is decremented as needed.