CpClassPtr< T > Class Template Reference

: A Smart Pointer for User-Defined Types More...

#include <Pointers.H>

Inheritance diagram for CpClassPtr< T >:

Inheritance graph
[legend]
Collaboration diagram for CpClassPtr< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CpClassPtr ()
 The default constructor. The wrapped pointer is null.
 CpClassPtr (T *rhs)
 Construct a CpPtr<T> setting the wrapped pointer to rhs.
 ~CpClassPtr ()
 CpClassPtr (const CpClassPtr< T > &rhs)
 The copy constructor.
CpClassPtr< T > & operator= (T *rhs)
 Sets the wrapped pointer to rhs.
CpClassPtr< T > & operator= (const CpClassPtr< T > &rhs)
 The copy assignment operator.
T & operator* () const
 Applies operator-> to the wrapped pointer.
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 CpClassPtr< T > &rhs) const
bool operator!= (const CpClassPtr< T > &rhs) const
T * operator-> () const
 CpClassPtr ()
 The default constructor. The wrapped pointer is null.
 CpClassPtr (T *rhs)
 Construct a CpPtr<T> setting the wrapped pointer to rhs.
 ~CpClassPtr ()
 CpClassPtr (const CpClassPtr< T > &rhs)
 The copy constructor.
CpClassPtr< T > & operator= (T *rhs)
 Sets the wrapped pointer to rhs.
CpClassPtr< T > & operator= (const CpClassPtr< T > &rhs)
 The copy assignment operator.
T & operator* () const
 Applies operator-> to the wrapped pointer.
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 CpClassPtr< T > &rhs) const
bool operator!= (const CpClassPtr< T > &rhs) const
T * operator-> () const
 CpClassPtr ()
 The default constructor. The wrapped pointer is null.
 CpClassPtr (T *rhs)
 Construct a CpPtr<T> setting the wrapped pointer to rhs.
 CpClassPtr (const CpClassPtr< T > &rhs)
 The copy constructor.
CpClassPtr< T > & operator= (T *rhs)
 Sets the wrapped pointer to rhs.
CpClassPtr< T > & operator= (const CpClassPtr< T > &rhs)
 The copy assignment operator.
T * operator-> () const
 Applies operator-> to the wrapped pointer.
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


Detailed Description

template<class T>
class CpClassPtr< T >

: A Smart Pointer for User-Defined Types

The template class CpClassPtr<T> is derived from CpPtr<T>. It provides a simple wrapper around a pointer to type T (a T*) that "does the right thing" when copied from one CpPtr<T> to another. The type T MUST be a user-defined type, not an intrinsic type. Given this restriction, we can supply an operator->().


Constructor & Destructor Documentation

template<class T>
CpClassPtr< T >::CpClassPtr (  )  [inline]

The default constructor. The wrapped pointer is null.

template<class T>
CpClassPtr< T >::CpClassPtr ( T *  rhs  )  [inline, explicit]

Construct a CpPtr<T> setting the wrapped pointer to rhs.

template<class T>
CpClassPtr< T >::~CpClassPtr (  )  [inline]

References CpClassPtr< T >::ptr.

template<class T>
CpClassPtr< T >::CpClassPtr ( const CpClassPtr< T > &  rhs  )  [inline]

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 CpClassPtr< T >::isNull(), and CpClassPtr< T >::ptr.

template<class T>
CpClassPtr< T >::CpClassPtr (  ) 

The default constructor. The wrapped pointer is null.

template<class T>
CpClassPtr< T >::CpClassPtr ( T *  rhs  )  [explicit]

Construct a CpPtr<T> setting the wrapped pointer to rhs.

template<class T>
CpClassPtr< T >::~CpClassPtr (  ) 

template<class T>
CpClassPtr< T >::CpClassPtr ( const CpClassPtr< T > &  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.

template<class T>
CpClassPtr< T >::CpClassPtr (  ) 

The default constructor. The wrapped pointer is null.

template<class T>
CpClassPtr< T >::CpClassPtr ( T *  rhs  )  [explicit]

Construct a CpPtr<T> setting the wrapped pointer to rhs.

template<class T>
CpClassPtr< T >::CpClassPtr ( const CpClassPtr< T > &  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.


Member Function Documentation

template<class T>
CpClassPtr< T > & CpClassPtr< T >::operator= ( T *  rhs  )  [inline]

Sets the wrapped pointer to rhs.

Deletes the previously wrapped pointer.

Reimplemented from CpPtr< T >.

References CpClassPtr< T >::ptr.

template<class T>
CpClassPtr< T > & CpClassPtr< T >::operator= ( const CpClassPtr< T > &  rhs  )  [inline]

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 CpClassPtr< T >::isNull(), and CpClassPtr< T >::ptr.

template<class T>
T & CpClassPtr< T >::operator* (  )  const [inline]

Applies operator-> to the wrapped pointer.

Reimplemented from CpPtr< T >.

References BL_ASSERT, and CpClassPtr< T >::ptr.

template<class T>
bool CpClassPtr< T >::isNull (  )  const [inline]

Returns true if the wrapped pointer null.

Reimplemented from CpPtr< T >.

References CpClassPtr< T >::ptr.

Referenced by CpClassPtr< T >::CpClassPtr(), and CpClassPtr< T >::operator=().

template<class T>
T * CpClassPtr< T >::release (  )  [inline]

Sets the wrapped pointer to null and returns the previous value.

Reimplemented from CpPtr< T >.

References CpClassPtr< T >::ptr.

template<class T>
bool CpClassPtr< T >::operator== ( const CpClassPtr< T > &  rhs  )  const [inline]

References CpClassPtr< T >::ptr.

template<class T>
bool CpClassPtr< T >::operator!= ( const CpClassPtr< T > &  rhs  )  const [inline]

References CpClassPtr< T >::ptr.

template<class T>
T * CpClassPtr< T >::operator-> (  )  const [inline]

References CpClassPtr< T >::ptr.

template<class T>
CpClassPtr<T>& CpClassPtr< T >::operator= ( T *  rhs  ) 

Sets the wrapped pointer to rhs.

Deletes the previously wrapped pointer.

Reimplemented from CpPtr< T >.

template<class T>
CpClassPtr<T>& CpClassPtr< T >::operator= ( const CpClassPtr< T > &  rhs  ) 

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.

template<class T>
T& CpClassPtr< T >::operator* (  )  const

Applies operator-> to the wrapped pointer.

Reimplemented from CpPtr< T >.

template<class T>
bool CpClassPtr< T >::isNull (  )  const

Returns true if the wrapped pointer null.

Reimplemented from CpPtr< T >.

template<class T>
T* CpClassPtr< T >::release (  ) 

Sets the wrapped pointer to null and returns the previous value.

Reimplemented from CpPtr< T >.

template<class T>
bool CpClassPtr< T >::operator== ( const CpClassPtr< T > &  rhs  )  const

template<class T>
bool CpClassPtr< T >::operator!= ( const CpClassPtr< T > &  rhs  )  const

template<class T>
T* CpClassPtr< T >::operator-> (  )  const

template<class T>
CpClassPtr<T>& CpClassPtr< T >::operator= ( T *  rhs  ) 

Sets the wrapped pointer to rhs.

Deletes the previously wrapped pointer.

Reimplemented from CpPtr< T >.

template<class T>
CpClassPtr<T>& CpClassPtr< T >::operator= ( const CpClassPtr< T > &  rhs  ) 

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.

template<class T>
T* CpClassPtr< T >::operator-> (  )  const

Applies operator-> to the wrapped pointer.

template<class T>
bool CpPtr< T >::operator== ( const CpPtr< T > &  rhs  )  const [inline, inherited]

Are the two pointers (not the values to which they point) equal?

References CpPtr< T >::ptr.

template<class T>
bool CpPtr< T >::operator!= ( const CpPtr< T > &  rhs  )  const [inline, inherited]

Are the two pointers not equal?

References CpPtr< T >::ptr.


Member Data Documentation

template<class T>
T* CpClassPtr< T >::ptr [protected]

template<class T>
T* CpClassPtr< T >::ptr [protected]

Reimplemented from CpPtr< T >.


The documentation for this class was generated from the following files:

Generated on Fri Nov 21 10:11:01 2008 for AMRParticlePaths by  doxygen 1.5.5