Global functions and enums


Classes

class  MutexLocker
struct  DynObjType
class  doUserTypeDecl

Defines

#define DO_DECL_TYPE_INFO(CLASS, ID)
#define DO_DECL_TYPE_INFO_AUTOID(CLASS)

Enumerations

enum  doCastAlgo { doCastLocal = 1, doCastCross = 2, doCastFull = 3 }

Functions

int doLookupTypeId (const char *header, const char *type)
DynObjTypedoGetType (const void *pobj)
DynObjTypedoGetType (const DynI *pdi)
internal void * doGetObj (void *pobj, const char *type, DynObjType *self_type, doCastAlgo algo=doCastFull, DynObjType **found_type=NULL)
void * doGetObj (void *pobj, int type_id, DynObjType *self_type, doCastAlgo algo=doCastFull, DynObjType **found_type=NULL)
void * doGetObj (DynI *pdi, const char *type, doCastAlgo algo=doCastFull, DynObjType **found_type=NULL)
void * doGetObj (DynI *pdi, int type_id, doCastAlgo algo=doCastFull, DynObjType **found_type=NULL)
DynObjTypedoFindType (const char *type, const char *header=NULL)
DynObjTypedoFindType (int type_id)
int doIsMainObject (DynI *pdi)
int doIsMainObject (const void *pobj, DynObjType *pdt=NULL)
bool doConstruct (const void *obj, DynObjType *self_type, DynObjType *pdt_compound=NULL)
bool doConstruct (const void *obj, const char *type, const char *header=NULL)
bool doConstruct (const void *obj, int type_id, const char *header=NULL)
bool doConstructDelayed (const void *obj, DynObjType *self_type)
void doReleaseDestroy (DynObj *pdo)
bool doIsStatic (const void *pvo, DynObjType *type=NULL)
bool doIsStatic (const DynI *pdi)
DoRunTimeIdoGetRunTime ()
bool doAddImplemented (const char *type, int type_id)
const char * doGetImplemented ()

Detailed Description


Define Documentation

#define DO_DECL_TYPE_INFO ( CLASS,
ID   ) 

Value:

template<>                          \
struct doTypeInfo<CLASS> { \
public:                             \
    static int Id( ){ return ID; }  \
    static const char* Name( ){ return #CLASS; } \
};
Macro to declare type registration info. Can use preprocessor pdoh instead to automate this.

#define DO_DECL_TYPE_INFO_AUTOID ( CLASS   ) 

Value:

template<>                          \
struct doTypeInfo<CLASS> { \
public:                             \
    static int Id( ){ \
        static int st_id; \
        if( !st_id ) st_id=doLookupTypeId(__FILE__,#CLASS); \
        return st_id; \
        }  \
    static const char* Name( ){ return #CLASS; } \
};
Macro to declare type registration info. Generates ID at run-time.


Enumeration Type Documentation

enum doCastAlgo

Different cast algorithms. An object with several base classes can be searched in different ways. This makes a difference if the current object is a sub-object of a larger compound object. The default algorithm is DoCastCross, which allows for going moving to a compound type once.

Enumerator:
doCastLocal  Look along main base line and among side bases. This cannot go from a side base to the main base
doCastCross  Allow one jump to the compound object. This can jump from a side base to a main base once.
doCastFull  Cast from outermost object. Go to the outermost object and do exhaustive cast This will find a subobject wherever it is in a nested side base.


Function Documentation

bool doAddImplemented ( const char *  type,
int  type_id 
)

Add implemented type for exporting (a type for which the user can give its name to the library and receive a new instance)

Parameters:
type The name of the type
type_id The ID of the type
Returns:
true if successful

bool doConstruct ( const void *  obj,
int  type_id,
const char *  header = NULL 
)

As above but based on type ID

bool doConstruct ( const void *  obj,
const char *  type,
const char *  header = NULL 
)

Set up a type from an instance and register it. As above but can be used when only the tpe name or type ID is known. Only applies to outermost type (i.e. not inner base classes).

Parameters:
obj The object to register
type The type name for the object
type_id The type ID for the object
Returns:
true if successful.

bool doConstruct ( const void *  obj,
DynObjType self_type,
DynObjType pdt_compound = NULL 
)

Set up a type from an instance and register it. This should be done

  • For the first instance of each type created
  • If using VTable correction, it must be done for each object of a type that needs correction (if it has virtual methods to protect from derived / compound overriding [for example DynI]). NOTE: This is done automatically when creating objects through DoRunTime. When creating instantiating objects in other ways, one must use DoConstruct manually.

NOTE: The template classes 'doConstructGlobal' and 'doConstructLocal' can are designed to handle this automatically for local and global objects.

Parameters:
obj The object to register
self_type Type of the object or NULL if not known
is_outer set to true when registering an object from outside (when it is not a side base class)
Returns:
true if successful.

bool doConstructDelayed ( const void *  obj,
DynObjType self_type 
)

As above but can be done before the global ctor for a type has been run. (to work around global object instantiation order).

Parameters:
obj The object to register (NOTE: It must be a global / static object!!!)
type The type name for the object
Returns:
true if successful.

DynObjType* doFindType ( int  type_id  ) 

Find DynObjType by type ID.

Parameters:
type Type name string
Returns:
Pointer to DynObjType or NULL if not found

DynObjType* doFindType ( const char *  type,
const char *  header = NULL 
)

Find DynObjType by type string.

Parameters:
type Type name string
Returns:
Pointer to DynObjType or NULL if not found

const char* doGetImplemented (  ) 

Returns a single string containing all types that can be instantiated by this module

void * doGetObj ( DynI pdi,
int  type_id,
doCastAlgo  algo,
DynObjType **  found_type 
)

Version of doGetType (with type ID) for DynI

void * doGetObj ( DynI pdi,
const char *  type,
doCastAlgo  algo,
DynObjType **  found_type 
)

Version of doGetType (with type string) for DynI

void * doGetObj ( void *  pobj,
int  type_id,
DynObjType self_type,
doCastAlgo  algo,
DynObjType **  found_type 
)

Get sub-object or interface.

Parameters:
pobj Query object
type_id Integer type ID
self_type Type of pobj or NULL if not known
algo Algoithm to use in cast
found_type Pointer-to-pointer: store found type here if non-NULL
Returns:
Pointer to interface/object

void * doGetObj ( void *  pobj,
const char *  type,
DynObjType self_type,
doCastAlgo  algo,
DynObjType **  found_type 
)

Get sub-object or interface.

Parameters:
pobj Query object
type string
self_type Type of pobj or NULL if not known
algo Algoithm to use in cast
found_type Pointer-to-pointer: store found type here if non-NULL
Returns:
Pointer to interface/object

DynObjType * doGetType ( const DynI pdi  ) 

Retrieve the type of the object.

Parameters:
pdi Object
Returns:
DynObjType of object or NULL if not found.

DynObjType * doGetType ( const void *  pobj  ) 

Retrieve the type of the object.

Parameters:
pobj Object
Returns:
DynObjType of object or NULL if not found.

int doIsMainObject ( const void *  pobj,
DynObjType pdt = NULL 
)

Version for a void pointer, with possibly known type

int doIsMainObject ( DynI pdi  ) 

Check if the object is from the main module (1) or if it is a plugin object (-1), or don't know(0).

bool doIsStatic ( const void *  pvo,
DynObjType type = NULL 
)

Check if an object is a static/global instance. A static instance will have equal or longer lifetime compared to the calling module.

Parameters:
pdo Object to release or destroy
type if of object if known
Returns:
true if valid object and it is static

void doReleaseDestroy ( DynObj pdo  ) 

Call doRelease or doDestroy on the object. Used to end ownership of a DynObj which can derive either directly from DynObj or from DynSharedI.

Parameters:
pdo Object to release or destroy


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