Public Member Functions | List of all members
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...

Public Member Functions

 autoPtr (T *=0)
 Store object pointer. More...
 
 autoPtr (const autoPtr< T > &)
 Construct as copy by transferring pointer to this autoPtr and. More...
 
 autoPtr (const autoPtr< T > &, const bool reUse)
 Construct either by transferring pointer or cloning. Should. More...
 
 ~autoPtr ()
 Destructor, delete object if pointer is not NULL. More...
 
bool empty () const
 Return true if the autoPtr is empty (ie, no pointer set). More...
 
bool valid () const
 Return true if the autoPtr valid (ie, the pointer is set). More...
 
Tptr ()
 Return object pointer for reuse. More...
 
void set (T *)
 Set pointer to that given. More...
 
void reset (T *=0)
 If object pointer already set, delete object and set to given. More...
 
void clear ()
 Delete object (if the pointer is valid) and set pointer to NULL. More...
 
Toperator() ()
 Return reference to the object data. More...
 
const Toperator() () const
 Return const reference to the object data. More...
 
 operator const T & () const
 Const cast to the underlying type reference. More...
 
Toperator-> ()
 Return object pointer. More...
 
const Toperator-> () const
 Return const object pointer. More...
 
void operator= (const autoPtr< T > &)
 Take over the object pointer from parameter. More...
 

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 117 of file PtrList.H.

Constructor & Destructor Documentation

autoPtr ( T p = 0)
inlineexplicit

Store object pointer.

Definition at line 32 of file autoPtrI.H.

autoPtr ( const autoPtr< T > &  ap)
inline

Construct as copy by transferring pointer to this autoPtr and.

setting the arguments pointer to NULL

Definition at line 39 of file autoPtrI.H.

autoPtr ( const autoPtr< T > &  ap,
const bool  reUse 
)
inline

Construct either by transferring pointer or cloning. Should.

only be called with type that supports cloning.

Definition at line 48 of file autoPtrI.H.

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

Here is the call graph for this function:

~autoPtr ( )
inline

Destructor, delete object if pointer is not NULL.

Definition at line 67 of file autoPtrI.H.

References autoPtr< T >::clear().

Here is the call graph for this function:

Member Function Documentation

bool empty ( ) const
inline

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

Definition at line 76 of file autoPtrI.H.

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

Here is the caller graph for this function:

bool valid ( ) const
inline
T * ptr ( )
inline

Return object pointer for reuse.

Definition at line 90 of file autoPtrI.H.

References Foam::T().

Referenced by autoPtr< T >::autoPtr(), autoPtr< T >::operator=(), PtrListDictionary< T >::set(), triSurfaceMesh::setField(), and regIOobject::store().

Here is the call graph for this function:

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 99 of file autoPtrI.H.

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

Referenced by searchablePlateFeatures::features().

Here is the call graph for this function:

Here is the caller graph for this function:

void reset ( T p = 0)
inline
void clear ( )
inline

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

Definition at line 126 of file autoPtrI.H.

References autoPtr< T >::reset().

Referenced by polyMeshAdder::add(), meshRefinement::distribute(), and autoPtr< T >::~autoPtr().

Here is the call graph for this function:

Here is the caller graph for this function:

T & operator() ( )
inline

Return reference to the object data.

Definition at line 135 of file autoPtrI.H.

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

Referenced by autoPtr< T >::operator const T &().

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 150 of file autoPtrI.H.

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

Here is the call graph for this function:

operator const T & ( ) const
inline

Const cast to the underlying type reference.

Definition at line 165 of file autoPtrI.H.

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

Here is the call graph for this function:

T * operator-> ( )
inline

Return object pointer.

Definition at line 172 of file autoPtrI.H.

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

Here is the call graph for this function:

const T * operator-> ( ) const
inline

Return const object pointer.

Definition at line 187 of file autoPtrI.H.

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

Take over the object pointer from parameter.

Definition at line 194 of file autoPtrI.H.

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

Here is the call graph for this function:


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