#include <Pointers.H>
Public Member Functions | |
CpPtr () | |
The default constructor. The wrapped pointer is null. | |
CpPtr (T *rhs) | |
Construct a CpPtr<T> setting the wrapped pointer to rhs. | |
~CpPtr () | |
The destructor. Deletes the wrapped pointer. | |
CpPtr (const CpPtr< T > &rhs) | |
The copy constructor. | |
CpPtr< T > & | operator= (T *rhs) |
Sets the wrapped pointer to rhs. | |
CpPtr< T > & | operator= (const CpPtr< T > &rhs) |
The copy assignment operator. | |
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 null. | |
T * | release () |
Sets the wrapped pointer to null and returns the previous value. | |
bool | operator== (const CpPtr< T > &rhs) const |
Are the two pointers (not the values to which they point) equal? | |
bool | operator!= (const CpPtr< T > &rhs) const |
Are the two pointers not equal? | |
CpPtr () | |
The default constructor. The wrapped pointer is null. | |
CpPtr (T *rhs) | |
Construct a CpPtr<T> setting the wrapped pointer to rhs. | |
~CpPtr () | |
The destructor. Deletes the wrapped pointer. | |
CpPtr (const CpPtr< T > &rhs) | |
The copy constructor. | |
CpPtr< T > & | operator= (T *rhs) |
Sets the wrapped pointer to rhs. | |
CpPtr< T > & | operator= (const CpPtr< T > &rhs) |
The copy assignment operator. | |
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 null. | |
T * | release () |
Sets the wrapped pointer to null and returns the previous value. | |
bool | operator== (const CpPtr< T > &rhs) const |
Are the two pointers (not the values to which they point) equal? | |
bool | operator!= (const CpPtr< T > &rhs) const |
Are the two pointers not equal? | |
CpPtr () | |
The default constructor. The wrapped pointer is null. | |
CpPtr (T *rhs) | |
Construct a CpPtr<T> setting the wrapped pointer to rhs. | |
~CpPtr () | |
The destructor. Deletes the wrapped pointer. | |
CpPtr (const CpPtr< T > &rhs) | |
The copy constructor. | |
CpPtr< T > & | operator= (T *rhs) |
Sets the wrapped pointer to rhs. | |
CpPtr< T > & | operator= (const CpPtr< T > &rhs) |
The copy assignment operator. | |
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 null. | |
T * | release () |
Sets the wrapped pointer to null and returns the previous value. | |
bool | operator== (const CpPtr< T > &rhs) const |
Are the two pointers (not the values to which they point) equal? | |
bool | operator!= (const CpPtr< T > &rhs) const |
Are the two pointers not equal? | |
Protected Attributes | |
T * | ptr |
T * | ptr |
T * | ptr |
The template class CpPtr<T> provides a simple wrapper around a pointer to type T (T*) that builds a copy of the pointed-to object when copied from one CpPtr<T> to another. This is in contrast to a reference-counted pointer class that would maintain one pointed-to object with a reference count indicating the number of references. Hence we call this a "copied" smart pointer class. It is intended for use with any type type T, including the intrinsic types. This class does not supply an operator->(), as such an operator on intrinsic types has only recently become a part of the C++ language, and many compilers do not yet implement it.
The default constructor. The wrapped pointer is null.
Construct a CpPtr<T> setting the wrapped pointer to rhs.
The copy constructor.
If the pointer wrapped by rhs is null, the wrapped pointer is null here as well. Otherwise, the contained pointer here is set to a new'd copy of that wrapped by rhs, with the two pointed-to values being identical. This assumes that type T has a well-defined and accessible copy constructor. T must also be a concrete type, not a abstract type.
References CpPtr< T >::isNull(), and CpPtr< T >::ptr.
Construct a CpPtr<T> setting the wrapped pointer to rhs.
The copy constructor.
If the pointer wrapped by rhs is null, the wrapped pointer is null here as well. Otherwise, the contained pointer here is set to a new'd copy of that wrapped by rhs, with the two pointed-to values being identical. This assumes that type T has a well-defined and accessible copy constructor. T must also be a concrete type, not a abstract type.
Construct a CpPtr<T> setting the wrapped pointer to rhs.
The copy constructor.
If the pointer wrapped by rhs is null, the wrapped pointer is null here as well. Otherwise, the contained pointer here is set to a new'd copy of that wrapped by rhs, with the two pointed-to values being identical. This assumes that type T has a well-defined and accessible copy constructor. T must also be a concrete type, not a abstract type.
Sets the wrapped pointer to rhs.
Deletes the previously wrapped pointer.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
References CpPtr< T >::ptr.
The copy assignment operator.
If the pointer wrapped by rhs is null, the wrapped pointer is null here as well. Otherwise, the contained pointer here is set to a new'd copy of that wrapped by rhs, with the two pointed-to values being identical. This assumes that type T has a well-defined and accessible copy constructor. T must also be a concrete type, not a abstract type.
References CpPtr< T >::isNull(), and CpPtr< T >::ptr.
T & CpPtr< T >::operator* | ( | ) | const [inline] |
Returns a reference to the value pointed to by the wrapped pointer; i.e.
dereferencing this CpPtr<T>, returns the dereferenced wrapped pointer. It is an error if the wrapped pointer is null.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
References BL_ASSERT, and CpPtr< T >::ptr.
bool CpPtr< T >::isNull | ( | ) | const [inline] |
Returns true if the wrapped pointer null.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
References CpPtr< T >::ptr.
Referenced by CpPtr< T >::CpPtr(), and CpPtr< T >::operator=().
T * CpPtr< T >::release | ( | ) | [inline] |
Sets the wrapped pointer to null and returns the previous value.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
References CpPtr< T >::ptr.
Sets the wrapped pointer to rhs.
Deletes the previously wrapped pointer.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
The copy assignment operator.
If the pointer wrapped by rhs is null, the wrapped pointer is null here as well. Otherwise, the contained pointer here is set to a new'd copy of that wrapped by rhs, with the two pointed-to values being identical. This assumes that type T has a well-defined and accessible copy constructor. T must also be a concrete type, not a abstract type.
T& CpPtr< T >::operator* | ( | ) | const |
Returns a reference to the value pointed to by the wrapped pointer; i.e.
dereferencing this CpPtr<T>, returns the dereferenced wrapped pointer. It is an error if the wrapped pointer is null.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
bool CpPtr< T >::isNull | ( | ) | const |
Returns true if the wrapped pointer null.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
T* CpPtr< T >::release | ( | ) |
Sets the wrapped pointer to null and returns the previous value.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
Are the two pointers (not the values to which they point) equal?
Are the two pointers not equal?
Sets the wrapped pointer to rhs.
Deletes the previously wrapped pointer.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
The copy assignment operator.
If the pointer wrapped by rhs is null, the wrapped pointer is null here as well. Otherwise, the contained pointer here is set to a new'd copy of that wrapped by rhs, with the two pointed-to values being identical. This assumes that type T has a well-defined and accessible copy constructor. T must also be a concrete type, not a abstract type.
T& CpPtr< T >::operator* | ( | ) | const |
Returns a reference to the value pointed to by the wrapped pointer; i.e.
dereferencing this CpPtr<T>, returns the dereferenced wrapped pointer. It is an error if the wrapped pointer is null.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
bool CpPtr< T >::isNull | ( | ) | const |
Returns true if the wrapped pointer null.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
T* CpPtr< T >::release | ( | ) |
Sets the wrapped pointer to null and returns the previous value.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
Are the two pointers (not the values to which they point) equal?
Are the two pointers not equal?
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
Referenced by CpPtr< T >::CpPtr(), CpPtr< T >::isNull(), CpPtr< T >::operator!=(), CpPtr< T >::operator*(), CpPtr< T >::operator=(), CpPtr< T >::operator==(), CpPtr< T >::release(), and CpPtr< T >::~CpPtr().
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.
Reimplemented in CpClassPtr< T >, CpClassPtr< T >, CpClassPtr< RealDescriptor >, and CpClassPtr< RealDescriptor >.