MeVisLab Toolbox Reference
Macros

Overview documentation of the MLMemoryManager. More...

Macros

#define ML_ADD_FIELD(NAME_P, TYPE_P, VALUE_P)   (static_cast<TYPE_P##Field*> (this->addField(NAME_P, #TYPE_P, VALUE_P)));
 This Module class is the most important base class to derive new image processing modules from; see class Module.
 
#define ML_DISALLOW_COPY_AND_ASSIGN(className)
 Defines basic macros.
 
#define ML_FRIEND_TEST(test_case_name, test_name)    friend class test_case_name##_##test_name##_Test
 Can be used to make a specific class a friend of a given test to allow testing of protected functionality with GoogleTest.
 
#define ML_BASE_IS_A(base, type)   ((base && base->getTypeId()) ? base->getTypeId()->isDerivedFrom(type::getClassTypeId()) : false)
 This file defines macros, which are inserted in classes to declare and implement additional class members for the Runtime Type System (see also mlRuntimeType.h, mlRuntime.h and mlRuntimeDict.h)
 
#define ML_CLASS_SOURCE(className, parentName)
 This macro has to be put into the source file of a non-abstract class to implement the methods declared with ML_CLASS_HEADER This interface implemented by this macro permits the handling of this class type by the runtime type interface.
 
#define ML_ROOT_CLASS_SOURCE(className)    ML_CLASS_SOURCE(className,)
 This macro has to be put into the source file of a non-abstract class to implement the methods declared with ML_CLASS_HEADER This version shall be used for classes with no parent class.
 
#define ML_ABSTRACT_CLASS_HEADER(className)    ML_INTERNAL_CLASS_HEADER_EXPORTED(className, ML_EMPTY_PARAM, ML_EMPTY_PARAM, override)
 Same like ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non existing export symbol.
 
#define ML_ABSTRACT_CLASS_SOURCE(className, parentName)    ML_INTERNAL_CLASS_SOURCE(className,parentName, nullptr) \
 This macro has to be put into the source file of an abstract class to implement the methods declared with ML_ABSTRACT_CLASS_HEADER This interface implemented by this macro permits the handling of this class type by the runtime type interface.
 
#define ML_ABSTRACT_ROOT_CLASS_SOURCE(className)    ML_ABSTRACT_CLASS_SOURCE(className,)
 This macro has to be put into the source file of an abstract class to implement the methods declared with ML_ABSTRACT_CLASS_HEADER This version shall be used for classes with no parent class.
 
#define ML_MODULE_CLASS_HEADER(className)
 Like ML_CLASS_HEADER for the usage of derived classes from Module.
 
#define ML_MODULE_CLASS_SOURCE(className, parentName)
 Like ML_CLASS_SOURCE for the usage of derived classes from Module.
 
#define ML_ABSTRACT_MODULE_CLASS_HEADER(className)
 Like ML_ABSTRACT_CLASS_HEADER for the usage of derived classes from Module.
 
#define ML_ABSTRACT_MODULE_CLASS_SOURCE(className, parentName)
 Like ML_ABSTRACT_CLASS_SOURCE for the usage of derived classes from Module.
 
#define ML_MODULE_CLASS_SOURCE_EXT(className, parentName, superClassConstructs)
 Like ML_MODULE_CLASS_SOURCE where some stuff can be passed which initializes super class stuff or members.
 
#define ML_ABSTRACT_MODULE_CLASS_SOURCE_EXT(className, parentName, superClassConstructs)
 Like ML_ABSTRACT_MODULE_CLASS_SOURCE where some stuff can be passed which initializes super class stuff or members.
 
#define ML_LIBRARY_USER_DESTROY_CODE
 This macro is defined but empty in normal cases.
 
#define ML_INIT_LIBRARY_EXT_3(initMethod, NAMESP, LIB_TARGET)
 ML_INIT_LIBRARY_EXT_3 is a macro used to initialize shared libraries independent of the underlying system (WIN32/Unix), the given init method is called as soon as possible after loading the library.
 
#define ML_INIT_LIBRARY(initMethod)    _ML_INIT_LIBRARY_EXT_HELPER(initMethod, ML_UTILS_NAMESPACE, MEVIS_TARGET)
 Standard version used for library initialization of classes within the ML_NAMESPACE or ML_UTILS_NAMESPACE.
 
#define ML_INIT_LIBRARY_EXT(initMethod, NAME_SP)    _ML_INIT_LIBRARY_EXT_HELPER(initMethod, NAME_SP, MEVIS_TARGET)
 Define ML_INIT_LIBRARY_EXT with two arguments.
 
#define _ML_INIT_LIBRARY_EXT_HELPER(initMethod, NAME_SP, LIB_TARGET)    ML_INIT_LIBRARY_EXT_2(initMethod, NAME_SP, LIB_TARGET)
 Internal helper macro for unpacking the LIB_TARGET argument on the correct macro level; not to be used directly, because it is subject to change.
 
#define ML_INIT_LIBRARY_EXT_2(initMethod, NAME_SP, LIB_TARGET)    ML_INIT_LIBRARY_EXT_3(initMethod, NAME_SP, LIB_TARGET)
 Facade macro to disable the library initialization in case of a static ML build.
 

Variable Types for Typed Handlers

#define ML_IMPLEMENT_VARIABLE_TYPE_BEGIN(NAME)
 Macro to declare a variable type, needs to be followed by 0-N ML_IMPLEMENT_VARIABLE_TYPE_CASE macros and finished with a ML_IMPLEMENT_VARIABLE_TYPE_END macro.
 
#define ML_IMPLEMENT_VARIABLE_TYPE_END
 Macro to end declaration of a variable type.
 
#define ML_IMPLEMENT_VARIABLE_TYPE_CASE(TYPE)
 Macro to implement standard type case in a variable type.
 
#define ML_IMPLEMENT_VARIABLE_TYPE_CASES_FLOAT
 Defines a variable type case block for all float types.
 
#define ML_IMPLEMENT_VARIABLE_TYPE_CASES_INTEGER
 Defines a variable type case block for all integer types.
 
#define ML_IMPLEMENT_VARIABLE_EXTENDED_TYPE_CASE(DATATYPE, TYPE)
 
#define ML_IMPLEMENT_VARIABLE_TYPE_CASES_COMPLEX
 
#define ML_IMPLEMENT_VARIABLE_TYPE_CASES_DEFAULT_EXTENDED
 

ML String Prefixes

#define ML_PREFIX   "ML"
 Library identification prefix for messages from the ML.
 
#define ML_CONSTANT_PREFIX   "ML_"
 Prefix for environment variables and debugging constants used in the ML.
 

MIN/MAX/QUOTE MACROS

#define ML_QUOTE_INTERNAL(A)   #A
 Defines a quotation macro to get a string from a macro parameter.
 
#define ML_LERP(a, l, h)   ((l)+(((h)-(l))*(a)))
 Linear interpolation from l (when a=0) to h (when a=1) (equal to (a*h)+((1-a)*l).
 
#define ML_QUOTE(A)   ML_QUOTE_INTERNAL(A)
 
#define ML_BYTE_TO_KB(x)   ((x) >> 10)
 
#define ML_BYTE_TO_MB(x)   ((x) >> 20)
 Converts the value from byte to megabyte.
 
#define ML_BYTE_TO_GB(x)   ((x) >> 30)
 Converts the value from byte to gigabyte.
 
#define ML_KB_TO_BYTE(x)   ((x) << 10)
 Converts the value from kilobyte to byte.
 
#define ML_MB_TO_BYTE(x)   ((x) << 20)
 Converts the value from megabyte to byte.
 
#define ML_GB_TO_BYTE(x)   ((x) << 30)
 Converts the value from gigabyte to byte.
 

Detailed Description

Overview documentation of the MLMemoryManager.

Macro Definition Documentation

◆ _ML_INIT_LIBRARY_EXT_HELPER

#define _ML_INIT_LIBRARY_EXT_HELPER ( initMethod,
NAME_SP,
LIB_TARGET )    ML_INIT_LIBRARY_EXT_2(initMethod, NAME_SP, LIB_TARGET)

Internal helper macro for unpacking the LIB_TARGET argument on the correct macro level; not to be used directly, because it is subject to change.

MEVIS_TARGET is a compiler definition usually defined on the compiler command line or in the make file. It is necessary to unpack it with another helper macro level, because not the definition but its value is needed.

Definition at line 243 of file mlLibraryInitMacros.h.

◆ ML_ABSTRACT_CLASS_HEADER

Same like ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non existing export symbol.

Definition at line 202 of file mlRuntimeSubClass.h.

◆ ML_ABSTRACT_CLASS_SOURCE

#define ML_ABSTRACT_CLASS_SOURCE ( className,
parentName )    ML_INTERNAL_CLASS_SOURCE(className,parentName, nullptr) \

This macro has to be put into the source file of an abstract class to implement the methods declared with ML_ABSTRACT_CLASS_HEADER This interface implemented by this macro permits the handling of this class type by the runtime type interface.

Definition at line 215 of file mlRuntimeSubClass.h.

◆ ML_ABSTRACT_MODULE_CLASS_HEADER

#define ML_ABSTRACT_MODULE_CLASS_HEADER ( className)
Value:
/* Implement normal class header stuff. */ \
\
/* Implement private copy constructor. */ \
private: className(const className&); \
\
/* Implement private assignment operator. */ \
private: className& operator=(const className&); \
Target mlrange_cast(Source arg)
Generic version of checked ML casts.

Like ML_ABSTRACT_CLASS_HEADER for the usage of derived classes from Module.

It implements a private copy constructor and assignment operator to avoid their usage which would be a programming error.

Definition at line 265 of file mlRuntimeSubClass.h.

◆ ML_ABSTRACT_MODULE_CLASS_SOURCE

#define ML_ABSTRACT_MODULE_CLASS_SOURCE ( className,
parentName )
Value:
/* Implement normal class source stuff. */ \

Like ML_ABSTRACT_CLASS_SOURCE for the usage of derived classes from Module.

It implements a private copy constructor and assignment operator to avoid their usage which would be a programming error. This is also useful to avoid compiler warnings.

Definition at line 284 of file mlRuntimeSubClass.h.

◆ ML_ABSTRACT_MODULE_CLASS_SOURCE_EXT

#define ML_ABSTRACT_MODULE_CLASS_SOURCE_EXT ( className,
parentName,
superClassConstructs )
Value:
/* Implement normal class source stuff. */ \

Like ML_ABSTRACT_MODULE_CLASS_SOURCE where some stuff can be passed which initializes super class stuff or members.

Definition at line 304 of file mlRuntimeSubClass.h.

◆ ML_ABSTRACT_ROOT_CLASS_SOURCE

#define ML_ABSTRACT_ROOT_CLASS_SOURCE ( className)     ML_ABSTRACT_CLASS_SOURCE(className,)

This macro has to be put into the source file of an abstract class to implement the methods declared with ML_ABSTRACT_CLASS_HEADER This version shall be used for classes with no parent class.

Definition at line 224 of file mlRuntimeSubClass.h.

◆ ML_ADD_FIELD

#define ML_ADD_FIELD ( NAME_P,
TYPE_P,
VALUE_P )   (static_cast<TYPE_P##Field*> (this->addField(NAME_P, #TYPE_P, VALUE_P)));

This Module class is the most important base class to derive new image processing modules from; see class Module.

Macro to add a field in the constructor of an ML module

Definition at line 35 of file mlModule.h.

◆ ML_BASE_IS_A

#define ML_BASE_IS_A ( base,
type )   ((base && base->getTypeId()) ? base->getTypeId()->isDerivedFrom(type::getClassTypeId()) : false)

This file defines macros, which are inserted in classes to declare and implement additional class members for the Runtime Type System (see also mlRuntimeType.h, mlRuntime.h and mlRuntimeDict.h)

ML_BASE_IS_A macro is used to check if the given Base pointer is of the wanted type. Identical and parent class types are accepted. Invalid or not initialized types are always considered as non equal. Please consider using mlbase_cast<> as an modern alternative to this macro. Usage: ML_BASE_IS_A(base, MarkerExample).

Definition at line 32 of file mlRuntimeSubClass.h.

Referenced by ml::ITKMLBaseWrapper< OBJ_TYPE, OBJ_TYPE_POINTER, WRAPPER_CLASS_NAME >::getWrappedInputObject(), ml::ITKDifferenceFunctionFromBasePointer(), ml::ITKNodeContainerFromBasePointer(), ml::ITKPointSetFromBasePointer(), ml::ITKPolylineFromBasePointer(), and ml::ListContainerTemplate< T >::setActiveList().

◆ ML_BYTE_TO_GB

#define ML_BYTE_TO_GB ( x)    ((x) >> 30)

Converts the value from byte to gigabyte.

Definition at line 39 of file mlMemoryManager.h.

◆ ML_BYTE_TO_KB

#define ML_BYTE_TO_KB ( x)    ((x) >> 10)

Converts the value from byte to kilobyte.

Definition at line 35 of file mlMemoryManager.h.

◆ ML_BYTE_TO_MB

#define ML_BYTE_TO_MB ( x)    ((x) >> 20)

Converts the value from byte to megabyte.

Definition at line 37 of file mlMemoryManager.h.

◆ ML_CLASS_SOURCE

#define ML_CLASS_SOURCE ( className,
parentName )
Value:
#define ML_INTERNAL_CLASS_SOURCE(className, parentName, createCB)

This macro has to be put into the source file of a non-abstract class to implement the methods declared with ML_CLASS_HEADER This interface implemented by this macro permits the handling of this class type by the runtime type interface.

Definition at line 174 of file mlRuntimeSubClass.h.

◆ ML_CONSTANT_PREFIX

#define ML_CONSTANT_PREFIX   "ML_"

Prefix for environment variables and debugging constants used in the ML.

Definition at line 86 of file mlTypeDefs.h.

◆ ML_DISALLOW_COPY_AND_ASSIGN

#define ML_DISALLOW_COPY_AND_ASSIGN ( className)
Value:
private: \
className(const className&) = delete; \
className& operator=(const className &) = delete;

Defines basic macros.

Macro to make a copy constructor and assignment private

Deprecated

Definition at line 23 of file mlMacros.h.

◆ ML_FRIEND_TEST

Can be used to make a specific class a friend of a given test to allow testing of protected functionality with GoogleTest.

Make sure that your test is placed in the ML_NAMESPACE as well.

Definition at line 32 of file mlMacros.h.

◆ ML_GB_TO_BYTE

#define ML_GB_TO_BYTE ( x)    ((x) << 30)

Converts the value from gigabyte to byte.

Definition at line 45 of file mlMemoryManager.h.

◆ ML_IMPLEMENT_VARIABLE_EXTENDED_TYPE_CASE

#define ML_IMPLEMENT_VARIABLE_EXTENDED_TYPE_CASE ( DATATYPE,
TYPE )

◆ ML_IMPLEMENT_VARIABLE_TYPE_BEGIN

#define ML_IMPLEMENT_VARIABLE_TYPE_BEGIN ( NAME)
Value:
template<class Derived, int Step, class Args = ML_NAMESPACE::internal::CalculateOutputSubImageArguments> \
class NAME : public VariableType { \
public: \
enum { IsEmpty = false }; \
\
static const char* name() { return #NAME; } \
\
template<typename PrevTypes, typename TargetLabelType> \
bool doSwitchingCode(int switchCode, const Args& args, bool printError = true) { \
static const char* switcherName = #NAME; \
bool result = true; \

Macro to declare a variable type, needs to be followed by 0-N ML_IMPLEMENT_VARIABLE_TYPE_CASE macros and finished with a ML_IMPLEMENT_VARIABLE_TYPE_END macro.

Example that defines a variable type that can handle ML[u]int[8|16] datatypes:

#define ML_IMPLEMENT_VARIABLE_TYPE_CASE(TYPE)
Macro to implement standard type case in a variable type.
#define ML_IMPLEMENT_VARIABLE_TYPE_BEGIN(NAME)
Macro to declare a variable type, needs to be followed by 0-N ML_IMPLEMENT_VARIABLE_TYPE_CASE macros ...
#define ML_IMPLEMENT_VARIABLE_TYPE_END
Macro to end declaration of a variable type.
unsigned char MLuint8
Definition mlTypeDefs.h:109
unsigned short MLuint16
Definition mlTypeDefs.h:142
signed short MLint16
Definition mlTypeDefs.h:125
char MLint8
Definition mlTypeDefs.h:97

Definition at line 1030 of file mlTypedHandlers.h.

◆ ML_IMPLEMENT_VARIABLE_TYPE_CASE

#define ML_IMPLEMENT_VARIABLE_TYPE_CASE ( TYPE)
Value:

Macro to implement standard type case in a variable type.

Definition at line 1062 of file mlTypedHandlers.h.

◆ ML_IMPLEMENT_VARIABLE_TYPE_CASES_COMPLEX

#define ML_IMPLEMENT_VARIABLE_TYPE_CASES_COMPLEX
Value:
#define ML_IMPLEMENT_VARIABLE_EXTENDED_TYPE_CASE(DATATYPE, TYPE)
@ MLComplexdType
Definition mlTypeDefs.h:632
@ MLComplexfType
Definition mlTypeDefs.h:632

Definition at line 1090 of file mlTypedHandlers.h.

◆ ML_IMPLEMENT_VARIABLE_TYPE_CASES_DEFAULT_EXTENDED

#define ML_IMPLEMENT_VARIABLE_TYPE_CASES_DEFAULT_EXTENDED

◆ ML_IMPLEMENT_VARIABLE_TYPE_CASES_FLOAT

#define ML_IMPLEMENT_VARIABLE_TYPE_CASES_FLOAT
Value:

Defines a variable type case block for all float types.

Definition at line 1074 of file mlTypedHandlers.h.

◆ ML_IMPLEMENT_VARIABLE_TYPE_CASES_INTEGER

#define ML_IMPLEMENT_VARIABLE_TYPE_CASES_INTEGER
Value:

Defines a variable type case block for all integer types.

Definition at line 1080 of file mlTypedHandlers.h.

◆ ML_IMPLEMENT_VARIABLE_TYPE_END

#define ML_IMPLEMENT_VARIABLE_TYPE_END
Value:
default: { \
result = false; \
char buf[512]=""; \
sprintf(buf, "No switch case for physical data type %d.", switchCode); \
} \
break; \
} \
return result; \
} \
};
#define ML_BAD_DATA_TYPE
A wrong or unexpected data type has been passed to an algorithm which often is a programming error; t...
Definition mlTypeDefs.h:782

Macro to end declaration of a variable type.

Definition at line 1046 of file mlTypedHandlers.h.

◆ ML_INIT_LIBRARY

Standard version used for library initialization of classes within the ML_NAMESPACE or ML_UTILS_NAMESPACE.

See ML_INIT_LIBRARY_EXT_2 for further documentation.

Definition at line 225 of file mlLibraryInitMacros.h.

◆ ML_INIT_LIBRARY_EXT

Define ML_INIT_LIBRARY_EXT with two arguments.

See ML_INIT_LIBRARY_EXT_2 for further documentation.

Definition at line 232 of file mlLibraryInitMacros.h.

◆ ML_INIT_LIBRARY_EXT_2

Facade macro to disable the library initialization in case of a static ML build.

Definition at line 251 of file mlLibraryInitMacros.h.

◆ ML_INIT_LIBRARY_EXT_3

#define ML_INIT_LIBRARY_EXT_3 ( initMethod,
NAMESP,
LIB_TARGET )

ML_INIT_LIBRARY_EXT_3 is a macro used to initialize shared libraries independent of the underlying system (WIN32/Unix), the given init method is called as soon as possible after loading the library.

Former implementations used the name of the initMethod to derive the name of the DLL for the call to setRecentlyLoadedDllName, now the compiler switch MEVIS_TARGET is used instead which is more reliable. It needs to be passed as LIB_TARGET. NAMESP is typically the ML namespace ML_NAMESPACE, however in rare cases it could also be the namespace from another library.

Definition at line 103 of file mlLibraryInitMacros.h.

◆ ML_KB_TO_BYTE

#define ML_KB_TO_BYTE ( x)    ((x) << 10)

Converts the value from kilobyte to byte.

Definition at line 41 of file mlMemoryManager.h.

◆ ML_LERP

#define ML_LERP ( a,
l,
h )   ((l)+(((h)-(l))*(a)))

Linear interpolation from l (when a=0) to h (when a=1) (equal to (a*h)+((1-a)*l).

Definition at line 370 of file mlTypeDefs.h.

◆ ML_LIBRARY_USER_DESTROY_CODE

#define ML_LIBRARY_USER_DESTROY_CODE

This macro is defined but empty in normal cases.

If a library needs dedicated destruction code implemented in a function, for example named MyLibraryDestructionCode(), then a programmer can undefine the macro and redefine it containing the destruction code. Then the ML_INIT_LIBRARY library macro is used normally. For example:

undef ML_LIBRARY_USER_DESTROY_CODE define ML_LIBRARY_USER_DESTROY_CODE MyLibraryDestructionCode();

ML_INIT_LIBRARY(UserLibraryNameInitFunction);

The code is executed before the destruction of the runtime types of the library.

Definition at line 82 of file mlLibraryInitMacros.h.

◆ ML_MB_TO_BYTE

#define ML_MB_TO_BYTE ( x)    ((x) << 20)

Converts the value from megabyte to byte.

Definition at line 43 of file mlMemoryManager.h.

◆ ML_MODULE_CLASS_HEADER

#define ML_MODULE_CLASS_HEADER ( className)
Value:
/* Implement normal class header stuff. */ \
\
/* Implement private copy constructor. */ \
private: className(const className&); \
\
/* Implement private assignment operator. */ \
private: className& operator=(const className&); \

Like ML_CLASS_HEADER for the usage of derived classes from Module.

It implements a private copy constructor and assignment operator to avoid their usage which would be a programming error.

Definition at line 235 of file mlRuntimeSubClass.h.

◆ ML_MODULE_CLASS_SOURCE

#define ML_MODULE_CLASS_SOURCE ( className,
parentName )
Value:
/* Implement normal class source stuff. */ \

Like ML_CLASS_SOURCE for the usage of derived classes from Module.

It implements a private copy constructor and assignment operator to avoid their usage which would be a programming error. This is also useful to avoid compiler warnings.

Definition at line 254 of file mlRuntimeSubClass.h.

◆ ML_MODULE_CLASS_SOURCE_EXT

#define ML_MODULE_CLASS_SOURCE_EXT ( className,
parentName,
superClassConstructs )
Value:
/* Implement normal class source stuff. */ \

Like ML_MODULE_CLASS_SOURCE where some stuff can be passed which initializes super class stuff or members.

Definition at line 294 of file mlRuntimeSubClass.h.

◆ ML_PREFIX

#define ML_PREFIX   "ML"

Library identification prefix for messages from the ML.

Definition at line 80 of file mlTypeDefs.h.

Referenced by ml::ErrorOutputInfos::ErrorOutputInfos().

◆ ML_QUOTE

#define ML_QUOTE ( A)    ML_QUOTE_INTERNAL(A)

Definition at line 364 of file mlTypeDefs.h.

◆ ML_QUOTE_INTERNAL

#define ML_QUOTE_INTERNAL ( A)    #A

Defines a quotation macro to get a string from a macro parameter.

Definition at line 363 of file mlTypeDefs.h.

◆ ML_ROOT_CLASS_SOURCE

#define ML_ROOT_CLASS_SOURCE ( className)     ML_CLASS_SOURCE(className,)

This macro has to be put into the source file of a non-abstract class to implement the methods declared with ML_CLASS_HEADER This version shall be used for classes with no parent class.

Definition at line 184 of file mlRuntimeSubClass.h.