#include <Pointers.H>
Public Member Functions | |
LnClassPtr () | |
The default constructor. The wrapped pointer is null. | |
LnClassPtr (T *rhs) | |
Construct a LnPtr<T> setting the wrapped pointer to rhs. | |
LnClassPtr< T > & | operator= (const LnClassPtr< T > &rhs) |
The copy assignment operator. | |
LnClassPtr< T > & | operator= (T *rhs) |
Sets the wrapped pointer to rhs. | |
~LnClassPtr () | |
Applies operator-> to the wrapped pointer. | |
bool | unique () const |
Returns true if only one reference to the wrapped pointer. | |
int | linkCount () const |
Returns the number of references to the wrapped pointer. | |
T & | operator* () const |
Returns a reference to the value pointed to by the wrapped pointer; i.e. | |
bool | isNull () const |
Returns true if the wrapped pointer is null. | |
bool | operator== (const LnClassPtr< T > &rhs) const |
bool | operator!= (const LnClassPtr< T > &rhs) const |
T * | operator-> () const |
LnClassPtr () | |
The default constructor. The wrapped pointer is null. | |
LnClassPtr (T *rhs) | |
Construct a LnPtr<T> setting the wrapped pointer to rhs. | |
LnClassPtr< T > & | operator= (const LnClassPtr< T > &rhs) |
The copy assignment operator. | |
LnClassPtr< T > & | operator= (T *rhs) |
Sets the wrapped pointer to rhs. | |
~LnClassPtr () | |
Applies operator-> to the wrapped pointer. | |
bool | unique () const |
Returns true if only one reference to the wrapped pointer. | |
int | linkCount () const |
Returns the number of references to the wrapped pointer. | |
T & | operator* () const |
Returns a reference to the value pointed to by the wrapped pointer; i.e. | |
bool | isNull () const |
Returns true if the wrapped pointer is null. | |
bool | operator== (const LnClassPtr< T > &rhs) const |
bool | operator!= (const LnClassPtr< T > &rhs) const |
T * | operator-> () const |
LnClassPtr () | |
The default constructor. The wrapped pointer is null. | |
LnClassPtr (T *rhs) | |
Construct a LnPtr<T> setting the wrapped pointer to rhs. | |
LnClassPtr< T > & | operator= (const LnClassPtr< T > &rhs) |
The copy assignment operator. | |
LnClassPtr< T > & | operator= (T *rhs) |
Sets the wrapped pointer to rhs. | |
T * | operator-> () const |
Applies operator-> to the wrapped pointer. | |
bool | operator== (const LnPtr< T > &rhs) const |
Are the two pointers (not the values to which they point) equal? | |
bool | operator!= (const LnPtr< T > &rhs) const |
Are the two pointers not equal? | |
Protected Attributes | |
T * | ptr |
T * | ptr |
The template class LnClassPtr<T> is derived from LnPtr<T>. It provides a reference counted wrapper around a pointer to type T (a T*). The type T MUST be a user-defined type, not an intrinsic type. Given this restriction, we can supply an operator->().
LnClassPtr< T >::LnClassPtr | ( | ) | [inline] |
The default constructor. The wrapped pointer is null.
LnClassPtr< T >::LnClassPtr | ( | T * | rhs | ) | [inline, explicit] |
Construct a LnPtr<T> setting the wrapped pointer to rhs.
LnClassPtr< T >::~LnClassPtr | ( | ) | [inline] |
LnClassPtr< T >::LnClassPtr | ( | ) |
The default constructor. The wrapped pointer is null.
LnClassPtr< T >::LnClassPtr | ( | T * | rhs | ) | [explicit] |
Construct a LnPtr<T> setting the wrapped pointer to rhs.
LnClassPtr< T >::~LnClassPtr | ( | ) |
Applies operator-> to the wrapped pointer.
LnClassPtr< T >::LnClassPtr | ( | ) |
The default constructor. The wrapped pointer is null.
LnClassPtr< T >::LnClassPtr | ( | T * | rhs | ) | [explicit] |
Construct a LnPtr<T> setting the wrapped pointer to rhs.
LnClassPtr< T > & LnClassPtr< T >::operator= | ( | const LnClassPtr< T > & | rhs | ) | [inline] |
The copy assignment operator.
The contained pointer is set to the one wrapped by rhs. The reference count is decremented on this object and the reference count is incremented for the newly wrapped pointer.
References LnClassPtr< T >::ptr, LnClassPtr< T >::ucnt, and LnClassPtr< T >::unique().
LnClassPtr< T > & LnClassPtr< T >::operator= | ( | T * | rhs | ) | [inline] |
Sets the wrapped pointer to rhs.
Decrements the count on the previously wrapped pointer and deletes it if there was only one reference.
Reimplemented from LnPtr< T >.
References LnClassPtr< T >::ptr, and LnClassPtr< T >::unique().
bool LnClassPtr< T >::unique | ( | ) | const [inline] |
Returns true if only one reference to the wrapped pointer.
Reimplemented from LnPtr< T >.
References UseCount::unique().
Referenced by LnClassPtr< T >::operator=().
int LnClassPtr< T >::linkCount | ( | ) | const [inline] |
Returns the number of references to the wrapped pointer.
Reimplemented from LnPtr< T >.
References UseCount::linkCount().
T & LnClassPtr< T >::operator* | ( | ) | const [inline] |
Returns a reference to the value pointed to by the wrapped pointer; i.e.
dereferencing this LnPtr<T>, returns the dereferenced wrapped pointer. It is an error if the wrapped pointer is null.
Reimplemented from LnPtr< T >.
References BL_ASSERT, and LnClassPtr< T >::ptr.
bool LnClassPtr< T >::isNull | ( | ) | const [inline] |
Returns true if the wrapped pointer is null.
Reimplemented from LnPtr< T >.
References LnClassPtr< T >::ptr.
bool LnClassPtr< T >::operator== | ( | const LnClassPtr< T > & | rhs | ) | const [inline] |
References LnClassPtr< T >::ptr.
bool LnClassPtr< T >::operator!= | ( | const LnClassPtr< T > & | rhs | ) | const [inline] |
References LnClassPtr< T >::ptr.
T * LnClassPtr< T >::operator-> | ( | ) | const [inline] |
References LnClassPtr< T >::ptr.
LnClassPtr<T>& LnClassPtr< T >::operator= | ( | const LnClassPtr< T > & | rhs | ) |
The copy assignment operator.
The contained pointer is set to the one wrapped by rhs. The reference count is decremented on this object and the reference count is incremented for the newly wrapped pointer.
LnClassPtr<T>& LnClassPtr< T >::operator= | ( | T * | rhs | ) |
Sets the wrapped pointer to rhs.
Decrements the count on the previously wrapped pointer and deletes it if there was only one reference.
Reimplemented from LnPtr< T >.
bool LnClassPtr< T >::unique | ( | ) | const |
int LnClassPtr< T >::linkCount | ( | ) | const |
T& LnClassPtr< T >::operator* | ( | ) | const |
Returns a reference to the value pointed to by the wrapped pointer; i.e.
dereferencing this LnPtr<T>, returns the dereferenced wrapped pointer. It is an error if the wrapped pointer is null.
Reimplemented from LnPtr< T >.
bool LnClassPtr< T >::isNull | ( | ) | const |
bool LnClassPtr< T >::operator== | ( | const LnClassPtr< T > & | rhs | ) | const |
bool LnClassPtr< T >::operator!= | ( | const LnClassPtr< T > & | rhs | ) | const |
T* LnClassPtr< T >::operator-> | ( | ) | const |
LnClassPtr<T>& LnClassPtr< T >::operator= | ( | const LnClassPtr< T > & | rhs | ) |
The copy assignment operator.
The contained pointer is set to the one wrapped by rhs. The reference count is decremented on this object and the reference count is incremented for the newly wrapped pointer.
LnClassPtr<T>& LnClassPtr< T >::operator= | ( | T * | rhs | ) |
Sets the wrapped pointer to rhs.
Decrements the count on the previously wrapped pointer and deletes it if there was only one reference.
Reimplemented from LnPtr< T >.
T* LnClassPtr< T >::operator-> | ( | ) | const |
Applies operator-> to the wrapped pointer.
T* LnClassPtr< T >::ptr [protected] |
Reimplemented from LnPtr< T >.
Referenced by LnClassPtr< T >::isNull(), LnClassPtr< T >::operator!=(), LnClassPtr< T >::operator*(), LnClassPtr< T >::operator->(), LnClassPtr< T >::operator=(), LnClassPtr< T >::operator==(), and LnClassPtr< T >::~LnClassPtr().
T* LnClassPtr< T >::ptr [protected] |
Reimplemented from LnPtr< T >.