MeVis/Foundation/Sources/ML/include/mlDataTypes.h File Reference

Defines basic data types, constants and macros for MeVis projects. More...

#include "mlInitSystemML.h"
#include "mlUtilsAPI.h"
#include "mlTypeDefs.h"

Go to the source code of this file.

Defines

Deprecated
#define MLPromotedPrecision   MLGetPromotedPrecision
Deprecated
#define MLTypeInfosAtIdx   MLGetTypeInfosAtIndex

Functions

MLEXPORT MLDataType MLGetDataTypeForRange (MLldouble *min, MLldouble *max, MLint32 preferUnsigned)
 Corrects order of *min and *max and return adequate standard data type.
MLEXPORT MLDataType MLGetDataTypeForUncorrectedRange (MLldouble min, MLldouble max, MLint32 preferUnsigned)
 Like getMLDataTypeForRange with the following differences:
  • min / max is not changed even if invalid.

MLEXPORT MLDataType MLGetRangeAndPrecisionEquivalent (MLDataType dataType)
 Returns a standard data type for dataType which has a comparable precision and range behavior.
MLEXPORT MLDataType MLGetPromotedPrecision (MLDataType datatype1, MLDataType datatype2)
 Returns one of datatype1 and datatype2 which has a higher precision.
MLEXPORT size_t MLTypeGetNumComponents (MLDataType dataType)
 Returns the number of components of the data type dataype or 0 in case of an invalid data type.
MLEXPORT const char * MLTypeGetStructInfoString (MLDataType dataType)
 Returns the components codes of the data type dataType or "" in case of an invalid data type.
MLEXPORT MLDataType MLTypeGetBestScalarTypeForTypeComponentChars (const char *charCodes, int suppressML64BitInts, int suppressMLldouble)
 Returns a standard data type which is able to hold the precisions of each of the type component characters passed as charCodes.
MLEXPORT MLDataType MLTypeGetBestScalarTypeForTypeComponents (MLDataType dataType, int suppressML64BitInts, int suppressMLldouble)
 Return a standard data type which is able to hold the precisions of each of the components of the type dataType.
MLEXPORT MLTypeInfosMLGetTypeInfosForDataType (MLDataType dataType)
 Returns the MLTypeInfos for the data type dataType, or NULL on non registered or invalid type.
TYPE SYSTEM INITIALIZATION.
MLEXPORT MLint32 MLAreTypesInitialized ()
 Returns 1(=true) if type table is initialized, otherwise 0(=false).
MLEXPORT MLint32 MLInitializeTypes ()
 Initialize all ML type management.
MLEXPORT void MLDestroyTypes ()
 Destroy ML type management.
DATA TYPE MANAGEMENT.
MLEXPORT const char ** MLDataTypeNames ()
 Thread-safety: These functions are thread-safe, as long as no new datatypes are registered after startup.
MLEXPORT size_t MLNumDataTypes ()
 Returns the current number of ML data types.
MLEXPORT const char * MLNameFromDataType (MLDataType dataType)
 Function which returns the null-terminated string name for data type dataType or "" in case of error or for an invalid data type.
MLEXPORT MLDataType MLDataTypeFromName (const char *const name)
 Returns the id of the data type with name name.
MLEXPORT MLldouble MLDataTypeMax (MLDataType dataType)
 Returns the maximum value of data type dataType or 0 if dataType is invalid.
MLEXPORT MLldouble MLDataTypeMin (MLDataType dataType)
 Returns the minimum value of data type dataType or 0 if dataType is invalid.
MLEXPORT size_t MLSizeOf (MLDataType dataType)
 Returns the size of the data type dataType in bytes.
MLEXPORT size_t MLSizeOfRegisteredType (MLDataType dataType)
 Returns the size of data type dataType in bytes or - in case of registered data types - the size of the registered data type (and NOT the size of the carrier type carrying the registered type!) On invalid types 0 is returned.
MLEXPORT MLint32 MLRangeOrder (MLDataType dataType)
 Returns order value for a data type ranges.
MLEXPORT MLint32 MLIsValidType (MLDataType dataType)
 Returns true(=1) if data type dataType seems to be valid, otherwise 0(=false).
MLEXPORT MLint32 MLIsSigned (MLDataType dataType)
 Returns true(=1) if data type dataType is signed, otherwise 0(=false).
MLEXPORT MLint32 MLIsIntType (MLDataType dataType)
 Returns true(=1) if data type dataType is an integer data type, otherwise false(=0).
MLEXPORT MLint32 MLIsFloatType (MLDataType dataType)
 Returns true(=1) if data type dataType is a floating point data type, otherwise false(=0).
MLEXPORT MLint32 MLIsStandardType (MLDataType dataType)
 Returns true(=1) if data type dataType is a standard type, otherwise return false(=0).
MLEXPORT MLint32 MLHolds (MLDataType datatype1, MLDataType datatype2)
 Returns true(=1) if data type \ datatype1 can hold data type datatype2 without precision or sign loss.
MLEXPORT MLDataType MLGetPromotedType (MLDataType datatype1, MLDataType datatype2)
 Returns a data type which can hold the value ranges from datatype1 and datatype2 (including both).
Deprecated
MLEXPORT MLDataType MLPromotedType (MLDataType datatype1, MLDataType datatype2)
MLTypePropertyBits handling.
MLEXPORT MLint32 MLTypePropBitsTest (MLTypePropertyBits propertyBits, MLTypePropertyBits mask)
 Returns true(=1) if bit mask mask is part of propertyBits, otherwise return false(=0).
MLEXPORT MLTypePropertyBits MLTypePropBitsAnd (MLTypePropertyBits propertyBits, MLTypePropertyBits mask)
 Ands of all bits in mask and those in propertyBits.
MLEXPORT MLTypePropertyBits MLTypePropBitsOr (MLTypePropertyBits propertyBits, MLTypePropertyBits mask)
 Adds all set bits in mask to those in propertyBits.
MLEXPORT MLTypePropertyBits MLTypePropBitsXor (MLTypePropertyBits propertyBits, MLTypePropertyBits mask)
 Inverts all set bits property bits from propertyBits which are set in mask.
Physical data type management
MLEXPORT size_t MLSizeOfPhysicalType (MLPhysicalDataType physicalDataType)
 Returns the size of a physical data type physicalDataType in bytes.
MLEXPORT MLPhysicalDataType MLGetPhysicalDataType (MLDataType dataType)
 Returns the physical data type used by data type dataType.
MLEXPORT MLPhysicalDataType MLGetCarrierTypeForSize (size_t numBytes)
 Returns a carrier type which can hold best the passed number of bytes numBytes.
REGISTRATION OF NEW DATA TYPES.
MLEXPORT MLint32 MLRegisterTypeInfos (MLTypeInfos *infos)
 Adds the data type class infos to the list of registered data types.
MLEXPORT MLint32 MLIsRegisteredTypeInfos (const MLTypeInfos *infos)
 Returns 1(=true) if data type is already registered. Otherwise 0(=false) is returned.
MLEXPORT size_t MLGetNumRegisteredTypeInfos ()
 Returns the number of registered type operations.
MLEXPORT MLTypeInfosMLGetTypeInfosAtIndex (size_t index)
 Returns the index th registered type operation, NULL on invalid index.
Push, pop, set and restoring type handlers
MLEXPORT MLTypePushSingleInfo MLTypeInfosPushAndSetInput (MLDataType dataType)
 This routine determines the index into the MLTypeInfosTable which is used by the input versions of the MLDataType dataType and pushes it onto a stack.
MLEXPORT MLTypePushSingleInfo MLTypeInfosPushAndSetOutput (MLDataType dataType)
 This routine determines the index in the MLTypeInfosTable which is used by the output versions of the MLDataType dataType and pushes it onto a stack.
MLEXPORT void MLTypeInfoPop (MLTypePushSingleInfo pushInfo)
 The previous call of either MLTypeInfosPushAndSetInput or MLTypeInfosPushAndSetOutput is made undone by popping the pushed information from the stack and by restoring the MLTypeInfosTable.
MLEXPORT MLTypePushDoubleInfo MLTypeInfosPushAndSetBoth (MLDataType dataType)
 This routine determines the indices in the MLTypeInfosTable which are used by the input and output versions of the MLDataType dataType and pushes them onto stacks.
MLEXPORT MLTypePushDoubleInfo MLTypeInfosPushAndSetTypes (MLDataType datatype1, MLint32 isDT1AnInputType, MLDataType datatype2, MLint32 isDT2AnInputType)
 This routine determines the indices in the MLTypeInfosTable which are used by the MLDataTypes datatype1 and datatype2, and pushes them onto a stack.
MLEXPORT void MLTypeInfosPop (MLTypePushDoubleInfo infos)
 The previous calls of either MLTypeInfosPushAndSetBoth or MLTypeInfosPushAndSetTypes are made undone by popping their pushed information from the stack and by restoring the MLTypeInfosTable.
MLType support.
MLEXPORT MLint32 MLTypeInfosInit (MLTypeInfos *infos, size_t registeredTypeSize, const char *name, MLldouble ldblMin, MLldouble ldblMax, const MLTypeData *typeMinPtr, const MLTypeData *typeMaxPtr, const MLTypeData *typeDefaultPtr, const char *typeStructInfo, MLint32 isBasicType, MLPhysicalDataType rangeAndPrecisionEquiv, void **componentAddresses, size_t numGoodCastTos, const char **goodCastTos)
 Initialization of the main properties of MLTypeInfos.
MLEXPORT MLTypeDataMLTypeInfosCreateBuffer (const MLTypeInfos *infos)
 Returns a buffer of the size of one data element. NULL is returned on failure.
MLEXPORT void MLTypeInfosRemoveBuffer (MLTypeData *buffer)
 Removes a buffer created with MLTypeInfosCreateBuffer.
MLEXPORT void MLTypeCorrectPropertyBits (MLTypeInfos *infos)
 Corrects all property bits except of the basic properties (MLTypeIsSignedType, MLTypeIsFloatingPointType, MLTypeIsIntegerType, MLIsBasicType).
MLEXPORT void MLTypeSetDefaultFunctionPointers (MLTypeInfos *infos)
 Sets all function pointers to default values which do error handling when called.
MLEXPORT void MLTypeToggleEndianType (const MLTypeInfos *infos, const MLTypeData *sourceBufferPointer, MLTypeData *targetBufferPointer, size_t numInstances)
 Converts data type instances from little endian to big endian or vice versa.
MLEXPORT void MLTypeConvertToLittleEndian (const MLTypeInfos *infos, const MLTypeData *sourceBufferPointer, MLTypeData *targetBufferPointer, size_t numInstances)
 Converts data type instances from big endian to little endian.
MLEXPORT void MLTypeConvertToBigEndian (const MLTypeInfos *infos, const MLTypeData *sourceBufferPointer, MLTypeData *targetBufferPointer, size_t numInstances)
 Converts data type instances from little endian to big endian.
MLType components.
MLEXPORT const char * MLGetCDataTypeNameForCharCode (char code)
 Returns the basic C/C++ data type name corresponding to a character representing it.
MLEXPORT const char * MLGetMLDataTypeNameForCharCode (char code)
 Returns an ML type name type name compatible to a character representing it.
MLEXPORT MLDataType MLGetMLDataTypeForCharCode (char code)
 Returns an ML data type compatible to a character representing it.
MLEXPORT MLint32 MLTypeGetComponentProperties (char code, MLint32 *isSigned, MLint32 *isIntegerType, MLint32 *isFloatingPointType, MLint32 *isLongType)
 Returns true (=1) in *isSigned, *isIntegerType, *isFloatingPointType and *isLongType if the component type represented by code has this features, otherwise set that flag to false (=0).
MLEXPORT size_t MLTypeComponentSize (char component)
 Returns the sizeof of a MLTypeComponent component denoted by a character code.
MLEXPORT void MLTypeSetDoubleComponent (char component, MLdouble value, MLTypeData *targetPointer)
 Interprets the data referenced by *targetPointer as data of the type component and sets its value from the passed double value by casting the value to it.
MLEXPORT void MLTypeSetIntComponent (char component, MLCTInt value, MLTypeData *targetPointer)
 Like MLTypeSetDoubleComponent, only components are set to integer values.
MLEXPORT void MLTypeSetAllDoubleComponents (const MLTypeInfos *infos, MLdouble value, MLTypeData *targetPointer)
 All components of the data referenced by *targetPointer are set to their values cast from the double value.
MLEXPORT void MLTypeSetAllIntComponent (const MLTypeInfos *infos, MLCTInt value, MLTypeData *targetPointer)
 Like MLTypeSetAllDoubleComponents, only components are set to integer values.
MLEXPORT MLdouble MLTypeGetDoubleComponent (char component, const MLTypeData *targetPointer)
 Interpret the data referenced by *targetPointer as data of the type component and return it as double value.
MLEXPORT MLCTInt MLTypeGetIntComponent (char component, const MLTypeData *targetPointer)
 Like MLTypeGetComponent, only that the components is returned as integer values.
MLEXPORT MLErrorCode MLTypeGetMinMaxRangeOfComponents (const MLTypeInfos *infos, const MLTypeData *srcPtr, MLldouble *retMin, MLldouble *retMax)
 Returns the min/max range of all components of an arbitrary registered voxel.
MLEXPORT void MLTypeShiftLeftComponent (char component, const MLTypeData *sourcePointer, MLCTInt shiftLs, MLTypeData *targetPointer)
 Interprets the data referenced by *targetPointer as data of the type component and shift it left shiftLs times if it is an integer component.
Convenience implementations and helpers for implementation of new data types.
MLEXPORT MLTypeDataMLAllocateVoxelBuffer (MLDataType dataType, size_t numVoxels, const MLTypeData *voxelDefaultValue)
 Returns a buffer of numVoxels voxels of data type dataType.
MLEXPORT char * MLGetVoxelValueAsString (const MLTypeData *data, MLDataType dataType, MLErrorCode *errorCode)
 Interprets the data given by data as a value of type dataType and return its value as string.
MLEXPORT char * MLGetVoxelValueAsStringLimited (const MLTypeData *data, MLDataType dataType, MLErrorCode *errorCode, int maxPrecision)
 Interprets the data given by data as a value of type dataType and returns its value as string.
MLEXPORT char * MLTypeComponentsToString (const MLTypeInfos *infos, const MLTypeData *data)
 Converts a data type instance to a string.
MLEXPORT char * MLTypeComponentsToStringLimited (const MLTypeInfos *infos, const MLTypeData *data, int maxPrecision)
 Converts a data type instance to a string.
MLEXPORT MLint32 MLTypeComponentsFromString (const MLTypeInfos *infos, const char *stringData, const MLTypeData *defaultValue, MLTypeData *data)
 Converts a string of a data type instance to instance data, i.e., like an sscanf.
MLEXPORT MLTypeDataMLTypeGetDataValuesFromString (MLDataType dataType, const char *voxelValue, const MLTypeData *defaultValue, size_t numInstances)
 Allocates a buffer for numInstances of data type dataType and fills it with the data type value converted from the null-terminated string voxValue.
MLEXPORT MLint32 MLTypeComponentsFromStream (void *iStr, void *iStrStream, void *stdiStr, void *stdiStrStream, const MLTypeInfos *infos, MLTypeData *data)
 Reads data type components into different stream versions (istream and istrstream within and outside the standard namespace).
MLEXPORT MLdouble MLGetVoxelValueAsDouble (const void *data, MLDataType dataType, MLErrorCode *errorCode)
 Interprets the data given by data as a value of type dataType and returns its value cast to double.
MLEXPORT MLCTBool MLTypeCastToBool (const MLTypeInfos *infos, const MLTypeData *data)
 If data is identical to default element "false" (= 0) is returned, otherwise "true" (= 1).
MLEXPORT MLCTInt MLTypeCastToInt (const MLTypeInfos *infos, const MLTypeData *data)
 The first component of the data type is converted to integer and returned.
MLEXPORT MLdouble MLTypeCastToDouble (const MLTypeInfos *infos, const MLTypeData *data)
 The first component of the data type is converted to double and returned.
MLEXPORT void MLTypeCastFromBool (const MLTypeInfos *infos, MLCTBool boolValue, MLTypeData *data)
 If boolValue == 0, data is set to the type default value given by infos.
MLEXPORT void MLTypeCastFromInt (const MLTypeInfos *infos, MLCTInt intValue, MLTypeData *data)
 The integer value of intValue is cast to the types of the components and then written to them.
MLEXPORT void MLTypeCastFromDouble (const MLTypeInfos *infos, MLdouble doubleValue, MLTypeData *data)
 The value doubleValue is cast to the types of the components and then written to them.
MLEXPORT void MLTypeBinaryAndInt (const MLTypeInfos *infos, const MLTypeData *sourceData, MLCTInt intValue, MLTypeData *targetData)
 Takes all components from sourceData as integer values, ANDs them with intValue and writes them as (cast from) integer values back to the corresponding components of targetData.
MLEXPORT void MLTypeBinaryOrInt (const MLTypeInfos *infos, const MLTypeData *sourceData, MLCTInt intValue, MLTypeData *targetData)
 Takes all components from sourceData as integer values, ORs them with intValue and writes them as (cast from) integer values back to the corresponding components of targetData.
MLEXPORT void MLTypeBinaryXorInt (const MLTypeInfos *infos, const MLTypeData *sourceData, MLCTInt intValue, MLTypeData *targetData)
 Takes all components from sourceData as integer values, XORs them with intValue and writes them as (cast from) integer values back to the corresponding components of targetData.
MLEXPORT void MLTypeBinaryAnd (const MLTypeInfos *infos, const MLTypeData *sourceData, const MLTypeData *intValue, MLTypeData *targetData)
 Takes all components from sourceData as integer values, ANDs them with corresponding components from intValue (also as integers) and writes them as (cast from) integer values back to the corresponding components of targetData.
MLEXPORT void MLTypeBinaryOr (const MLTypeInfos *infos, const MLTypeData *sourceData, const MLTypeData *intValue, MLTypeData *targetData)
 Takes all components from sourceData as integer values, ORs them with corresponding components from intValue (also as integers) and writes them as (cast from) integer values back to the corresponding components of targetData.
MLEXPORT void MLTypeBinaryXor (const MLTypeInfos *infos, const MLTypeData *sourceData, const MLTypeData *intValue, MLTypeData *targetData)
 Takes all components from sourceData as integer values, XORs them with corresponding components from intValue (also as integers) and writes them as (cast from) integer values back to the corresponding components of targetValue.
MLEXPORT void MLTypeShiftComponentsLeft (const MLTypeInfos *infos, const MLTypeData *sourceData, MLCTInt shiftLeft, MLTypeData *targetData)
 Takes one data type component after another and shifts each component left shiftLs times if it is an integer component.
MLEXPORT void MLTypeCastToOtherType (const MLTypeInfos *otherInfos, const MLTypeData *otherData, const MLTypeInfos *myInfos, MLTypeData *myData)
 Converts a data instance referenced by otherData of a type specified by otherInfos to another data instance referenced by *myData of a type specified by myInfos.
MLEXPORT void MLTypeCastFromOtherType (const MLTypeInfos *otherInfos, const MLTypeData *otherData, const MLTypeInfos *myInfos, MLTypeData *myData)
 Casts another data element otherData with attributes given by otherInfos to myData of a type given by myInfos.
MLEXPORT MLint32 MLTypeIsEqualToOtherType (const MLTypeInfos *myInfos, const MLTypeData *myData, const MLTypeInfos *otherInfos, const MLTypeData *otherData)
 Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.
MLEXPORT MLint32 MLTypeIsSmallerThanOtherType (const MLTypeInfos *myInfos, const MLTypeData *myData, const MLTypeInfos *otherInfos, const MLTypeData *otherData)
 Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.
MLEXPORT MLint32 MLTypeIsGreaterThanOtherType (const MLTypeInfos *myInfos, const MLTypeData *myData, const MLTypeInfos *otherInfos, const MLTypeData *otherData)
 Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.
MLEXPORT void MLTypeMultWithOtherType (const MLTypeInfos *myInfos, const MLTypeData *myData, const MLTypeInfos *otherInfos, const MLTypeData *otherData, MLTypeData *targetData)
 Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.
MLEXPORT void MLTypeDivByOtherType (const MLTypeInfos *myInfos, const MLTypeData *myData, const MLTypeInfos *otherInfos, const MLTypeData *otherData, MLTypeData *targetData)
 Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.
MLEXPORT void MLTypeAddOtherType (const MLTypeInfos *myInfos, const MLTypeData *myData, const MLTypeInfos *otherInfos, const MLTypeData *otherData, MLTypeData *targetData)
 Cast another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.
MLEXPORT void MLTypeSubtractOtherType (const MLTypeInfos *myInfos, const MLTypeData *myData, const MLTypeInfos *otherInfos, const MLTypeData *otherData, MLTypeData *targetData)
 Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.
MLEXPORT void MLTypePowerOfOtherType (const MLTypeInfos *myInfos, const MLTypeData *myData, const MLTypeInfos *otherInfos, const MLTypeData *otherData, MLTypeData *targetData)
 Cast another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.

Variables

Property bits describing functions eventually implemented functions set in MLTypeOperatorFunctions.
MLEXPORT const MLTypePropertyBits MLTypeHasNoProperties
 The data type has no standard properties.
MLEXPORT const MLTypePropertyBits MLTypeHasGetStringValue
 The function getStringValue is implemented. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasSetStringValue
 The function setStringValue is implemented. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeIsSignedType
 The data type is signed.
MLEXPORT const MLTypePropertyBits MLTypeIsFloatingPointType
 The data type is a floating point type. False otherwise.
MLEXPORT const MLTypePropertyBits MLTypeIsIntegerType
 The data type is an integer type. False otherwise.
MLEXPORT const MLTypePropertyBits MLTypeIsBasicType
 The data type is standard scalar data type(intUL, floatUL, charUL, ...).
MLEXPORT const MLTypePropertyBits MLTypeHasSetToMinimum
 The setToMinimum function is implemented. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasSetToMaximum
 The setToMaximum function is implemented. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasSetToDefault
 The setToDefault function is implemented. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasCopy
 Copy parameter one to parameter 2. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasCastToBool
 A data type instance can be cast to bool.
MLEXPORT const MLTypePropertyBits MLTypeHasCastToInt
 A data type instance can be cast to integer.
MLEXPORT const MLTypePropertyBits MLTypeHasCastToDouble
 A data type instance can be cast to double.
MLEXPORT const MLTypePropertyBits MLTypeHasCastToOtherType
 A data type instance can be cast to another type.
MLEXPORT const MLTypePropertyBits MLTypeHasCastFromBool
 A bool can be cast to a data type instance.
MLEXPORT const MLTypePropertyBits MLTypeHasCastFromInt
 An integer can be cast to a data type instance.
MLEXPORT const MLTypePropertyBits MLTypeHasCastFromDouble
 A double can be cast to a data type instance.
MLEXPORT const MLTypePropertyBits MLTypeHasCastFromOtherType
 Any data type instance can be cast a data type instance.
MLEXPORT const MLTypePropertyBits MLTypeHasBinaryAndInt
 A data type instance can be binary anded with integer.
MLEXPORT const MLTypePropertyBits MLTypeHasBinaryOrInt
 A data type instance can be binary ored with integer.
MLEXPORT const MLTypePropertyBits MLTypeHasBinaryXorInt
 A data type instance can be binary xored with integer.
MLEXPORT const MLTypePropertyBits MLTypeHasBinaryIntAnd
 An integer can be anded with a data type instance.
MLEXPORT const MLTypePropertyBits MLTypeHasBinaryIntOr
 An integer can be ored with a data type instance.
MLEXPORT const MLTypePropertyBits MLTypeHasBinaryIntXor
 An integer can be xored with a data type instance.
MLEXPORT const MLTypePropertyBits MLTypeHasBinaryAnd
 Two a data type instances can be binary anded.
MLEXPORT const MLTypePropertyBits MLTypeHasBinaryOr
 Two a data type instances can be binary ored.
MLEXPORT const MLTypePropertyBits MLTypeHasBinaryXor
 Two a data type instances can be binary xored.
MLEXPORT const MLTypePropertyBits MLTypeHasShiftLeft
 A data type instances can be shifted left an integer number times.
MLEXPORT const MLTypePropertyBits MLTypeHasShiftRight
 A data type instances can be shifted right an integer number times.
MLEXPORT const MLTypePropertyBits MLTypeHasInvert
 The a data type instance can be inverted.
MLEXPORT const MLTypePropertyBits MLTypeHasNegate
 The negative value of a data type instance can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasNormalize
 A data type instance can be normalized.
MLEXPORT const MLTypePropertyBits MLTypeHasIsEqualToInt
 An equality relation between an integer and a data type instances can be calculated. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasIsEqualToDouble
 An equality relation between a double and a data type instances can be calculated. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasIsIntEqualTo
 An equality relation between a data type instances and an integer can be calculated. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasIsDoubleEqualTo
 An equality relation between a data type instances and a double can be calculated. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasIsEqualToType
 An equality relation between two type instances can be calculated. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasIsEqualToOtherType
 An equality relation between two type instances can be calculated. (Note: This function must be implemented.).
MLEXPORT const MLTypePropertyBits MLTypeHasIsSmallerThanInt
 A smaller relation between a data type instances and an int can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasIsSmallerThanDouble
 A smaller relation between a data type instances and a double can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasIsSmallerThanType
 A smaller relation between two type instances can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasIsSmallerThanOtherType
 A smaller relation between two type instances can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasIsGreaterThanInt
 A greater relation between a data type instances and an int can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasIsGreaterThanDouble
 A greater relation between a data type instances and a double can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasIsGreaterThanType
 A greater relation between two type instances can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasIsGreaterThanOtherType
 A greater relation between two type instances can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasMultWithInt
 Data type instance can be multiplied with integer.
MLEXPORT const MLTypePropertyBits MLTypeHasMultWithDouble
 Data type instance can be multiplied with double.
MLEXPORT const MLTypePropertyBits MLTypeHasMultIntWith
 An integer and a data type instance can be multiplied.
MLEXPORT const MLTypePropertyBits MLTypeHasMultDoubleWith
 A double and a data type instance can be multiplied.
MLEXPORT const MLTypePropertyBits MLTypeHasMultWithType
 Two data type instances can be multiplied.
MLEXPORT const MLTypePropertyBits MLTypeHasMultWithOtherType
 A data type instances can be multiplied with the one of another type.
MLEXPORT const MLTypePropertyBits MLTypeHasDivByInt
 A data type instances can be divided by integer.
MLEXPORT const MLTypePropertyBits MLTypeHasDivByDouble
 A data type instances can be divided by double.
MLEXPORT const MLTypePropertyBits MLTypeHasDivIntBy
 An integer can be divided by a data type instances.
MLEXPORT const MLTypePropertyBits MLTypeHasDivDoubleBy
 A double can be divided by a data type instances.
MLEXPORT const MLTypePropertyBits MLTypeHasDivByType
 A data type instances can be divided by another one.
MLEXPORT const MLTypePropertyBits MLTypeHasDivByOtherType
 A data type instances can be divided by another one of other type.
MLEXPORT const MLTypePropertyBits MLTypeHasPlusInt
 A data type instance and an integer can be added.
MLEXPORT const MLTypePropertyBits MLTypeHasPlusDouble
 A data type instance and a double can be added.
MLEXPORT const MLTypePropertyBits MLTypeHasIntPlus
 Integer and data type instance can be added.
MLEXPORT const MLTypePropertyBits MLTypeHasDoublePlus
 Double and data type instance can be added.
MLEXPORT const MLTypePropertyBits MLTypeHasPlusType
 Two data type instances can be added.
MLEXPORT const MLTypePropertyBits MLTypeHasPlusOtherType
 A data type instances can be added with an instance of another type.
MLEXPORT const MLTypePropertyBits MLTypeHasMinusInt
 An integer can be subtracted from a data type instances.
MLEXPORT const MLTypePropertyBits MLTypeHasMinusDouble
 A double can be subtracted from a data type instances.
MLEXPORT const MLTypePropertyBits MLTypeHasIntMinus
 A data type instances can be subtracted from an integer.
MLEXPORT const MLTypePropertyBits MLTypeHasDoubleMinus
 A data type instances can be subtracted from a double.
MLEXPORT const MLTypePropertyBits MLTypeHasMinusType
 A data type instances can be subtracted from another.
MLEXPORT const MLTypePropertyBits MLTypeHasMinusOtherType
 A data type instances can be subtracted from another of other type.
MLEXPORT const MLTypePropertyBits MLTypeHasPowerOfInt
 The power of a data type instance and an integer can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasPowerOfDouble
 The power of a data type instance and a double can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasPowerIntOf
 The power of an int and a data type instance can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasPowerDoubleOf
 The power of a double and a data type instance can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasPowerOfType
 The power of a data type instance and a data type instance can be calculated.
MLEXPORT const MLTypePropertyBits MLTypeHasPowerOfOtherType
 The power of a data type instance and a data type instance of other type can be calculated.
Bit masks specifying general properties of a data type.
MLEXPORT const MLTypePropertyBits MLTypeOnlyStandardTypes
 A data type has all standard properties and is a standard type.
MLEXPORT const MLTypePropertyBits MLTypeFullyOperational
 A data type has all standard properties of a standard type.
MLEXPORT const MLTypePropertyBits MLTypeMinimumOperational
 A data type has only the minimum operations required by the ML (add, mult, casts).
Additional functions on data type which are not implicitly called by carrier types.
MLEXPORT const MLTypePropertyBits MLTypeHasSinOfType
 The sine function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasCosOfType
 The cosine function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasTanOfType
 The tangent function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasAsinOfType
 The arcsine function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasAcosOfType
 The arcus cosine function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasAtanOfType
 The arctangent function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasSinhOfType
 The hyperbolic sine function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasCoshOfType
 The hyperbolic cosine function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasTanhOfType
 The hyperbolic tangent function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasExpOfType
 The exponential function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasLogOfType
 The logarithm function can be used on this data type.
MLEXPORT const MLTypePropertyBits MLTypeHasSqrtOfType
 The sqrt function can be used on this data type.
Global table of currently used MLTypeInfos.
MLEXPORT MLTypeInfosTableStruct MLTypeInfosTable
 This global table contains pointers to all currently registered and used MLTypesInfos.


Detailed Description

Defines basic data types, constants and macros for MeVis projects.

This file also contains the stuff used to implement new data types for the ML. There are also many convenience functions to simplify that. To register a new data type it is required to implement a set of type operations as static functions. Pointers to those functions are stored in a single MLTypeInfos structure and then registered in the ML with the command MLRegisterTypeInfos.

The set of carrier types (see MLCarrierTypes.h) which is compiled into algorithms directly are only carriers which call the currently activated type operations on the data. They use the pointers to type operations registered by an MLTypeInfo structure. These pointer tables are globally available in the MLTypeInfosTable. The contents of that table are usually automatically set by the ml; however in rare cases it might be necessary to control it manually. Then use MLTypeInfosPushAndSet* and MLTypeInfosPop commands for that.

Author:
Wolf Spindler
Date:
10/2000

Definition in file mlDataTypes.h.


Define Documentation

#define MLPromotedPrecision   MLGetPromotedPrecision

Deprecated:
Use MLGetPromotedPrecision instead of MLPromotedPrecision. (MACRO_RENAME)

Definition at line 223 of file mlDataTypes.h.

#define MLTypeInfosAtIdx   MLGetTypeInfosAtIndex

Deprecated:
Use MLGetTypeInfosAtIndex instead of MLTypeInfosAtIdx. (MACRO_RENAME)

Definition at line 507 of file mlDataTypes.h.


Function Documentation

MLEXPORT MLTypeData* MLAllocateVoxelBuffer ( MLDataType  dataType,
size_t  numVoxels,
const MLTypeData voxelDefaultValue 
)

Returns a buffer of numVoxels voxels of data type dataType.

On failure NULL is returned. If voxelDefaultValue is NULL, the allocated memory is left undefined, otherwise all voxels are filled with the the default value pointed to by voxelDefaultValue. The allocated buffer must be removed with MLFree().

MLEXPORT MLint32 MLAreTypesInitialized (  ) 

Returns 1(=true) if type table is initialized, otherwise 0(=false).

MLEXPORT void MLDestroyTypes (  ) 

Destroy ML type management.

MLEXPORT const char* MLGetCDataTypeNameForCharCode ( char  code  ) 

Returns the basic C/C++ data type name corresponding to a character representing it.

On an invalid code, "" is returned.

MLEXPORT MLDataType MLGetMLDataTypeForCharCode ( char  code  ) 

Returns an ML data type compatible to a character representing it.

On an invalid code, ML_INVALID_DATA_TYPE is returned.

MLEXPORT const char* MLGetMLDataTypeNameForCharCode ( char  code  ) 

Returns an ML type name type name compatible to a character representing it.

On an invalid code, "" is returned. The return value match for function calls to MLDataTypeFromName().

MLEXPORT size_t MLGetNumRegisteredTypeInfos (  ) 

Returns the number of registered type operations.

MLEXPORT MLTypeInfos* MLGetTypeInfosAtIndex ( size_t  index  ) 

Returns the index th registered type operation, NULL on invalid index.

MLEXPORT MLTypeInfos* MLGetTypeInfosForDataType ( MLDataType  dataType  ) 

Returns the MLTypeInfos for the data type dataType, or NULL on non registered or invalid type.

MLEXPORT MLdouble MLGetVoxelValueAsDouble ( const void *  data,
MLDataType  dataType,
MLErrorCode errorCode 
)

Interprets the data given by data as a value of type dataType and returns its value cast to double.

If something fails, 0 is returned. errorCode may be passed as NULL. If errorCode is not NULL, *errorCode is set to the error code on failures; otherwise it is set to ML_RESULT_OK.

MLEXPORT char* MLGetVoxelValueAsString ( const MLTypeData data,
MLDataType  dataType,
MLErrorCode errorCode 
)

Interprets the data given by data as a value of type dataType and return its value as string.

If something fails, "" is returned. errorCode may be passed as NULL. If errorCode is not NULL, *errorCode is set to the error code on failures; otherwise it is set to ML_RESULT_OK. Floating point values are normally printed with maximum precision. The returned pointer must be freed with MLFree().

MLEXPORT char* MLGetVoxelValueAsStringLimited ( const MLTypeData data,
MLDataType  dataType,
MLErrorCode errorCode,
int  maxPrecision 
)

Interprets the data given by data as a value of type dataType and returns its value as string.

If something fails, "" is returned. errorCode may be passed as NULL. If errorCode is not NULL, *errorCode is set to the error code on failures; otherwise it is set to ML_RESULT_OK. If maxPrecision is passed with values smaller than 0 then maximum precision of floating point numbers is printed. If passed >= 0 then the number of digits is limited to maxPrecision. It will be not larger than the maximum default precision even if specified so. The returned pointer must be freed with MLFree().

MLEXPORT MLint32 MLInitializeTypes (  ) 

Initialize all ML type management.

0 (=false) is returned on failure, 1 (=true) on success. This function must be called before using any ML* function.

MLEXPORT MLint32 MLIsRegisteredTypeInfos ( const MLTypeInfos infos  ) 

Returns 1(=true) if data type is already registered. Otherwise 0(=false) is returned.

MLEXPORT MLDataType MLPromotedType ( MLDataType  datatype1,
MLDataType  datatype2 
)

Deprecated:
Use MLGetPromotedType instead of MLPromotedType.

MLEXPORT MLint32 MLRegisterTypeInfos ( MLTypeInfos infos  ) 

Adds the data type class infos to the list of registered data types.

Returns 1(=true) on success, 0(=false) on failure (e.g., out of memory, table not initialized, type exists,...). Registration of infos sets infos->dataTypeId. Note that number of data types is limited to 2^32-1 even on 64 bit systems to have cast option to MLDataType enum/integer.

MLEXPORT void MLTypeAddOtherType ( const MLTypeInfos myInfos,
const MLTypeData myData,
const MLTypeInfos otherInfos,
const MLTypeData otherData,
MLTypeData targetData 
)

Cast another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.

That buffer is added with myData and written into targetData. For the addition myInfos->addToType is used.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_plusOtherType().

MLEXPORT void MLTypeBinaryAnd ( const MLTypeInfos infos,
const MLTypeData sourceData,
const MLTypeData intValue,
MLTypeData targetData 
)

Takes all components from sourceData as integer values, ANDs them with corresponding components from intValue (also as integers) and writes them as (cast from) integer values back to the corresponding components of targetData.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_binaryAnd().

MLEXPORT void MLTypeBinaryAndInt ( const MLTypeInfos infos,
const MLTypeData sourceData,
MLCTInt  intValue,
MLTypeData targetData 
)

Takes all components from sourceData as integer values, ANDs them with intValue and writes them as (cast from) integer values back to the corresponding components of targetData.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_binaryAndInt(), and ml::MLTStdTypeInfos< VTYP >::MLTYPE_binaryIntAnd().

MLEXPORT void MLTypeBinaryOr ( const MLTypeInfos infos,
const MLTypeData sourceData,
const MLTypeData intValue,
MLTypeData targetData 
)

Takes all components from sourceData as integer values, ORs them with corresponding components from intValue (also as integers) and writes them as (cast from) integer values back to the corresponding components of targetData.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_binaryOr().

MLEXPORT void MLTypeBinaryOrInt ( const MLTypeInfos infos,
const MLTypeData sourceData,
MLCTInt  intValue,
MLTypeData targetData 
)

Takes all components from sourceData as integer values, ORs them with intValue and writes them as (cast from) integer values back to the corresponding components of targetData.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_binaryIntOr(), and ml::MLTStdTypeInfos< VTYP >::MLTYPE_binaryOrInt().

MLEXPORT void MLTypeBinaryXor ( const MLTypeInfos infos,
const MLTypeData sourceData,
const MLTypeData intValue,
MLTypeData targetData 
)

Takes all components from sourceData as integer values, XORs them with corresponding components from intValue (also as integers) and writes them as (cast from) integer values back to the corresponding components of targetValue.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_binaryXor().

MLEXPORT void MLTypeBinaryXorInt ( const MLTypeInfos infos,
const MLTypeData sourceData,
MLCTInt  intValue,
MLTypeData targetData 
)

Takes all components from sourceData as integer values, XORs them with intValue and writes them as (cast from) integer values back to the corresponding components of targetData.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_binaryIntXor(), and ml::MLTStdTypeInfos< VTYP >::MLTYPE_binaryXorInt().

MLEXPORT void MLTypeCastFromBool ( const MLTypeInfos infos,
MLCTBool  boolValue,
MLTypeData data 
)

If boolValue == 0, data is set to the type default value given by infos.

If boolValue != 0, all components of the type are cast to their values cast from 1.

MLEXPORT void MLTypeCastFromDouble ( const MLTypeInfos infos,
MLdouble  doubleValue,
MLTypeData data 
)

The value doubleValue is cast to the types of the components and then written to them.

MLEXPORT void MLTypeCastFromInt ( const MLTypeInfos infos,
MLCTInt  intValue,
MLTypeData data 
)

The integer value of intValue is cast to the types of the components and then written to them.

MLEXPORT void MLTypeCastFromOtherType ( const MLTypeInfos otherInfos,
const MLTypeData otherData,
const MLTypeInfos myInfos,
MLTypeData myData 
)

Casts another data element otherData with attributes given by otherInfos to myData of a type given by myInfos.

See MLTypeCastToOtherType for more infos.

MLEXPORT MLCTBool MLTypeCastToBool ( const MLTypeInfos infos,
const MLTypeData data 
)

If data is identical to default element "false" (= 0) is returned, otherwise "true" (= 1).

MLEXPORT MLdouble MLTypeCastToDouble ( const MLTypeInfos infos,
const MLTypeData data 
)

The first component of the data type is converted to double and returned.

MLEXPORT MLCTInt MLTypeCastToInt ( const MLTypeInfos infos,
const MLTypeData data 
)

The first component of the data type is converted to integer and returned.

MLEXPORT void MLTypeCastToOtherType ( const MLTypeInfos otherInfos,
const MLTypeData otherData,
const MLTypeInfos myInfos,
MLTypeData myData 
)

Converts a data instance referenced by otherData of a type specified by otherInfos to another data instance referenced by *myData of a type specified by myInfos.

As long as components of any data type in the source exist the myData components are set to the same values. Components which do not have a counterpart in the otherData are filled with the counterparts from its default value given by the myInfos. E.g.: If an (int, char, double) data type (represented by "ICd") is cast to a four component float vector (represented by "ffff") then the first three components are set from an int cast to double, from an char cast to double and from an double cast to double. The fourth component is copied from the fourth component of of the type default value given in the MLTypeInfo otherInfos.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_castFromOtherType(), and ml::MLTStdTypeInfos< VTYP >::MLTYPE_castToOtherType().

MLEXPORT MLint32 MLTypeComponentsFromStream ( void *  iStr,
void *  iStrStream,
void *  stdiStr,
void *  stdiStrStream,
const MLTypeInfos infos,
MLTypeData data 
)

Reads data type components into different stream versions (istream and istrstream within and outside the standard namespace).

Since we have a c-interface here we need to pass the pointers to the streams as void * addresses. So be careful to which of the first parameters the stream is passed. All other can be set to NULL. On any error *data is correctly set as far as possible, and all unreadable values are set to the default value. On bad parameters, failures or not completely readable values 0 is returned, otherwise 1.

Referenced by std::operator>>().

MLEXPORT MLint32 MLTypeComponentsFromString ( const MLTypeInfos infos,
const char *  stringData,
const MLTypeData defaultValue,
MLTypeData data 
)

Converts a string of a data type instance to instance data, i.e., like an sscanf.

infos points to the type information and data points to the data of the type instance to be filled with data scanned from stringData. The return value is 1 if the string could be scanned successfully. On scan failures or invalid parameters 0 is returned. If a default value is passed in defaultValue, components which could not be scanned correctly are copied from their corresponding positions in defaultValue. If defaultValue is passed as NULL, those components are left unchanged.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_setStringValue().

MLEXPORT size_t MLTypeComponentSize ( char  component  ) 

Returns the sizeof of a MLTypeComponent component denoted by a character code.

On invalid character codes 0 is returned. Valid codes are 'b' = bool , 'c' = unsigned char , 'C' = char , 's' = unsigned short 'S' = short , 'i' = unsigned int , 'I' = int , 'l' = unsigned long 'L' = long , '6' = MLint64 , 'f' = float , 'd' = double 'D' = long double, '9' = MLuint64

MLEXPORT char* MLTypeComponentsToString ( const MLTypeInfos infos,
const MLTypeData data 
)

Converts a data type instance to a string.

infos points to the type information and data points to the data of the type instance. The return value is a string containing the type components converted to string values separated by spaces. It must be freed with MLFree(). Floating point values are normally printed with maximum precision. On failures (e.g., infos==NULL or data==NULL), an empty string is returned which also must be freed.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_getStringValue(), and std::operator<<().

MLEXPORT char* MLTypeComponentsToStringLimited ( const MLTypeInfos infos,
const MLTypeData data,
int  maxPrecision 
)

Converts a data type instance to a string.

infos points to the type information and data points to the data of the type instance. The return value is a string containing the type components converted to string values separated by spaces. It must be freed with MLFree(). If maxPrecision is passed with values smaller than 0 then maximum precision of floating point numbers is printed. If passed >= 0 then the number of digits is limited to maxPrecision. It will be not larger than the maximum default precision even if specified so. On failures (e.g., infos==NULL or data==NULL), an empty string is returned which also must be freed.

MLEXPORT void MLTypeConvertToBigEndian ( const MLTypeInfos infos,
const MLTypeData sourceBufferPointer,
MLTypeData targetBufferPointer,
size_t  numInstances 
)

Converts data type instances from little endian to big endian.

Parameters:
infos the TypeInfos data structure describing the data type.
sourceBufferPointer points to the first instance to be converted.
targetBufferPointer points to the memory area where the converted instances shall be stored. Identical srcBufPtr and targetBufPtr will be handled correctly.
numInstances the number of instances to be converted. The call will be ignored if any parameter pointer is NULL or numInstances is 0.

MLEXPORT void MLTypeConvertToLittleEndian ( const MLTypeInfos infos,
const MLTypeData sourceBufferPointer,
MLTypeData targetBufferPointer,
size_t  numInstances 
)

Converts data type instances from big endian to little endian.

Parameters:
infos the TypeInfos data structure describing the data type.
sourceBufferPointer points to the first instance to be converted.
targetBufferPointer points to the memory area where the converted instances shall be stored. Identical srcBufPtr and targetBufPtr will be handled correctly.
numInstances the number of instances to be converted. The call will be ignored if any parameter pointer is NULL or numInstances is 0.

MLEXPORT void MLTypeCorrectPropertyBits ( MLTypeInfos infos  ) 

Corrects all property bits except of the basic properties (MLTypeIsSignedType, MLTypeIsFloatingPointType, MLTypeIsIntegerType, MLIsBasicType).

Must be called after initialization and settings function pointers. infos must be a pointer to a valid MLTypeOperatorFunctions struct.

MLEXPORT void MLTypeDivByOtherType ( const MLTypeInfos myInfos,
const MLTypeData myData,
const MLTypeInfos otherInfos,
const MLTypeData otherData,
MLTypeData targetData 
)

Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.

Then myData is divided by the buffer and written into targetData. For the division myInfos->divByType is used.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_divByOtherType().

MLEXPORT MLDataType MLTypeGetBestScalarTypeForTypeComponentChars ( const char *  charCodes,
int  suppressML64BitInts,
int  suppressMLldouble 
)

Returns a standard data type which is able to hold the precisions of each of the type component characters passed as charCodes.

The routine returns the smallest possible data type which fulfills the criteria. If suppressML64BitInts is passed as true (!=0), a potential return value of ML(u)int64Type will be replaced by MLdoubleType, otherwise it is not changed. If suppressMLldouble is passed as true (!= 0), a potential return value of MLldoubleType will be replaced by MLdoubleType, otherwise it is not changed. Note that passing suppressML64BitInts and/or suppressMLldouble as true may result in return types which might not hold the precision or ranges of all components of the type. For NULL pointers as typeComps, string containing invalid components chars, or empty strings ML_INVALID_DATA_TYPE is returned. See also MLTypeGetBestScalarTypeForTypeComponents().

MLEXPORT MLDataType MLTypeGetBestScalarTypeForTypeComponents ( MLDataType  dataType,
int  suppressML64BitInts,
int  suppressMLldouble 
)

Return a standard data type which is able to hold the precisions of each of the components of the type dataType.

The routine returns the smallest possible data type which fulfills the criteria. If suppressML64BitInts is passed as true (!=0), a potential return value of ML(u)int64Type will be replaced by MLdoubleType, otherwise it is not changed. If suppressMLldouble is passed as true (!= 0), a potential return value of MLldoubleType will be replaced by MLdoubleType, otherwise it is not changed. Note that passing suppressML64BitInts and/or suppressMLldouble as true may result in return types which might not hold the precision or ranges of all components of the type. For invalid data types ML_INVALID_DATA_TYPE is returned. See also MLTypeGetBestScalarTypeForTypeComponentChars().

MLEXPORT MLint32 MLTypeGetComponentProperties ( char  code,
MLint32 isSigned,
MLint32 isIntegerType,
MLint32 isFloatingPointType,
MLint32 isLongType 
)

Returns true (=1) in *isSigned, *isIntegerType, *isFloatingPointType and *isLongType if the component type represented by code has this features, otherwise set that flag to false (=0).

Note that long types are MLldouble ('D'), MLint64 ('6'), and MLuint64 ('9'). long and unsigned long ('l' and 'L') are not considered as long types since they are in most cases also 32 bit types. Invalid code values return false (=0) in all parameters. It is explicitly permitted to pass NULL as isSigned, isIntegerType, isFloatingPointType or isLongType. Then these pointers are simple ignored. true (=1) is returned if comp was a valid component, otherwise the return value is 0.

MLEXPORT MLTypeData* MLTypeGetDataValuesFromString ( MLDataType  dataType,
const char *  voxelValue,
const MLTypeData defaultValue,
size_t  numInstances 
)

Allocates a buffer for numInstances of data type dataType and fills it with the data type value converted from the null-terminated string voxValue.

All type components which cannot be converted correctly are filled with the corresponding components from defaultValue, or if defaultValue is NULL, from the type specific component defaults. On success a pointer to the allocated data is returned, otherwise NULL. The returned value must be freed by the calling application with MLFree().

MLEXPORT MLdouble MLTypeGetDoubleComponent ( char  component,
const MLTypeData targetPointer 
)

Interpret the data referenced by *targetPointer as data of the type component and return it as double value.

Invalid character codes are ignored and change nothing. Then the return value is 0.

MLEXPORT MLCTInt MLTypeGetIntComponent ( char  component,
const MLTypeData targetPointer 
)

Like MLTypeGetComponent, only that the components is returned as integer values.

MLEXPORT MLErrorCode MLTypeGetMinMaxRangeOfComponents ( const MLTypeInfos infos,
const MLTypeData srcPtr,
MLldouble retMin,
MLldouble retMax 
)

Returns the min/max range of all components of an arbitrary registered voxel.

Parameters:
infos Type information describing the data type of the voxel passed in srcPtr.
srcPtr A pointer to one voxel of the data type described in infos.
retMin Ignored if NULL, otherwise *retMin is set to the lowest value found in all components of the voxel.
retMax Ignored if NULL, otherwise *retMax is set to the highest value found in all components of the voxel.
Returns:
ML_RESULT_OK if infos and srcPtr point to valid data and valid min/max values could be determined. Otherwise an error codes describing the error type (typically ML_BAD_PARAMETER).

MLEXPORT size_t MLTypeGetNumComponents ( MLDataType  dataType  ) 

Returns the number of components of the data type dataype or 0 in case of an invalid data type.

MLEXPORT const char* MLTypeGetStructInfoString ( MLDataType  dataType  ) 

Returns the components codes of the data type dataType or "" in case of an invalid data type.

The returned pointer is always a valid, non-NULL pointer to a null terminated string.

MLEXPORT void MLTypeInfoPop ( MLTypePushSingleInfo  pushInfo  ) 

The previous call of either MLTypeInfosPushAndSetInput or MLTypeInfosPushAndSetOutput is made undone by popping the pushed information from the stack and by restoring the MLTypeInfosTable.

Popping without previous symmetric push leads to undefined operations.

MLEXPORT MLTypeData* MLTypeInfosCreateBuffer ( const MLTypeInfos infos  ) 

Returns a buffer of the size of one data element. NULL is returned on failure.

MLEXPORT MLint32 MLTypeInfosInit ( MLTypeInfos infos,
size_t  registeredTypeSize,
const char *  name,
MLldouble  ldblMin,
MLldouble  ldblMax,
const MLTypeData typeMinPtr,
const MLTypeData typeMaxPtr,
const MLTypeData typeDefaultPtr,
const char *  typeStructInfo,
MLint32  isBasicType,
MLPhysicalDataType  rangeAndPrecisionEquiv,
void **  componentAddresses,
size_t  numGoodCastTos,
const char **  goodCastTos 
)

Initialization of the main properties of MLTypeInfos.

Returns 1(=true) on success, 0(=false) on failure.

Parameters:
infos The MLTypeInfos structure to be initialized.
registeredTypeSize The sizeof of the real data type (not the size of the carrying byte type)
name null terminated string name of data type. Only alphanumeric characters without spaces, braces, etc., names should be used.
ldblMin Set minimum and maximum double values.
  • Try to select values which will not be exceeded when the new type is cast to double.
  • Try to select values which are converted to the types' minimum/maximum after casting them to the new type. However, that is desirable but not really necessary.
ldblMax See lbdblMin.
typeMinPtr Set pointers to a permanent instances of the the data type minimum and maximum value. Try to select minimum and maximum value so that they match to minimum and maximum double value after casting them to double. However, that is desirable but not really necessary.
typeMaxPtr See typeMinPtr.
typeDefaultPtr Pointer to a permanent instance of the data type default value.
  • This value will be used when initializing or completing incomplete type components e.g., after incomplete string scans or casts.
  • This value will also be used as a 0-element.
  • This value will be used as "false" on boolean casts in the default implementation. All other values will be considered as "true".
typeStructInfo Set pointer to a permanent null-terminated string describing the type configuration. It is needed for most default implementations of the type, e.g., correct big endian/little endian conversions when storing loading this data, for automatic casts to other type etc. It must exactly describe the types' configuration. Use
  • 'b' for a boolean.
  • 'c' for an unsigned character.
  • 'C' for a (signed) character.
  • 's' for an unsigned short.
  • 'S' for a signed short.
  • 'i' for an unsigned int.
  • 'I' for a signed int.
  • 'l' for an unsigned long.
  • 'L' for a signed long.
  • '6' for a 64 bit signed integer.
  • '9' for a 64 bit unsigned integer.
  • 'f' for a float.
  • 'd' for a double.
  • 'D' for a long double.
    So a data type consisting of a float[3], a bool, and two signed integers would lead to "fffbII".
isBasicType Pass true if it is a basic type, i.e., one of the following: (unsigned) char, (unsigned) short, (unsigned) int, (unsigned) long, float, double, long double or MLint64.
rangeAndPrecisionEquiv Pass a standard data type (not a carrier type!) which has comparable range and precision behavior.
componentAddresses is an array of pointers to the components of an example data instance so that gaps between components can be evaluated. It must contain exactly as many pointers as the length of typeStructInfo.
numGoodCastTos Return types and number of them to which this type can be cast without information loss.
goodCastTos An array to the string names of those data types to which this type can be cast without information loss. It must have exactly the number of entries given by numGoodCastTos.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTStdTypeInfos().

MLEXPORT void MLTypeInfosPop ( MLTypePushDoubleInfo  infos  ) 

The previous calls of either MLTypeInfosPushAndSetBoth or MLTypeInfosPushAndSetTypes are made undone by popping their pushed information from the stack and by restoring the MLTypeInfosTable.

Popping without previous symmetric push leads to undefined operations.

Referenced by ml::TSubImage< DATATYPE >::calculateMinMax(), ml::TSubImage< DATATYPE >::copySubImage(), ml::TSubImage< DATATYPE >::copySubImageReorderColorPlanesToInterleaved(), ml::TSubImage< DATATYPE >::fill(), ml::TSubImage< DATATYPE >::fillBordersWithBorderValues(), ml::TSubImage< DATATYPE >::fillBordersWithInputValues(), and ml::TSubImage< DATATYPE >::fillBordersWithValue().

MLEXPORT MLTypePushDoubleInfo MLTypeInfosPushAndSetBoth ( MLDataType  dataType  ) 

This routine determines the indices in the MLTypeInfosTable which are used by the input and output versions of the MLDataType dataType and pushes them onto stacks.

For return value see MLTypePushDoubleInfo. Then it overwrites the pointers within the table with the pointer to the type infos needed by dataType. dataType must be a valid MLDataType. Undefined MLDataTypes will lead to undefined operations.

Referenced by ml::TSubImage< DATATYPE >::calculateMinMax(), ml::TSubImage< DATATYPE >::fill(), ml::TSubImage< DATATYPE >::fillBordersWithBorderValues(), and ml::TSubImage< DATATYPE >::fillBordersWithValue().

MLEXPORT MLTypePushSingleInfo MLTypeInfosPushAndSetInput ( MLDataType  dataType  ) 

This routine determines the index into the MLTypeInfosTable which is used by the input versions of the MLDataType dataType and pushes it onto a stack.

Then it overwrites the pointer within the table with the pointer to the type infos needed by dataType. For return value see MLTypePushSingleInfo. dataType must be a valid MLDataType. Undefined MLDataTypes will lead to undefined operations. ATTENTION! If using this function with carrier types you must take care that dataType is really used for an output carrier type of type MLCarrier*In with "In" at its end. Otherwise wrong assignments of MLTypeInfos to carrier types may occur.

MLEXPORT MLTypePushSingleInfo MLTypeInfosPushAndSetOutput ( MLDataType  dataType  ) 

This routine determines the index in the MLTypeInfosTable which is used by the output versions of the MLDataType dataType and pushes it onto a stack.

Then it overwrites the pointer within the table with the pointer to the type infos needed by dataType. For return value see MLTypePushSingleInfo. dataType must be a valid MLDataType. Undefined MLDataTypes will lead to undefined operations. ATTENTION! When using this function with carrier types you must take care that dataType is really used for an output carrier type of type MLCarrier* without "In" at its end. Otherwise wrong assignments of MLTypeInfos to carrier types may occur.

MLEXPORT MLTypePushDoubleInfo MLTypeInfosPushAndSetTypes ( MLDataType  datatype1,
MLint32  isDT1AnInputType,
MLDataType  datatype2,
MLint32  isDT2AnInputType 
)

This routine determines the indices in the MLTypeInfosTable which are used by the MLDataTypes datatype1 and datatype2, and pushes them onto a stack.

Then it overwrites the pointers within the table with the pointers to the type infos needed by datatype1 and datatype2. datatype1 and datatype2 must be a valid MLDataTypes. Undefined MLDataTypes will lead to undefined operations. Additionally, it must be passed as true (!= 0) if datatype1 or datatype2 are carierIn Types, because then they need other table entries. For return value see MLTypePushDoubleInfo. ATTENTION! When using this function with carrier types you must take care that they really MLCarrier*In type when passing a value != 0 for isDT*AnInputType to avoid crashes.

Referenced by MLTTypeInfosPushAndSetBoth().

MLEXPORT void MLTypeInfosRemoveBuffer ( MLTypeData buffer  ) 

Removes a buffer created with MLTypeInfosCreateBuffer.

MLEXPORT MLint32 MLTypeIsEqualToOtherType ( const MLTypeInfos myInfos,
const MLTypeData myData,
const MLTypeInfos otherInfos,
const MLTypeData otherData 
)

Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.

If that buffer is equal to myData, 1 (=true) is returned, otherwise 0 (= false). For the comparison myInfos->isEqualToType is used.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_isEqualToOtherType().

MLEXPORT MLint32 MLTypeIsGreaterThanOtherType ( const MLTypeInfos myInfos,
const MLTypeData myData,
const MLTypeInfos otherInfos,
const MLTypeData otherData 
)

Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.

If that buffer is larger than myData, 1 (=true) is returned, otherwise 0 (= false). For the comparison myInfos->isGreaterThanType is used.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_isGreaterThanOtherType().

MLEXPORT MLint32 MLTypeIsSmallerThanOtherType ( const MLTypeInfos myInfos,
const MLTypeData myData,
const MLTypeInfos otherInfos,
const MLTypeData otherData 
)

Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.

If that buffer is smaller than myData, 1 (=true) is returned, otherwise 0 (= false). For the comparison myInfos->isSmallerThanType is used.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_isSmallerThanOtherType().

MLEXPORT void MLTypeMultWithOtherType ( const MLTypeInfos myInfos,
const MLTypeData myData,
const MLTypeInfos otherInfos,
const MLTypeData otherData,
MLTypeData targetData 
)

Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.

That buffer is multiplied with myData and written into targetData. For the multiplication myInfos->multWithType is used.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_multWithOtherType().

MLEXPORT void MLTypePowerOfOtherType ( const MLTypeInfos myInfos,
const MLTypeData myData,
const MLTypeInfos otherInfos,
const MLTypeData otherData,
MLTypeData targetData 
)

Cast another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.

The power of myData with the buffer is calculated and written into targetData. For the power calculation myInfos->powerOfType is used.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_powerOfOtherType().

MLEXPORT MLTypePropertyBits MLTypePropBitsAnd ( MLTypePropertyBits  propertyBits,
MLTypePropertyBits  mask 
)

Ands of all bits in mask and those in propertyBits.

MLEXPORT MLTypePropertyBits MLTypePropBitsOr ( MLTypePropertyBits  propertyBits,
MLTypePropertyBits  mask 
)

Adds all set bits in mask to those in propertyBits.

MLEXPORT MLint32 MLTypePropBitsTest ( MLTypePropertyBits  propertyBits,
MLTypePropertyBits  mask 
)

Returns true(=1) if bit mask mask is part of propertyBits, otherwise return false(=0).

MLEXPORT MLTypePropertyBits MLTypePropBitsXor ( MLTypePropertyBits  propertyBits,
MLTypePropertyBits  mask 
)

Inverts all set bits property bits from propertyBits which are set in mask.

MLEXPORT void MLTypeSetAllDoubleComponents ( const MLTypeInfos infos,
MLdouble  value,
MLTypeData targetPointer 
)

All components of the data referenced by *targetPointer are set to their values cast from the double value.

Casting is performed by the MLTypeSetComponent function.

MLEXPORT void MLTypeSetAllIntComponent ( const MLTypeInfos infos,
MLCTInt  value,
MLTypeData targetPointer 
)

Like MLTypeSetAllDoubleComponents, only components are set to integer values.

MLEXPORT void MLTypeSetDefaultFunctionPointers ( MLTypeInfos infos  ) 

Sets all function pointers to default values which do error handling when called.

infos must be a pointer to a valid MLTypeOperatorFunctions struct.

MLEXPORT void MLTypeSetDoubleComponent ( char  component,
MLdouble  value,
MLTypeData targetPointer 
)

Interprets the data referenced by *targetPointer as data of the type component and sets its value from the passed double value by casting the value to it.

Invalid character codes are ignored and change nothing.

MLEXPORT void MLTypeSetIntComponent ( char  component,
MLCTInt  value,
MLTypeData targetPointer 
)

Like MLTypeSetDoubleComponent, only components are set to integer values.

MLEXPORT void MLTypeShiftComponentsLeft ( const MLTypeInfos infos,
const MLTypeData sourceData,
MLCTInt  shiftLeft,
MLTypeData targetData 
)

Takes one data type component after another and shifts each component left shiftLs times if it is an integer component.

Floating point components are multiplied with 2^shiftLs. Negative values for shiftLs are interpreted as shift right operations or divisions by 2^shiftLs, respectively. Boolean components become false on all shiftLs != 0. Zero shiftLs does not change any component.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_shiftLeft(), and ml::MLTStdTypeInfos< VTYP >::MLTYPE_shiftRight().

MLEXPORT void MLTypeShiftLeftComponent ( char  component,
const MLTypeData sourcePointer,
MLCTInt  shiftLs,
MLTypeData targetPointer 
)

Interprets the data referenced by *targetPointer as data of the type component and shift it left shiftLs times if it is an integer component.

Floating point components are multiplied with 2^shiftLs. Negative values for shiftLs are interpreted as shift right operations or divisions by 2^shiftLs, respectively. Boolean components become false on all shiftLs != 0. Zero shiftLs does not change values. Invalid character codes are ignored and do not change anything, i.e., pointers and values are not changed.

MLEXPORT void MLTypeSubtractOtherType ( const MLTypeInfos myInfos,
const MLTypeData myData,
const MLTypeInfos otherInfos,
const MLTypeData otherData,
MLTypeData targetData 
)

Casts another data element otherData with attributes given by otherInfos to a local buffer of a type given by myInfos.

That buffer is subtracted from myData and written into targetData. For the subtraction myInfos->subtractFromType is used.

Referenced by ml::MLTStdTypeInfos< VTYP >::MLTYPE_minusOtherType().

MLEXPORT void MLTypeToggleEndianType ( const MLTypeInfos infos,
const MLTypeData sourceBufferPointer,
MLTypeData targetBufferPointer,
size_t  numInstances 
)

Converts data type instances from little endian to big endian or vice versa.

Parameters:
infos the TypeInfos data structure describing the data type.
sourceBufferPointer points to the first instance to be converted.
targetBufferPointer points to the memory area where the converted instances shall be stored. Identical srcBufPtr and targetBufPtr will be handled correctly.
numInstances the number of instances to be converted. The call will be ignored if any parameter pointer is NULL or numInstances is 0.


Variable Documentation

A data type has all standard properties of a standard type.

The arcus cosine function can be used on this data type.

The arcsine function can be used on this data type.

The arctangent function can be used on this data type.

Two a data type instances can be binary anded.

A data type instance can be binary anded with integer.

An integer can be anded with a data type instance.

An integer can be ored with a data type instance.

An integer can be xored with a data type instance.

Two a data type instances can be binary ored.

A data type instance can be binary ored with integer.

Two a data type instances can be binary xored.

A data type instance can be binary xored with integer.

A bool can be cast to a data type instance.

A double can be cast to a data type instance.

An integer can be cast to a data type instance.

Any data type instance can be cast a data type instance.

A data type instance can be cast to bool.

A data type instance can be cast to double.

A data type instance can be cast to integer.

A data type instance can be cast to another type.

Copy parameter one to parameter 2. (Note: This function must be implemented.).

The hyperbolic cosine function can be used on this data type.

The cosine function can be used on this data type.

A data type instances can be divided by double.

A data type instances can be divided by integer.

A data type instances can be divided by another one of other type.

A data type instances can be divided by another one.

A double can be divided by a data type instances.

An integer can be divided by a data type instances.

A data type instances can be subtracted from a double.

Double and data type instance can be added.

The exponential function can be used on this data type.

The function getStringValue is implemented. (Note: This function must be implemented.).

A data type instances can be subtracted from an integer.

Integer and data type instance can be added.

The a data type instance can be inverted.

An equality relation between a data type instances and a double can be calculated. (Note: This function must be implemented.).

An equality relation between a double and a data type instances can be calculated. (Note: This function must be implemented.).

An equality relation between an integer and a data type instances can be calculated. (Note: This function must be implemented.).

An equality relation between two type instances can be calculated. (Note: This function must be implemented.).

An equality relation between two type instances can be calculated. (Note: This function must be implemented.).

A greater relation between a data type instances and a double can be calculated.

A greater relation between a double and a data type instances can be calculated.

Definition at line 358 of file mlDataTypes.h.

A greater relation between a data type instances and an int can be calculated.

A greater relation between an int and a data type instances can be calculated.

Definition at line 357 of file mlDataTypes.h.

A greater relation between two type instances can be calculated.

A greater relation between two type instances can be calculated.

An equality relation between a data type instances and an integer can be calculated. (Note: This function must be implemented.).

A smaller relation between a data type instances and a double can be calculated.

A smaller relation between a double and a data type instances can be calculated.

Definition at line 351 of file mlDataTypes.h.

A smaller relation between a data type instances and an int can be calculated.

A smaller relation between an int and a data type instances can be calculated.

Definition at line 350 of file mlDataTypes.h.

A smaller relation between two type instances can be calculated.

A smaller relation between two type instances can be calculated.

The logarithm function can be used on this data type.

A double can be subtracted from a data type instances.

An integer can be subtracted from a data type instances.

A data type instances can be subtracted from another of other type.

A data type instances can be subtracted from another.

A double and a data type instance can be multiplied.

An integer and a data type instance can be multiplied.

Data type instance can be multiplied with double.

Data type instance can be multiplied with integer.

A data type instances can be multiplied with the one of another type.

Two data type instances can be multiplied.

The negative value of a data type instance can be calculated.

The data type has no standard properties.

A data type instance can be normalized.

A data type instance and a double can be added.

A data type instance and an integer can be added.

A data type instances can be added with an instance of another type.

Two data type instances can be added.

The power of a double and a data type instance can be calculated.

The power of an int and a data type instance can be calculated.

The power of a data type instance and a double can be calculated.

The power of a data type instance and an integer can be calculated.

The power of a data type instance and a data type instance of other type can be calculated.

The power of a data type instance and a data type instance can be calculated.

The function setStringValue is implemented. (Note: This function must be implemented.).

The setToDefault function is implemented. (Note: This function must be implemented.).

The setToMaximum function is implemented. (Note: This function must be implemented.).

The setToMinimum function is implemented. (Note: This function must be implemented.).

A data type instances can be shifted left an integer number times.

A data type instances can be shifted right an integer number times.

The hyperbolic sine function can be used on this data type.

The sine function can be used on this data type.

The sqrt function can be used on this data type.

The hyperbolic tangent function can be used on this data type.

The tangent function can be used on this data type.

The data type is standard scalar data type(intUL, floatUL, charUL, ...).

The data type is a floating point type. False otherwise.

The data type is an integer type. False otherwise.

The data type is signed.

A data type has only the minimum operations required by the ML (add, mult, casts).

A data type has all standard properties and is a standard type.


Generated on Sat Sep 3 18:37:43 2011 for MLReference by  doxygen 1.5.8