RefCntDynObjPtr< T > Struct Template Reference
[Templates for DynI and friends]

#include <RefCntDynObjPtr.hpp>

List of all members.

Public Member Functions

 RefCntDynObjPtr (T *pt=NULL, bool do_add_ref=true)
RefCntDynObjPtroperator= (T *pt)
RefCntDynObjPtroperator= (const RefCntDynObjPtr< T > &dop)
 operator T * ()
 operator T & ()
T & operator* ()
T * operator-> ()
T * Get ()
bool IsOk ()
bool Release ()

Protected Member Functions

bool DoAssign (T *pt, bool do_add_ref)
void DoRelease ()

Protected Attributes

T * m_pt


Detailed Description

template<class T>
struct RefCntDynObjPtr< T >

This is a smart pointer class for a ref counted object (RefCountI). It releases the ref in the destructor. It is not safe in case of a module being unloaded, since we're not tracking object lifetime. DynObjPtr<T> combines the two and is safer when plugin unload is possible at any time.

Constructor & Destructor Documentation

template<class T>
RefCntDynObjPtr< T >::RefCntDynObjPtr ( T *  pt = NULL,
bool  do_add_ref = true 
) [inline, explicit]

Two argument constructor.

Parameters:
pt The DynObj we want to own. Should implement RefCountI.
do_add_ref If we should add a reference or not (default value: true).


Member Function Documentation

template<class T>
RefCntDynObjPtr& RefCntDynObjPtr< T >::operator= ( T *  pt  )  [inline]

Assignment operator.

Parameters:
pt The DynObj we want to own. Should implement RefCountI.

template<class T>
RefCntDynObjPtr& RefCntDynObjPtr< T >::operator= ( const RefCntDynObjPtr< T > &  dop  )  [inline]

Assignment operator.

Parameters:
dop The managed DynObj we want to own. Should implement RefCountI.

template<class T>
RefCntDynObjPtr< T >::operator T * (  )  [inline]

Access raw pointer.

template<class T>
RefCntDynObjPtr< T >::operator T & (  )  [inline]

Access as reference.

template<class T>
T& RefCntDynObjPtr< T >::operator* (  )  [inline]

Access as reference.

template<class T>
T* RefCntDynObjPtr< T >::operator-> (  )  [inline]

Access raw pointer.

template<class T>
T* RefCntDynObjPtr< T >::Get (  )  [inline]

Access raw pointer.

template<class T>
bool RefCntDynObjPtr< T >::IsOk (  )  [inline]

Do we have an object now?

template<class T>
bool RefCntDynObjPtr< T >::Release (  )  [inline]

Release our ref on object


The documentation for this struct was generated from the following file:

Generated on Sun Feb 15 16:35:57 2009 for DynObj by  doxygen 1.5.6