MeVisLab Toolbox Reference
|
This file declares the class RuntimeDict, which manages a set of instances of class RuntimeTypes
.
More...
#include <mlRuntimeDict.h>
Public Member Functions | |
RuntimeDict () | |
Creates new dictionary. | |
~RuntimeDict () | |
Destructor. Removes dictionary and all stored runtime types. | |
void | clear () |
Clears all dictionary entries and stored runtime types. | |
bool | insert (const RuntimeType *runtimeType) |
Inserts an new type into the runtime dictionary. | |
bool | remove (const char *className) |
Removes the element for the given className className . | |
const RuntimeType * | get (const char *className) const |
Returns the runtime type for a given className (or NULL if not element present). | |
void * | createInstanceFromName (const char *className) const |
Returns a pointer to a newly created instance of the runtime type or NULL if such an instance cannot be created (e.g., if type is not available or the class name is wrong). | |
void | destroyRuntimeTypesOfDll (const char *dllName) |
Deletes all RuntimeTypes from the runtime dictionary which belong to the the dll with name dllName . | |
std::vector< const RuntimeType * > | getAllDerivedFrom (const RuntimeType *parentType, bool onlyFromDifferentDlls=false) |
Returns a list of all runtime types derived from parentType . | |
std::vector< const RuntimeType * > | getAllRuntimeTypesOfDll (const char *dllName) |
Returns a list of all runtime types implemented by dll with name dllName . | |
std::vector< const RuntimeType * > | getAllTypes () |
Returns all registered types. | |
This file declares the class RuntimeDict, which manages a set of instances of class RuntimeTypes
.
The class Runtime
uses one global instance of this class for the runtime type system of the ml. See also classes Runtime
and RuntimeType
. Thread-safety: This class is reentrant.
Definition at line 43 of file mlRuntimeDict.h.
ml::RuntimeDict::RuntimeDict | ( | ) |
Creates new dictionary.
ml::RuntimeDict::~RuntimeDict | ( | ) |
Destructor. Removes dictionary and all stored runtime types.
void ml::RuntimeDict::clear | ( | ) |
Clears all dictionary entries and stored runtime types.
Returns a pointer to a newly created instance of the runtime type or NULL if such an instance cannot be created (e.g., if type is not available or the class name is wrong).
Empty className
strings or NULL pointers are handled as ML_BAD_PARAMETER error. NULL is returned then. The caller is responsible for deleting the returned object.
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
.
const RuntimeType * ml::RuntimeDict::get | ( | const char * | className | ) | const |
Returns the runtime type for a given className
(or NULL if not element present).
Empty className
strings or NULL pointers are handled as ML_BAD_PARAMETER error. NULL is returned then.
std::vector< const RuntimeType * > ml::RuntimeDict::getAllDerivedFrom | ( | const RuntimeType * | parentType, |
bool | onlyFromDifferentDlls = false ) |
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. parentType
itself will not be part of the result. 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, the types are considered from different dlls.
std::vector< const RuntimeType * > ml::RuntimeDict::getAllRuntimeTypesOfDll | ( | const char * | dllName | ) |
Returns a list of all runtime types implemented by dll with name dllName
.
The returned list will be empty if no type is found or if dllName
is NULL or invalid.
std::vector< const RuntimeType * > ml::RuntimeDict::getAllTypes | ( | ) |
Returns all registered types.
bool ml::RuntimeDict::insert | ( | const RuntimeType * | runtimeType | ) |
Inserts an new type into the runtime dictionary.
Double insertion of types is prohibited and handled with a ML_PROGRAMMING_ERROR error and a false return since a type cannot be inserted twice. NULL as runtimeType
is handled with ML_BAD_PARAMETER error and also NULL is returned. Ownership of the type is passed to the dict, if the insertion fails, the type will be deleted.
Removes the element for the given className className
.
The entry in the dictionary is removed (and deleted). If the entry does not exist, false is returned. Empty className
strings or NULL pointers are handled as ML_BAD_PARAMETER error. NULL is returned then.