Templates for DynI and friends


Classes

struct  IsVObj< T >
struct  doKeepRef< T >
struct  doConstructGlobal< T >
struct  doConstructLocal< T >
struct  DoFullType2Int< T >
struct  DynObjHolder< T >
struct  DynObjPtr< T >
struct  DynWeakRef< T >
struct  RefCntDynObjPtr< T >
struct  ScopedDynObj< T >

Enumerations

enum  HoldMode {
  hmOwn = 1, hmShared, hmStatic, hmWeakRef,
  hmAutoOwn, hmAutoNoOwn, hmAuto
}

Functions

template<class U, class T>
internal U do_cast (T *pt, doCastAlgo algo=doCastFull)
template<class U, class T>
do_cast_ref (T &t, doCastAlgo algo=doCastFull)
template<class U, class T>
do_cast_str (T *pt, doCastAlgo algo=doCastFull)
template<class U, class T>
do_cast_ref_str (T &t, doCastAlgo algo=doCastFull)
template<class T>
VObjto_vobj (T t)
template<class I>
void do_try (DynI *pdi, void(docall I::*func)())
template<class I, class RV>
RV do_try (DynI *pdi, RV(docall I::*func)(), RV rv=0)
template<class I, class A1, class _A1>
void do_try (DynI *pdi, void(docall I::*func)(A1), _A1 a1)
template<class I, class RV, class A1, class _A1>
RV do_try (DynI *pdi, RV(docall I::*func)(A1), _A1 a1, RV rv=0)
template<class I, class A1, class A2, class _A1, class _A2>
void do_try (DynI *pdi, void(docall I::*func)(A1, A2), _A1 a1, _A2 a2)
template<class I, class RV, class A1, class A2, class _A1, class _A2>
RV do_try (DynI *pdi, RV(docall I::*func)(A1, A2), _A1 a1, _A2 a2, RV rv=0)
template<class T, class A>
internal T * do_new (A arg)
template<class T>
T * do_new ()

Detailed Description


Enumeration Type Documentation

enum HoldMode

Different modes to setup and hold an interface/class pointer.

  • hmOwn: Owns the object and releases it with doDestroy
  • hmShared: Has reference to a ref-counted object [release with doRelease()]
  • hmStatic: Held object is static/global and 'immortal'
  • hmWeakRef: Hold a weak reference to the object
  • hmAutoOwn: Setup directive: Try hmShared first and then hmOwn
  • hmAutoNoOwn: Setup directive: Try hmStatic first and then hmWeakRef
  • hmAuto: Try in this order: hmStatic, hmWeakRef, hmShared, hmOwn


Function Documentation

template<class U, class T>
internal U do_cast ( T *  pt,
doCastAlgo  algo = doCastFull 
) [inline]

Cast a pointer to another C++ type across DLL/SO boundaries. This does type lookup using information from the library compiler. It is the equivalent of dynamic_cast in C++ or QueryInterface in COM. It uses integer type ID:s internally (not type strings) and is therefore faster then string based casts.

Returns:
a pointer to the requested interface/class if found, otherwise NULL.

template<class U, class T>
U do_cast_ref ( T &  t,
doCastAlgo  algo = doCastFull 
) [inline]

Cast a reference to another C++ type across DLL/SO boundaries. This does type lookup using information from the source object compiler. It is the equivalent of dynamic_cast in C++ or QueryInterface in COM. It uses integer type ID:s internally (not type strings) and is therefore faster then string based casts.

Returns:
a pointer to the requested interface/class if found, otherwise NULL.

template<class U, class T>
U do_cast_ref_str ( T &  t,
doCastAlgo  algo = doCastFull 
) [inline]

As above but uses type strings and for references.

Returns:
a referece to the requested interface/class if found, otherwise NULL.

template<class U, class T>
U do_cast_str ( T *  pt,
doCastAlgo  algo = doCastFull 
) [inline]

As above but uses type strings (and can therefore find custom objects). Using string based casts is slower than casts based on integer ID.

Returns:
a pointer to the requested interface/class if found, otherwise NULL.

template<class T>
T* do_new (  )  [inline]

Create a new DynObj based on C++ type. No argument version. New object will receive a NULL pointer in constructor.

template<class T, class A>
internal T* do_new ( arg  )  [inline]

Create a new DynObj based on C++ type. Can take arbitrary type of argument and pass along to constructor of new object after wrapping it up in a DynData object.

Parameters:
arg Constructor argument of arbitrary type
lib_name Name of library to use or NULL for default (this is usually efficient)

template<class I, class RV, class A1, class A2, class _A1, class _A2>
RV do_try ( DynI pdi,
RV(docall I::*)(A1, A2)  func,
_A1  a1,
_A2  a2,
RV  rv = 0 
) [inline]

As above, two args, return value

template<class I, class A1, class A2, class _A1, class _A2>
void do_try ( DynI pdi,
void(docall I::*)(A1, A2)  func,
_A1  a1,
_A2  a2 
) [inline]

As above, two args, no return value

template<class I, class RV, class A1, class _A1>
RV do_try ( DynI pdi,
RV(docall I::*)(A1)  func,
_A1  a1,
RV  rv = 0 
) [inline]

As above, one arg, return value

template<class I, class A1, class _A1>
void do_try ( DynI pdi,
void(docall I::*)(A1)  func,
_A1  a1 
) [inline]

As above, one arg, no return value

template<class I, class RV>
RV do_try ( DynI pdi,
RV(docall I::*)()  func,
RV  rv = 0 
) [inline]

As above, but no args, return value

template<class I>
void do_try ( DynI pdi,
void(docall I::*)()  func 
) [inline]

A template to try to execute a single function on another interface. The function and arguments are passed along, and a default return value as last argument (0 if not specified). If cast to the other interface fails, the default value is returned. A reference cannot be returned in this way.

template<class T>
VObj* to_vobj ( t  )  [inline]

Cast arbitrary type to VObj if it can be safely done. If T is not a VObj, it generates a compile time error.

Parameters:
t a pointer/reference/instance of any type
Returns:
a pointer to a VObj (the same object) if this can be done.


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