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

#include <ScopedDynObj.hpp>

Inheritance diagram for ScopedDynObj< T >:

DynObjPtr< T >

List of all members.

Public Member Functions

 ScopedDynObj (T *pt=NULL)
template<class A>
 ScopedDynObj (A arg)
template<class A>
 ScopedDynObj (const char *lib_name, A arg)
T & operator() ()
bool IsOk ()

Protected Member Functions

void DoAssign (T *pt)


Detailed Description

template<class T>
struct ScopedDynObj< T >

This is a smart pointer class that instantiates a given type in a local scope. The object is either a directly owned DynObj or a ref counted object. Whenever the type can be safely trackable, this pointer is also safe. However, if it is not trackable, it still keeps the instance alive for the scope. If it is a plugin object, then it is not safe (the plugin may be unloaded). Used in the main thread, and not yielding to other program flows, it is always safe.

Constructor & Destructor Documentation

template<class T>
ScopedDynObj< T >::ScopedDynObj ( T *  pt = NULL  )  [inline, explicit]

One argument constructor. If the argument is NULL, we attempt to create the object here.

Parameters:
pt The DynObj we want to own.

template<class T>
template<class A>
ScopedDynObj< T >::ScopedDynObj ( arg  )  [inline, explicit]

One argument constructor, instantiating the owned object.

Parameters:
arg An argument to be passed to the plugin object constructor.

template<class T>
template<class A>
ScopedDynObj< T >::ScopedDynObj ( const char *  lib_name,
arg 
) [inline, explicit]

Two argument constructor, instantiating the owned object.

Parameters:
lib_name Name of library to instantiate the object.
arg An argument to be passed to the plugin object constructor.


Member Function Documentation

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

Return a reference. Backward compatibility

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

Do we have an object now?

Reimplemented from DynObjPtr< T >.


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