13#ifndef ML_RUNTIME_TYPE_H
14#define ML_RUNTIME_TYPE_H
71 RuntimeTypeCreateCB *callback =
nullptr,
84 inline const char*
getName()
const {
return _className ? _className :
"BadType"; }
87 inline const char*
getDllName()
const {
return _dllName ? _dllName :
""; }
98 inline void*
createInstance()
const {
return _callback ? (*_callback)() :
nullptr; }
101 inline RuntimeTypeCreateCB *
getCallback()
const {
return _callback; }
122 RuntimeTypeCreateCB* _callback;
134 inline ostream&
operator<<(ostream& s,
const ML_UTILS_NAMESPACE::RuntimeType &
rt)
137 <<
" Name :" <<
rt.getName()
138 <<
" DllName :" <<
rt.getDllName()
139 <<
" Parent: " << (
rt.getParent() ?
rt.getParent()->getName() :
"NULL")
140 <<
" Abstract: " << (
rt.getCallback() ?
"No" :
"Yes")
RuntimeType contains type and inheritance information of a class and a static dictionary with informa...
void * RuntimeTypeCreateCB()
A type of a callback function to create an instance of a class handled by the Runtime class.
const RuntimeType * getParent() const
Returns the parent (runtime) type of the type, i.e., the type it is derived from or NULL if not deriv...
const char * getDllName() const
Returns the NULL-terminated string name of the source DLL or "" if it is unknown.
MLint getId() const
Returns the ID that describes where the type was registered in the Runtime Type System.
bool canCreateInstance() const
Returns true if this (runtime) type knows how to create an instance of the class.
ML_UTILS_EXPORT RuntimeType(const RuntimeType *parent=nullptr, const char *className=nullptr, RuntimeTypeCreateCB *callback=nullptr, const char *dllName=nullptr)
Constructor.
void * createInstance() const
Creates and returns an instance of the of the class or NULL if such an instance is unavailable.
RuntimeTypeCreateCB * getCallback() const
Returns the callback used to create an instance of the object or NULL on abstract classes.
ML_UTILS_EXPORT bool isDerivedFrom(const RuntimeType *runtimeType) const
Returns true if this (runtime) type is derived from the argument (runtime) type runtimeType.
ML_UTILS_EXPORT ~RuntimeType()
Destructor. Cleans up all elements.
const char * getName() const
Returns the NULL-terminated string name of the class. Returns 'BadType' on error.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
MLEXPORT std::ostream & operator<<(std::ostream &s, const ml::Field &v)
Overloads the operator '<<' for stream output of Field objects.