ML Reference
Macros

Defines

#define ML_ADD_FIELD(NAME_P, TYPE_P, VALUE_P)   ((TYPE_P##Field*) this->getFieldContainer()->addField(NAME_P, #TYPE_P, VALUE_P));
 Macro to add a field in the constructor of an ML module.
#define ML_DISALLOW_COPY_AND_ASSIGN(className)
 Macro to make a copy constructor and assignment private, to avoid copying and assigning of 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)
 ML_BASE_IS_A macro is used to check if the given Base pointer is of the wanted type.
#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_ABSTRACT_CLASS_HEADER_EXPORTED(className, ML_EMPTY_PARAM)
 Same like ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non existing export symbol.
#define ML_ABSTRACT_CLASS_SOURCE(className, parentName)
 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_INIT_LIBRARY_EXT_2(initMethod, NAMESP, LIB_TARGET)
 ML_INIT_LIBRARY_EXT_2 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.

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 or ML_IMPLEMENT_VARIABLE_TYPE_CASE_CARRIERTYPE 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_MIN(X, Y)   (((X) < (Y)) ? (X) : (Y))
 The ML specific MIN macro.
#define ML_MAX(X, Y)   (((X) > (Y)) ? (X) : (Y))
 The ML specific MAX macro.
#define ML_ABS(X)   (((X) < (0)) ? ((X) * (-1)) : (X))
 The ML specific ABS macro.
#define ML_QUOTE(A)   #A
 Defines a quotation macro to get a string from a macro parameter.
#define ML_CLAMP(v, l, h)   ((v)<(l) ? (l) : (v) > (h) ? (h) : (v))
 Clamps the input to the specified range.
#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_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.

Define Documentation

#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 232 of file mlLibraryInitMacros.h.

#define ML_ABS (   X)    (((X) < (0)) ? ((X) * (-1)) : (X))

The ML specific ABS macro.

See also mlAbs templates in mlUtilsSystem.h.

Definition at line 418 of file mlTypeDefs.h.

Referenced by ml::Tmat3< DT >::jacobi().

#define ML_ABSTRACT_CLASS_HEADER (   className)    ML_ABSTRACT_CLASS_HEADER_EXPORTED(className, ML_EMPTY_PARAM)

Same like ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non existing export symbol.

Definition at line 254 of file mlRuntimeSubClass.h.

#define ML_ABSTRACT_CLASS_SOURCE (   className,
  parentName 
)

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 265 of file mlRuntimeSubClass.h.

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

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 383 of file mlRuntimeSubClass.h.

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

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 402 of file mlRuntimeSubClass.h.

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

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

Definition at line 422 of file mlRuntimeSubClass.h.

#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 342 of file mlRuntimeSubClass.h.

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

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

Definition at line 45 of file mlModule.h.

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

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 42 of file mlRuntimeSubClass.h.

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

Converts the value from byte to gigabyte.

Definition at line 36 of file mlMemoryManager.h.

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

Converts the value from byte to kilobyte.

Definition at line 32 of file mlMemoryManager.h.

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

Converts the value from byte to megabyte.

Definition at line 34 of file mlMemoryManager.h.

#define ML_CLAMP (   v,
  l,
 
)    ((v)<(l) ? (l) : (v) > (h) ? (h) : (v))

Clamps the input to the specified range.

Definition at line 430 of file mlTypeDefs.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.

Definition at line 123 of file mlRuntimeSubClass.h.

#define ML_CONSTANT_PREFIX   "ML_"

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

Definition at line 114 of file mlTypeDefs.h.

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

Macro to make a copy constructor and assignment private, to avoid copying and assigning of macros.

NOTE: It is not required to implement the methods.

Definition at line 17 of file mlMacros.h.

#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.

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

Definition at line 53 of file mlMacros.h.

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

Converts the value from gigabyte to byte.

Definition at line 42 of file mlMemoryManager.h.

#define ML_IMPLEMENT_VARIABLE_EXTENDED_TYPE_CASE (   DATATYPE,
  TYPE 
)
Value:
case DATATYPE: \
 static_cast<Derived*>(this)->template doSwitchingWithLabel<typename ML_NAMESPACE::internal::TypeTuple4Insert<Step, TYPE, PrevTypes>::Type>(args, static_cast<TargetLabelType*>(0)); \
 break;

Definition at line 1056 of file mlTypedHandlers.h.

#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;                                                               \
  switch (switchCode) {

Macro to declare a variable type, needs to be followed by 0-N ML_IMPLEMENT_VARIABLE_TYPE_CASE or ML_IMPLEMENT_VARIABLE_TYPE_CASE_CARRIERTYPE 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:

Definition at line 1019 of file mlTypedHandlers.h.

#define ML_IMPLEMENT_VARIABLE_TYPE_CASE (   TYPE)
Value:
case TypeTraits<TYPE>::dataType: \
 static_cast<Derived*>(this)->template doSwitchingWithLabel<typename ML_NAMESPACE::internal::TypeTuple4Insert<Step, TYPE, PrevTypes>::Type>(args, static_cast<TargetLabelType*>(0)); \
 break;

Macro to implement standard type case in a variable type.

Definition at line 1051 of file mlTypedHandlers.h.

#define ML_IMPLEMENT_VARIABLE_TYPE_CASES_COMPLEX
Value:

Definition at line 1079 of file mlTypedHandlers.h.

#define ML_IMPLEMENT_VARIABLE_TYPE_CASES_FLOAT
Value:

Defines a variable type case block for all float types.

Definition at line 1063 of file mlTypedHandlers.h.

#define ML_IMPLEMENT_VARIABLE_TYPE_END
Value:
default: {                                                                    \
    result = false;                                                               \
    if (printError) {                                                             \
    char buf[512]="";                                                             \
    sprintf(buf, "No switch case for physical data type %d.", switchCode);        \
    ML_PRINT_FATAL_ERROR(switcherName, ML_BAD_DATA_TYPE, buf); }                  \
    }                                                                             \
  break;                                                                          \
}                                                                                 \
  return result;                                                                  \
}                                                                                 \
};

Macro to end declaration of a variable type.

Definition at line 1035 of file mlTypedHandlers.h.

#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.

See ML_INIT_LIBRARY_EXT_2 for further documentation.

Definition at line 214 of file mlLibraryInitMacros.h.

#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.

See ML_INIT_LIBRARY_EXT_2 for further documentation.

Definition at line 221 of file mlLibraryInitMacros.h.

#define ML_INIT_LIBRARY_EXT_2 (   initMethod,
  NAMESP,
  LIB_TARGET 
)

ML_INIT_LIBRARY_EXT_2 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 90 of file mlLibraryInitMacros.h.

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

Converts the value from kilobyte to byte.

Definition at line 38 of file mlMemoryManager.h.

#define ML_LERP (   a,
  l,
 
)    ((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 436 of file mlTypeDefs.h.

#define ML_MAX (   X,
 
)    (((X) > (Y)) ? (X) : (Y))

The ML specific MAX macro.

See also mlMin and mlMax templates in mlUtilsSystem.h.

Definition at line 412 of file mlTypeDefs.h.

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

Converts the value from megabyte to byte.

Definition at line 40 of file mlMemoryManager.h.

#define ML_MIN (   X,
 
)    (((X) < (Y)) ? (X) : (Y))

The ML specific MIN macro.

See also mlMin and mlMax templates in mlUtilsSystem.h.

Definition at line 406 of file mlTypeDefs.h.

#define ML_MODULE_CLASS_HEADER (   className)
Value:
/* Implement normal class header stuff. */                      \
  ML_CLASS_HEADER(className)                                      \
                                                                  \
  /* 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 353 of file mlRuntimeSubClass.h.

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

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 372 of file mlRuntimeSubClass.h.

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

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

Definition at line 412 of file mlRuntimeSubClass.h.

#define ML_PREFIX   "ML"

Library identification prefix for messages from the ML.

Definition at line 108 of file mlTypeDefs.h.

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

#define ML_QUOTE (   A)    #A

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

Definition at line 424 of file mlTypeDefs.h.

#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 207 of file mlRuntimeSubClass.h.