FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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...

#include <OpenFOAM/autoPtr.H>


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 51 of file autoPtr.H.

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.

Constructor & Destructor Documentation

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

Store object pointer.

Definition at line 31 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 38 of file autoPtrI.H.

~autoPtr (  ) [inline]

Delete object if pointer is not NULL.

Definition at line 47 of file autoPtrI.H.

References clear().


Member Function Documentation

T * ptr (  ) [inline]

Return object pointer for reuse.

Definition at line 70 of file autoPtrI.H.

References Foam::T().

Referenced by pairPotential::scaleEnergy(), triSurfaceMesh::setField(), and regIOobject::store().

void set ( T *   p  ) [inline]

Set pointer to that given.

If object pointer already set issue a FatalError.

Definition at line 79 of file autoPtrI.H.

References Foam::abort(), Foam::FatalError, FatalErrorIn, and p.

void clear (  ) [inline]

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

Definition at line 105 of file autoPtrI.H.

Referenced by meshRefinement::distribute(), and spray::evolve().

T & operator() (  ) [inline]

Return reference to the object data.

Definition at line 114 of file autoPtrI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorIn.

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

Return const reference to the object data.

Definition at line 128 of file autoPtrI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorIn.

operator const T & (  ) const [inline]

Definition at line 158 of file autoPtrI.H.

T * operator-> (  ) [inline]

Return object pointer.

Definition at line 165 of file autoPtrI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorIn.

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

Return const object pointer.

Definition at line 179 of file autoPtrI.H.

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

Take over object pointer from parameter.

Definition at line 186 of file autoPtrI.H.


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