UautoPtr< 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 Types

typedef T Type
 

Public Member Functions

 UautoPtr (T *=nullptr)
 Store object pointer. More...
 
 UautoPtr (const UautoPtr< T > &)
 Copy constructor. More...
 
bool empty () const
 Return true if the UautoPtr is empty (ie, no pointer set) More...
 
bool valid () const
 Return true if the UautoPtr 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 *=nullptr)
 Set pointer to that given. More...
 
void clear ()
 Set pointer to nullptr. More...
 
Toperator() ()
 Return reference to the object data. More...
 
const Toperator() () const
 Return const reference to the object data. 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= (T *)
 Take over the object pointer from parameter. More...
 
void operator= (const UautoPtr< T > &)
 Take over the object pointer from parameter. More...
 

Detailed Description

template<class T>
class Foam::UautoPtr< 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 50 of file UautoPtr.H.

Member Typedef Documentation

◆ Type

typedef T Type

Definition at line 60 of file UautoPtr.H.

Constructor & Destructor Documentation

◆ UautoPtr() [1/2]

UautoPtr ( T p = nullptr)
inlineexplicit

Store object pointer.

Definition at line 32 of file UautoPtrI.H.

◆ UautoPtr() [2/2]

UautoPtr ( const UautoPtr< T > &  ap)
inline

Copy constructor.

Definition at line 39 of file UautoPtrI.H.

Member Function Documentation

◆ empty()

bool empty ( ) const
inline

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

Definition at line 48 of file UautoPtrI.H.

◆ valid()

bool valid ( ) const
inline

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

Definition at line 55 of file UautoPtrI.H.

◆ ptr()

T * ptr ( )
inline

Return object pointer for reuse.

Definition at line 62 of file UautoPtrI.H.

Referenced by UautoPtr< T >::operator=().

Here is the caller graph for this function:

◆ set()

void set ( T p)
inline

Set pointer to that given.

If object pointer already set issue a FatalError

Definition at line 69 of file UautoPtrI.H.

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

Here is the call graph for this function:

◆ reset()

void reset ( T p = nullptr)
inline

Set pointer to that given.

Definition at line 84 of file UautoPtrI.H.

References p.

Referenced by UautoPtr< T >::clear(), and UautoPtr< T >::operator=().

Here is the caller graph for this function:

◆ clear()

void clear ( )
inline

Set pointer to nullptr.

Definition at line 91 of file UautoPtrI.H.

References UautoPtr< T >::reset().

Here is the call graph for this function:

◆ operator()() [1/2]

T & operator() ( )
inline

Return reference to the object data.

Definition at line 100 of file UautoPtrI.H.

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

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator()() [2/2]

const T & operator() ( ) const
inline

Return const reference to the object data.

Definition at line 115 of file UautoPtrI.H.

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

Here is the call graph for this function:

◆ operator*() [1/2]

T & operator* ( )
inline

Return reference to the object data.

Definition at line 130 of file UautoPtrI.H.

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

Here is the call graph for this function:

◆ operator*() [2/2]

const T & operator* ( ) const
inline

Return const reference to the object data.

Definition at line 145 of file UautoPtrI.H.

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

Here is the call graph for this function:

◆ operator const T &()

operator const T & ( ) const
inline

Const cast to the underlying type reference.

Definition at line 160 of file UautoPtrI.H.

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

Here is the call graph for this function:

◆ operator->() [1/2]

T * operator-> ( )
inline

Return object pointer.

Definition at line 167 of file UautoPtrI.H.

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

Here is the call graph for this function:

◆ operator->() [2/2]

const T * operator-> ( ) const
inline

Return const object pointer.

Definition at line 182 of file UautoPtrI.H.

◆ operator=() [1/2]

void operator= ( T p)
inline

Take over the object pointer from parameter.

Definition at line 189 of file UautoPtrI.H.

References UautoPtr< T >::reset().

Here is the call graph for this function:

◆ operator=() [2/2]

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

Take over the object pointer from parameter.

Definition at line 196 of file UautoPtrI.H.

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

Here is the call graph for this function:

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