Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

PP_CpPtr< T > Class Template Reference

: A Smart Pointer for Intrinsic or User-Defined Types for ParmParse More...

#include <ParmParse.H>

Inheritance diagram for PP_CpPtr< T >:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PP_CpPtr ()
 : The default constructor. The wrapped pointer is null.

 PP_CpPtr (T *rhs)
 : Construct a PP_CpPtr<T> setting the wrapped pointer to rhs.

 ~PP_CpPtr ()
 : The destructor. Deletes the wrapped pointer.

 PP_CpPtr (const PP_CpPtr< T > &rhs)
PP_CpPtr< T > & operator= (T *rhs)
PP_CpPtr< T > & operator= (const PP_CpPtr< T > &rhs)
T & operator * () const
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 PP_CpPtr< T > &rhs) const
 : Are the two pointers (not the values to which they point) equal?

bool operator!= (const PP_CpPtr< T > &rhs) const
 : Are the two pointers not equal?


Protected Attributes

T * ptr

Detailed Description

template<class T>
class PP_CpPtr< T >

: A Smart Pointer for Intrinsic or User-Defined Types for ParmParse

The template class PP_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 PP_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.

This is a convenience class for ParmParse and will not be in any way supported by anyone at ANAG.


Constructor & Destructor Documentation

template<class T>
PP_CpPtr< T >::PP_CpPtr  )  [inline]
 

: The default constructor. The wrapped pointer is null.

template<class T>
PP_CpPtr< T >::PP_CpPtr T *  rhs  )  [inline]
 

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

template<class T>
PP_CpPtr< T >::~PP_CpPtr  )  [inline]
 

: The destructor. Deletes the wrapped pointer.

template<class T>
PP_CpPtr< T >::PP_CpPtr const PP_CpPtr< 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.


Member Function Documentation

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

: Returns true if the wrapped pointer null.

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

: Returns a reference to the value pointed to by the wrapped pointer; i.e. dereferencing this PP_CpPtr<T>, returns the dereferenced wrapped pointer. It is an error if the wrapped pointer is null.

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

: Are the two pointers not equal?

template<class T>
PP_CpPtr< T > & PP_CpPtr< T >::operator= const PP_CpPtr< 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.

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

: Sets the wrapped pointer to rhs. Deletes the previously wrapped pointer.

Reimplemented in PP_CpClassPtr< T >.

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

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

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

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


Member Data Documentation

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


The documentation for this class was generated from the following file:
Generated on Wed Jun 2 13:59:00 2004 for Chombo&INSwithParticles by doxygen 1.3.2