OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

autoPtr< T > Class Template Reference

An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and with pointer allocation checking on access. More...

Collaboration diagram for autoPtr< T >:

List of all members.


Public Member Functions

 autoPtr (T *=0)
 Store object pointer.
 autoPtr (const autoPtr< T > &)
 Construct as copy by transfering pointer to this autoPtr and.
 ~autoPtr ()
 Delete object if pointer is not NULL.
bool empty () const
 Return true if the autoPtr is empty (ie, no pointer set).
bool valid () const
 Return true if the autoPtr valid (ie, the pointer is set).
T * ptr ()
 Return object pointer for reuse.
void set (T *)
 Set pointer to that given.
void reset (T *=0)
 If object pointer already set, delete object and set to given pointer.
void clear ()
 Delete object and set pointer to NULL, if the pointer is valid.
T & operator() ()
 Return reference to the object data.
const T & operator() () const
 Return const reference to the object data.
 operator const T & () const
T * operator-> ()
 Return object pointer.
const T * operator-> () const
 Return const object pointer.
void operator= (const autoPtr< T > &)
 Take over object pointer from parameter.

Detailed Description

template<class T>
class Foam::autoPtr< T >

An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and with pointer allocation checking on access.

Source files

Definition at line 46 of file autoPtr.H.


Constructor & Destructor Documentation

autoPtr ( T *  p = 0  )  [inline, explicit]

Store object pointer.

Definition at line 23 of file autoPtrI.H.

autoPtr ( const autoPtr< T > &  ap  )  [inline]

Construct as copy by transfering pointer to this autoPtr and.

setting the arguments pointer to NULL

Definition at line 30 of file autoPtrI.H.

~autoPtr (  )  [inline]

Delete object if pointer is not NULL.

Definition at line 39 of file autoPtrI.H.


Member Function Documentation

bool empty (  )  const [inline]

Return true if the autoPtr is empty (ie, no pointer set).

Definition at line 48 of file autoPtrI.H.

References autoPtr< T >::clear().

Referenced by sampledCuttingPlane::faces(), sampledIsoSurfaceCell::faces(), sampledIsoSurface::faces(), distanceSurface::faces(), and directMappedPatchBase::map().

Here is the call graph for this function:

Here is the caller graph for this function:

bool valid (  )  const [inline]

Return true if the autoPtr valid (ie, the pointer is set).

Definition at line 55 of file autoPtrI.H.

Referenced by forceCoeffs::execute().

Here is the caller graph for this function:

T * ptr (  )  [inline]

Return object pointer for reuse.

Definition at line 62 of file autoPtrI.H.

Referenced by autoPtr< T >::set().

Here is the caller graph for this function:

void set ( T *  p  )  [inline]

Set pointer to that given.

If object pointer already set issue a FatalError.

Definition at line 71 of file autoPtrI.H.

References autoPtr< T >::ptr(), and Foam::T().

Here is the call graph for this function:

void reset ( T *  p = 0  )  [inline]

If object pointer already set, delete object and set to given pointer.

Definition at line 85 of file autoPtrI.H.

Referenced by polyMeshAdder::add(), autoHexMeshDriver::autoHexMeshDriver(), sampledIsoSurfaceCell::faces(), sampledCuttingPlane::faces(), sampledIsoSurface::faces(), distanceSurface::faces(), distributedTriSurfaceMesh::findNearest(), and autoPtr< T >::operator()().

Here is the caller graph for this function:

void clear (  )  [inline]

Delete object and set pointer to NULL, if the pointer is valid.

Definition at line 97 of file autoPtrI.H.

Referenced by autoPtr< T >::empty(), distributedTriSurfaceMesh::globalTris(), triSurfaceMesh::movePoints(), directMappedPatchBase::sampleMesh(), and triSurfaceMesh::tree().

Here is the caller graph for this function:

T & operator() (  )  [inline]

Return reference to the object data.

Definition at line 106 of file autoPtrI.H.

References autoPtr< T >::reset().

Referenced by autoPtr< T >::operator->().

Here is the call graph for this function:

Here is the caller graph for this function:

const T & operator() (  )  const [inline]

Return const reference to the object data.

Definition at line 120 of file autoPtrI.H.

operator const T & (  )  const [inline]

Definition at line 150 of file autoPtrI.H.

T * operator-> (  )  [inline]

Return object pointer.

Definition at line 157 of file autoPtrI.H.

References autoPtr< T >::operator()().

Here is the call graph for this function:

const T * operator-> (  )  const [inline]

Return const object pointer.

Definition at line 171 of file autoPtrI.H.

void operator= ( const autoPtr< T > &  ap  )  [inline]

Take over object pointer from parameter.

Definition at line 178 of file autoPtrI.H.


The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd