Classes | Public Member Functions | List of all members
tmpNrc< T > Class Template Reference

A class for managing temporary objects without reference counting. More...

Classes

class  refCount
 

Public Member Functions

 tmpNrc (T *=0)
 Store object pointer. More...
 
 tmpNrc (const T &)
 Store object const reference. More...
 
 tmpNrc (const tmpNrc< T > &)
 Construct copy and increment reference count. More...
 
 tmpNrc (const tmpNrc< T > &, bool allowTransfer)
 Construct copy transferring content of temporary if required. More...
 
 ~tmpNrc ()
 Destructor: deletes temporary object when the reference count is 0. More...
 
bool isTmp () const
 Return true if this is really a temporary object. More...
 
bool empty () const
 Return true if this temporary object empty,. More...
 
bool valid () const
 Is this temporary object valid,. More...
 
word typeName () const
 Return the type name of the tmpNrc. More...
 
Tref ()
 Return non-const reference or generate a fatal error. More...
 
Tptr () const
 Return tmpNrc pointer for reuse. More...
 
void clear () const
 If object pointer points to valid object: More...
 
const Toperator() () const
 Const dereference operator. 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 *)
 Assignment to pointer changing this tmpNrc to a temporary T. More...
 
void operator= (const tmpNrc< T > &)
 Assignment transferring the temporary T to this tmpNrc. More...
 

Detailed Description

template<class T>
class Foam::tmpNrc< T >

A class for managing temporary objects without reference counting.

Source files
See also
Foam::autoPtr

Definition at line 52 of file tmpNrc.H.

Constructor & Destructor Documentation

◆ tmpNrc() [1/4]

tmpNrc ( T tPtr = 0)
inlineexplicit

Store object pointer.

Definition at line 32 of file tmpNrcI.H.

Referenced by tmpNrc< T >::refCount::refCount().

Here is the caller graph for this function:

◆ tmpNrc() [2/4]

tmpNrc ( const T tRef)
inline

Store object const reference.

Definition at line 40 of file tmpNrcI.H.

◆ tmpNrc() [3/4]

tmpNrc ( const tmpNrc< T > &  t)
inline

Construct copy and increment reference count.

Definition at line 48 of file tmpNrcI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, tmpNrc< T >::isTmp(), and tmpNrc< T >::typeName().

Here is the call graph for this function:

◆ tmpNrc() [4/4]

tmpNrc ( const tmpNrc< T > &  t,
bool  allowTransfer 
)
inline

Construct copy transferring content of temporary if required.

Definition at line 70 of file tmpNrcI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, tmpNrc< T >::isTmp(), and tmpNrc< T >::typeName().

Here is the call graph for this function:

◆ ~tmpNrc()

~tmpNrc ( )
inline

Destructor: deletes temporary object when the reference count is 0.

Definition at line 99 of file tmpNrcI.H.

References tmpNrc< T >::clear().

Referenced by tmpNrc< T >::refCount::refCount().

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

Member Function Documentation

◆ isTmp()

bool isTmp ( ) const
inline

Return true if this is really a temporary object.

Definition at line 108 of file tmpNrcI.H.

Referenced by tmpNrc< T >::clear(), tmpNrc< T >::empty(), tmpNrc< T >::operator()(), tmpNrc< T >::operator->(), tmpNrc< T >::operator=(), tmpNrc< T >::ptr(), tmpNrc< T >::ref(), tmpNrc< T >::refCount::refCount(), tmpNrc< T >::tmpNrc(), and tmpNrc< T >::valid().

Here is the caller graph for this function:

◆ empty()

bool empty ( ) const
inline

Return true if this temporary object empty,.

ie, a temporary without allocation

Definition at line 115 of file tmpNrcI.H.

References tmpNrc< T >::isTmp().

Referenced by tmpNrc< T >::refCount::refCount().

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

◆ valid()

bool valid ( ) const
inline

Is this temporary object valid,.

ie, it is a reference or a temporary that has been allocated

Definition at line 122 of file tmpNrcI.H.

References tmpNrc< T >::isTmp().

Referenced by tmpNrc< T >::refCount::refCount().

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

◆ typeName()

Foam::word typeName ( ) const
inline

Return the type name of the tmpNrc.

constructed from the type name of T

Definition at line 129 of file tmpNrcI.H.

References Foam::name(), and Foam::T().

Referenced by tmpNrc< T >::operator()(), tmpNrc< T >::operator->(), tmpNrc< T >::operator=(), tmpNrc< T >::ptr(), tmpNrc< T >::ref(), tmpNrc< T >::refCount::refCount(), and tmpNrc< T >::tmpNrc().

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

◆ ref()

T & ref ( )
inline

Return non-const reference or generate a fatal error.

if the object is const.

Definition at line 136 of file tmpNrcI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, tmpNrc< T >::isTmp(), and tmpNrc< T >::typeName().

Referenced by tmpNrc< T >::refCount::refCount().

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

◆ ptr()

T * ptr ( ) const
inline

Return tmpNrc pointer for reuse.

Returns a clone if the object is not a temporary

Definition at line 160 of file tmpNrcI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, tmpNrc< T >::isTmp(), Foam::T(), and tmpNrc< T >::typeName().

Referenced by tmpNrc< T >::refCount::refCount().

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

◆ clear()

void clear ( ) const
inline

If object pointer points to valid object:

delete object and set pointer to nullptr

Definition at line 184 of file tmpNrcI.H.

References tmpNrc< T >::isTmp().

Referenced by tmpNrc< T >::operator=(), tmpNrc< T >::refCount::refCount(), and tmpNrc< T >::~tmpNrc().

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

◆ operator()()

const T & operator() ( ) const
inline

Const dereference operator.

Definition at line 197 of file tmpNrcI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, tmpNrc< T >::isTmp(), and tmpNrc< T >::typeName().

Referenced by tmpNrc< T >::operator const T &(), and tmpNrc< T >::refCount::refCount().

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

◆ operator const T &()

operator const T & ( ) const
inline

Const cast to the underlying type reference.

Definition at line 215 of file tmpNrcI.H.

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

Here is the call graph for this function:

◆ operator->() [1/2]

T * operator-> ( )
inline

Return object pointer.

Definition at line 222 of file tmpNrcI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, tmpNrc< T >::isTmp(), and tmpNrc< T >::typeName().

Referenced by tmpNrc< T >::refCount::refCount().

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

Definition at line 245 of file tmpNrcI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, tmpNrc< T >::isTmp(), and tmpNrc< T >::typeName().

Here is the call graph for this function:

◆ operator=() [1/2]

void operator= ( T tPtr)
inline

Assignment to pointer changing this tmpNrc to a temporary T.

Definition at line 259 of file tmpNrcI.H.

References Foam::abort(), tmpNrc< T >::clear(), Foam::FatalError, FatalErrorInFunction, and tmpNrc< T >::typeName().

Referenced by tmpNrc< T >::refCount::refCount().

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

◆ operator=() [2/2]

void operator= ( const tmpNrc< T > &  t)
inline

Assignment transferring the temporary T to this tmpNrc.

Definition at line 276 of file tmpNrcI.H.

References Foam::abort(), tmpNrc< T >::clear(), Foam::FatalError, FatalErrorInFunction, tmpNrc< T >::isTmp(), Foam::name(), Foam::T(), and tmpNrc< T >::typeName().

Here is the call graph for this function:

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