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

PP_LnPtr< T > Class Template Reference

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

#include <ParmParse.H>

Inheritance diagram for PP_LnPtr< T >:

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

Collaboration graph
[legend]
List of all members.

Public Methods

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

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

PP_LnPtr< T > & operator= (const PP_LnPtr< T > &rhs)
PP_LnPtr< T > & operator= (T *rhs)
 ~PP_LnPtr ()
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
bool isNull () const
 : Returns true if the wrapped pointer is null.

bool operator== (const PP_LnPtr< T > &rhs) const
 : Are the two pointers (not the values to which they point) equal?

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


Protected Attributes

T * ptr

Detailed Description

template<class T>
class PP_LnPtr< T >

A Reference Counted Smart Pointer for Intrinsic or User-Defined Types for ParmParse.

The template class PP_LnPtr<T> provides a reference counted wrapper around a pointer to type T (a T*). This "smart" pointer is intended for use with any type type T, including the intrinsic types. For this reason, we do 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_LnPtr< T >::PP_LnPtr   [inline]
 

: The default constructor. The wrapped pointer is null.

template<class T>
PP_LnPtr< T >::PP_LnPtr T *    rhs [inline]
 

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

template<class T>
PP_LnPtr< T >::~PP_LnPtr   [inline]
 

: The destructor -- decrements the reference count and deletes the wrapped pointer if there is only one reference.


Member Function Documentation

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

: Returns true if the wrapped pointer is null.

template<class T>
int PP_LnPtr< T >::linkCount   const [inline]
 

: Returns the number of references to the wrapped pointer.

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

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

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

: Are the two pointers not equal?

template<class T>
PP_LnPtr<T>& PP_LnPtr< 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 in PP_LnClassPtr< T >, and PP_LnClassPtr< PP_StringRep >.

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

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

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

template<class T>
bool PP_LnPtr< T >::unique   const [inline]
 

: Returns true if only one reference to the wrapped pointer.


Member Data Documentation

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


The documentation for this class was generated from the following file:
Generated on Wed Jan 19 17:56:33 2005 for Chombo&INSwithParticles by doxygen1.2.16