#include <DynObjHolder.hpp>
Public Member Functions | |
DynObjHolder (T *pdo, HoldMode mode) | |
DynObjHolder & | Assign (T *pdo, HoldMode mode) |
T * | Get () const |
T & | operator() () const |
T & | operator* () const |
T * | operator-> () const |
bool | operator! () const |
DynObjHolder & | operator= (T *pdo) |
bool | IsOk () const |
void | Release () |
Protected Attributes | |
union { | |
T * m_pdo | |
}; | |
HoldMode | m_mode |
Holds a DynI (or derived type) and releases/destroyes it when holder goes out of scope. It is practical for handling local DynObj:s. By default it takes over a DynObj in the constructor. Alternatively it can create a new object from a library.
T | The type of object to hold |
DynObjHolder< T >::DynObjHolder | ( | T * | pdo, | |
HoldMode | mode | |||
) | [inline] |
Different two argument constructor.
pdo | is a pointer to an existing DynObj to take over. | |
mode | determines how the object is released |
DynObjHolder& DynObjHolder< T >::Assign | ( | T * | pdo, | |
HoldMode | mode | |||
) | [inline] |
T* DynObjHolder< T >::Get | ( | ) | const [inline] |
Get a pointer to the held object.
T& DynObjHolder< T >::operator() | ( | ) | const [inline] |
Get a reference to the held object.
T* DynObjHolder< T >::operator-> | ( | ) | const [inline] |
Get a pointer to the held object.
bool DynObjHolder< T >::operator! | ( | ) | const [inline] |
Operator! (test if NULL object held)
DynObjHolder& DynObjHolder< T >::operator= | ( | T * | pdo | ) | [inline] |
Assign a new DynObj to this holder.
bool DynObjHolder< T >::IsOk | ( | ) | const [inline] |
Return true if we are holding an object.
void DynObjHolder< T >::Release | ( | ) | [inline] |
Release currently held object