DynObjLib Class Reference
[Other classes]

#include <DynObjLib.h>

Inheritance diagram for DynObjLib:

DynObjLibI DynI VObj

List of all members.

Public Types

enum  { LibMayLoadModules = 1, LibMayOverrideTypes = 2, LibIsMain = 4 }

Public Member Functions

virtual DynObjType *docall doGetType (const DynI **pself=0) const
 DynObjLib (const char *lib, bool do_call_init, DynI *pdi_init=NULL, int mod_flags=0, int so_load_flags=-1)
virtual int docall GetState ()
virtual const char *docall GetLibName ()
virtual const char *docall GetLibFileName ()
virtual DynObj *docall Create (const char *type, int type_id, const DynI *pdi_init=NULL)
virtual bool docall Destroy (VObj *pvo)
virtual void docall OnObjectCreate (DynObj *pdo, DynObjType *pdt)
virtual void docall OnObjectDestroy (DynObj *pdo, DynObjType *pdt)
virtual bool docall MayUnload ()
bool ExitDynLib (bool is_query)
bool EnableObjectTracking (bool enable)
bool IsOk ()
const char * GetCallStr ()
const int GetPlatform ()
const int GetDoTraits ()
void * FindSymbol (const char *symb_name)
void * GetBase ()
int Implements (const char *type)
int Implements (int type_id)
const char * GetCallConv ()
bool operator== (const char *name)
DynIInitDynLib (DynI *pdi_init)
DynIGetInitDynLibRetVal ()

Static Public Member Functions

static bool AddLibPath (const char *path)

Protected Member Functions

void Ctor (const char *lib, bool do_call_init, DynI *pdi_init)
bool InitFromModuleData (doModuleData *impl)

Static Protected Member Functions

static void TrimLibName (CharBuf &name)
static DynLib * LoadDynLib (const char *lib, int so_load_flags=-1, DynObjLib *plib=NULL)

Protected Attributes

DortInternalI * m_pdorti
DynLib * m_pdlib
CharBuf m_name
int m_state
int m_lib_flags
CreateDynObjFn m_pcfn
InitDynLibFn m_pidlfn
ExitDynLibFn m_pedlfn
DestroyDynObjFn m_pdofn
DynObjPtr< DynIm_idl_ret_val
const char * m_instantiates
const char * m_callstr
int m_platform
int m_do_traits
CharBuf m_last_err
bool m_ot_has_unregistered
bool m_ot_enable
HashTable< DynObj *, void > m_objs


class DoRunTimeC

Detailed Description

Represents a loaded DynObj library. Use to automatically load a plugin class library.

Constructor & Destructor Documentation

DynObjLib::DynObjLib ( const char *  lib,
bool  do_call_init,
DynI pdi_init = NULL,
int  mod_flags = 0,
int  so_load_flags = -1 

Constructor that takes library name/path as arg

lib the non-suffixed name of library ( name without .so or .dll ).
do_call_init Initialize the library (true by default) If false some more checks can be made on the library before initialized.

Member Function Documentation

virtual DynObjType* docall DynObjLib::doGetType ( const DynI **  pself = 0  )  const [virtual]

Returns type of this object. Each type that wants to make itself known should override this method. DynI knows its own type so we get the type without any lookup. It is faster and works without registration.

pself allows fetching the actual 'this' used inside doGetType (from a side base, this will be different to the 'this' of the caller).
A DynObjType pointer

Reimplemented from DynObjLibI.

virtual int docall DynObjLib::GetState (  )  [inline, virtual]

Returns library state

Implements DynObjLibI.

virtual const char* docall DynObjLib::GetLibName (  )  [virtual]

Returns error from library loader Get library name.

Implements DynObjLibI.

virtual const char* docall DynObjLib::GetLibFileName (  )  [virtual]

Get library file-name.

Implements DynObjLibI.

virtual DynObj* docall DynObjLib::Create ( const char *  type,
int  type_id,
const DynI pdi_init = NULL 
) [virtual]

Create a DynObj from the library.

type is the name of the string.
type_id is the integer type ID of the type.
pdi_init is the argument to the object constructor.
object_size is currently not used, use 0.
The new object or NULL if failed.

Implements DynObjLibI.

virtual bool docall DynObjLib::Destroy ( VObj pvo  )  [virtual]

Destroy a VObj or DynObj. If the object was created by this library it is destroyed.

pvo is the object to destroy.
true if object belonged to this library and was destroyed.

Implements DynObjLibI.

virtual void docall DynObjLib::OnObjectCreate ( DynObj pdo,
DynObjType pdt 
) [virtual]

Used by DynObj.cpp when a DynOb jis destroyed. It's used for internal object tracking.

Implements DynObjLibI.

bool DynObjLib::ExitDynLib ( bool  is_query  ) 

Call to close and unload the library.

is_query If set, it is like a signal to the library that shutdown is approaching. If clear, it is shutdown
true on success

bool DynObjLib::EnableObjectTracking ( bool  enable  ) 

Turn on/off support for tracking object lifetime in this library.

bool DynObjLib::IsOk (  )  [inline]

Check that library has loaded OK.

true on success

const char* DynObjLib::GetCallStr (  )  [inline]

Read calling convention used by the library.

calling convention as a string.

const int DynObjLib::GetPlatform (  )  [inline]

Read platform of source library.

integer with platform specific value.

const int DynObjLib::GetDoTraits (  )  [inline]

Read VTable properties from source compiler.

integer with VTable properties.

void* DynObjLib::FindSymbol ( const char *  symb_name  ) 

Loookup arbitrary symbol from the library.

pointed to symbol.

void* DynObjLib::GetBase (  ) 

Get library base address.

int DynObjLib::Implements ( const char *  type  ) 

Query if library implements type specified by string. Can be called before the library is initialized.

type type string
>0-Yes, 0-Unknown <0:No

int DynObjLib::Implements ( int  type_id  ) 

Query if library implements type specified by type ID. Can be called before the library is initialized.

type type ID
>0-Yes, 0-Unknown <0:No

const char* DynObjLib::GetCallConv (  ) 

Read the function calling convention used by the library. It is best to use one of __cdecl or __stdcall. Can be called before the library is initialized.

string with calling convention (__cdecl, __stdcall, ...)

static bool DynObjLib::AddLibPath ( const char *  path  )  [static]

Adds a directory to be searched when loading DynObjLib libraries.

true if success

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

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