ML Reference
ml::Runtime Class Reference

This class contains the runtime system of the ML. More...

#include <mlRuntime.h>

List of all members.

Static Public Member Functions

static void init ()
 Initializes runtime type dictionary.
static void destroy ()
 Destroys runtime type dictionary.
static const RuntimeTypefromName (const char *name)
 Returns the (runtime)type of a class given by its name using the runtime type dictionary.
static const RuntimeTypeinitType (const RuntimeType *classType, const char *parentName, const char *classPrefix, const char *className, RuntimeType::RuntimeTypeCreateCB *createCB)
 Initializes a new type and tests for double init call.
static void destroyType (const char *name)
 Destroys a dictionary entry with a given name.
static const RuntimeTypebadType ()
 Returns a global badtype instance of RuntimeType.
static const RuntimeTypegetFirstEntry ()
 Returns the first runtime type entry in dictionary.
static const RuntimeTypegetNextEntry ()
 Returns the next runtime entry in dictionary (or NULL if none).
static void setRecentlyLoadedDllName (const char *name)
 Sets the name of the most recently loaded dll.
static const char * getRecentlyLoadedDllName ()
 Returns the name of the most recently loaded dll.
static void destroyRuntimeTypesOfDll (const char *dllName)
 Deletes all RuntimeTypes from the runtime dictionary which belong to the the dll with name dllName.
static std::list< const
RuntimeType * > 
getAllDerivedFrom (const RuntimeType *parentType, bool onlyFromDifferentDlls=false)
 Returns a list of all runtime types derived from parentType.

Static Protected Member Functions

static const RuntimeTypecreateType (const char *parentName, const char *name, RuntimeType::RuntimeTypeCreateCB *callback)
 Creates a new (runtime)type, representing a class with parent class name parentName, typename name and a callback function callback to create an instance of this class.

Detailed Description

This class contains the runtime system of the ML.

It manages a dictionary of runtime types, it can create and remove runtime types. This class contains only static components and must be initialized with init() and destroyed with destroy().

Thread-safety: This class is not thread-safe and should only be used from the main thread. The same applies to the initClass() method of classes derived from the ml::Base class.

Definition at line 47 of file mlRuntime.h.


Member Function Documentation

static const RuntimeType* ml::Runtime::badType ( ) [static]

Returns a global badtype instance of RuntimeType.

static const RuntimeType* ml::Runtime::createType ( const char *  parentName,
const char *  name,
RuntimeType::RuntimeTypeCreateCB callback 
) [static, protected]

Creates a new (runtime)type, representing a class with parent class name parentName, typename name and a callback function callback to create an instance of this class.

The callback may be NULL for abstract types. The type is inserted into the runtime dictionary to be accessible later. When inserting, it is tested whether a same named type exists and if it existed, this function returns NULL because same named types are not supported by the runtime type system. Also an error is send with ML_PRINT_ERROR(). Notifies MLNotify on valid insertion. See mlMLNotify.h for more infos.

static void ml::Runtime::destroy ( ) [static]

Destroys runtime type dictionary.

static void ml::Runtime::destroyRuntimeTypesOfDll ( const char *  dllName) [static]

Deletes all RuntimeTypes from the runtime dictionary which belong to the the dll with name dllName.

This call is ignored if no types are found or a NULL name is passed as dllName.

static void ml::Runtime::destroyType ( const char *  name) [static]

Destroys a dictionary entry with a given name.

Nothing is done if type is not found. Notifies notify. See mlMLNotify.h for more infos.

static const RuntimeType* ml::Runtime::fromName ( const char *  name) [static]

Returns the (runtime)type of a class given by its name using the runtime type dictionary.

NULL is returned if no runtime type with name is found.

static std::list<const RuntimeType*> ml::Runtime::getAllDerivedFrom ( const RuntimeType parentType,
bool  onlyFromDifferentDlls = false 
) [static]

Returns a list of all runtime types derived from parentType.

The returned list will be empty if no type is found or if parentType is NULL. If onlyFromDifferentDlls is false (the default), all derived types are added; if it is true, only types with differing dllNames are added. If dllNames strings are not set, empty or different then the types are considered from different dlls.

static const RuntimeType* ml::Runtime::getFirstEntry ( ) [static]

Returns the first runtime type entry in dictionary.

static const RuntimeType* ml::Runtime::getNextEntry ( ) [static]

Returns the next runtime entry in dictionary (or NULL if none).

static const char* ml::Runtime::getRecentlyLoadedDllName ( ) [static]

Returns the name of the most recently loaded dll.

Returns NULL if no dll has been loaded.

static void ml::Runtime::init ( ) [static]

Initializes runtime type dictionary.

static const RuntimeType* ml::Runtime::initType ( const RuntimeType classType,
const char *  parentName,
const char *  classPrefix,
const char *  className,
RuntimeType::RuntimeTypeCreateCB createCB 
) [static]

Initializes a new type and tests for double init call.

classType is the still uninitialized pointer to the badType() runtime type instance. parentName is the string name of the parent class type. classPrefix is the string name of a prefix which will be added as prefix before className. className is the string name of the class type itself and createCB is the callback to create an instance of the type. For abstract types it may be NULL. All strings must be null-terminated or - if permitted - NULL. Return value is the initialized runtime type on success; classType if type is already initialized, badType() if same type name already exists.

static void ml::Runtime::setRecentlyLoadedDllName ( const char *  name) [static]

Sets the name of the most recently loaded dll.

Clears name if NULL is passed. Only to be called from the ML!


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