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... | |
T & | ref () |
Return non-const reference or generate a fatal error. More... | |
T * | ptr () const |
Return tmpNrc pointer for reuse. More... | |
void | clear () const |
If object pointer points to valid object: More... | |
const T & | operator() () const |
Const dereference operator. More... | |
operator const T & () const | |
Const cast to the underlying type reference. More... | |
T * | operator-> () |
Return object pointer. More... | |
const T * | operator-> () 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... | |
A class for managing temporary objects without reference counting.
Store object pointer.
Definition at line 32 of file tmpNrcI.H.
Referenced by tmpNrc< T >::refCount::refCount().
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().
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
inline |
Const cast to the underlying type reference.
Definition at line 215 of file tmpNrcI.H.
References tmpNrc< 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().
|
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().
|
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().
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().