MeVisLab Toolbox Reference
|
Representation for the DM file as data structure. More...
#include <mlDMTagData.h>
Public Member Functions | |
DMTagData (DMFileReader &reader, MLuint64 originPosition) | |
Constructor initialized with its reader and the data structure position in the file. More... | |
std::string | getFourPercents () const |
Reads and returns the four starting percent characters. More... | |
MLuint64 | numInfoArrayEntries () const |
Reads the length of definition of encoded type. More... | |
bool | isSimpleType () const |
Returns true if the encoded type is a simple type, otherwise false. More... | |
bool | isStringType () const |
Returns true if the encoded type is a string, otherwise false. More... | |
bool | isArrayOfSimpleType () const |
Returns true if the encoded type is an array of simple types, otherwise false. More... | |
bool | isStructure () const |
Returns true if the encoded type is a structure, otherwise false. More... | |
bool | isComplexArray () const |
Returns true if the encoded type is a complex array, otherwise false. More... | |
MLuint64 | getNumberOfFieldsInStructure () const |
If isStructure() is true it returns the number of structure entries, otherwise it returns 0. More... | |
DMEncodedStructureType | getDataType () const |
If isStructure() is false it returns DM_Undefined, if isStructure() is true then it returns the data type of the tag, or DM_InvalidType if an incorrect value was found. More... | |
MLuint64 | getFourPercentSizeOf () const |
Returns the file format dependent size in bytes of the "%%%%" code. More... | |
MLuint64 | getNInfoSizeOf () const |
Returns the file format dependent size in bytes of the entry containing the size of the info array. More... | |
MLuint64 | getTagTypeSizeOf () const |
Returns the file format dependent size in bytes of the entry containing the data type of the tag. More... | |
MLuint64 | getStructureFieldDataTypeSizeOf () const |
Returns the file format dependent size in bytes of a structure info entry describing a data type of an entry. More... | |
MLuint64 | getLengthOfStructureGroupNameSizeOf () const |
Returns the file format dependent size in bytes of a structure info entry describing perhaps the length of group name of an entry, but which is normally empty. More... | |
MLuint64 | getNumberOfEntriesInGroupSizeOf () const |
Returns the file format dependent size in bytes of the structure info entry describing the number of group entries. More... | |
MLuint64 | getEmptyStructEntrySizeOf () const |
Returns the file format dependent size in bytes of the structure info entry perhaps describing the length of an group entry name which, however, is usually zero. More... | |
bool | isValidStructType (MLuint64 typeVal) const |
Returns true if typeVal is a valid type allowed in a structure, otherwise false. More... | |
std::string | getDataTypeAsString (DMEncodedStructureType encType) const |
Returns a human readable string version for the provided encType. More... | |
MLuint64 | getEncodedSimpleTypeByteSize (DMEncodedStructureType encType) const |
Returns the byte size of the encoded simple, on arrays, structs or bad types it returns 0. More... | |
DMEncodedStructureType | getStructureFieldType (MLuint64 structFieldIndex) const |
If isStructure() is false it returns DM_Undefined, if isStructure() is true then it returns the n'th entry of structure types, or DM_InvalidType if an incorrect value was found. More... | |
MLuint64 | getDataSectionPosition () const |
If isStructure() or isSimpleType is true it returns the position of the start of the value section of the structure, otherwise it returns 0. More... | |
MLuint64 | calculateStructureSize (MLuint64 pos) const |
Determines the size of a structure in bytes which is described at position pos where the structure type code DM_Struct must be readable as 32 bit word. More... | |
MLuint64 | getDataSectionSize () const |
If isStructure() is true it returns the byte size of the data section of the structure, otherwise 0. More... | |
MLuint64 | getPositionAfterEnd () const |
If isStructure() or isSimpleType() is returns the file position after the end of the simple type or the structure, otherwise 0. More... | |
MLuint64 | getStructureValueEntryByteSize (MLuint64 structFieldIndex) const |
If isStructure() is true then it returns the byte size value entry structFieldIndex, otherwise it returns 0. More... | |
std::string | calculateStructValueAsString (MLuint64 structDescPos, MLuint64 structDataPos, const std::string &groupPrefix) const |
Converts a structure entry to a string. More... | |
std::string | getEncodedMemoryValueAsString (MLuint64 dataPos, DMEncodedStructureType encType, MLuint64 structInfoPos, const std::string &groupPrefix="", bool getAsChars=false) const |
Return the value of type encType as string or "" on any error. More... | |
std::string | getEncodedMemoryValueAsString (MLuint64 dataPos, DMEncodedStructureType encType, const std::string &groupPrefix="", bool getAsChars=false) const |
Same as above, but for structures the strcutInfoPos is determined automatically. More... | |
std::string | getStructureFieldValueAsString (MLuint64 structFieldIndex, const std::string &groupPrefix="", bool getAsChars=false) const |
If isStructure() is true it returns the n'th value entry of structure types as string, otherwise an "". More... | |
std::string | getSimpleTypeValueAsString (const std::string &groupPrefix="") const |
If isSimpleType() is true it returns the value entry as string, otherwise an "". More... | |
double | getSimpleTypeValueAsDouble (MLuint64 byteOffset=0) const |
If isSimpleType() is true it returns the value entry as double, otherwise ML_DOUBLE_MAX. More... | |
MLuint64 | getSimpleTypeValueAsMLuint64 (MLuint64 byteOffset=0) const |
If isSimpleType() is true it returns the value entry as MLuint64, otherwise ML_UINT64_MAX. More... | |
MLint64 | getSimpleTypeValueAsMLint64 (MLuint64 byteOffset=0) const |
If isSimpleType() is true it returns the value entry as MLint64, otherwise ML_INT64_MAX. More... | |
std::string | getAsString (const std::string &prefix="", const std::string &sep=", ", const std::string &groupPrefix="", const size_t maxNumBinaryEntries=8, const size_t maxNumStringEntries=20) const |
Convert content to a human readable string with the prefix prefix before all lines and separator sep between all structure components. More... | |
void * | getValueAsMemoryChunk (MLuint64 &numBytes) ML_RETURN_VALUE_SHOULD_BE_USED |
Returns the value section of the tag as memory chunk; the return value must be freed with MLFree. More... | |
Representation for the DM file as data structure.
Definition at line 24 of file mlDMTagData.h.
ml::DMTagData::DMTagData | ( | DMFileReader & | reader, |
MLuint64 | originPosition | ||
) |
Constructor initialized with its reader and the data structure position in the file.
Determines the size of a structure in bytes which is described at position pos where the structure type code DM_Struct must be readable as 32 bit word.
numStructEntries is the number of entries to be scanned.
std::string ml::DMTagData::calculateStructValueAsString | ( | MLuint64 | structDescPos, |
MLuint64 | structDataPos, | ||
const std::string & | groupPrefix | ||
) | const |
Converts a structure entry to a string.
structDescPos | The position of the structure information where the structure type code DM_Struct must be readable as 32 bit word. |
structDataPos | The position of the structure data element to decode. |
groupPrefix | Added before each line in subgroups. |
std::string ml::DMTagData::getAsString | ( | const std::string & | prefix = "" , |
const std::string & | sep = ", " , |
||
const std::string & | groupPrefix = "" , |
||
const size_t | maxNumBinaryEntries = 8 , |
||
const size_t | maxNumStringEntries = 20 |
||
) | const |
Convert content to a human readable string with the prefix prefix before all lines and separator sep between all structure components.
groupPrefix is the prefix added to each subgroups to be dumped as string. If a binary tag is displayed then the number of shown values is controlled with maxNumBinaryEntries; if there are more then "..." is displayed instead. If a binary tag of type Uint16 which might be a unicoded string then the number of shown values is controlled with maxNumStringEntries; if there are more then "..." is displayed instead.
MLuint64 ml::DMTagData::getDataSectionPosition | ( | ) | const |
If isStructure() or isSimpleType is true it returns the position of the start of the value section of the structure, otherwise it returns 0.
MLuint64 ml::DMTagData::getDataSectionSize | ( | ) | const |
If isStructure() is true it returns the byte size of the data section of the structure, otherwise 0.
DMEncodedStructureType ml::DMTagData::getDataType | ( | ) | const |
If isStructure() is false it returns DM_Undefined, if isStructure() is true then it returns the data type of the tag, or DM_InvalidType if an incorrect value was found.
std::string ml::DMTagData::getDataTypeAsString | ( | DMEncodedStructureType | encType | ) | const |
Returns a human readable string version for the provided encType.
MLuint64 ml::DMTagData::getEmptyStructEntrySizeOf | ( | ) | const |
Returns the file format dependent size in bytes of the structure info entry perhaps describing the length of an group entry name which, however, is usually zero.
std::string ml::DMTagData::getEncodedMemoryValueAsString | ( | MLuint64 | dataPos, |
DMEncodedStructureType | encType, | ||
const std::string & | groupPrefix = "" , |
||
bool | getAsChars = false |
||
) | const |
Same as above, but for structures the strcutInfoPos is determined automatically.
std::string ml::DMTagData::getEncodedMemoryValueAsString | ( | MLuint64 | dataPos, |
DMEncodedStructureType | encType, | ||
MLuint64 | structInfoPos, | ||
const std::string & | groupPrefix = "" , |
||
bool | getAsChars = false |
||
) | const |
Return the value of type encType as string or "" on any error.
dataPos | The position where the binary data is located. |
encType | The type to be decoded. |
structInfoPos | must point to the structure information position (where a 0x0f 32 bit word is found) if a structure shall be decoded, otherwise it will be ignored. |
groupPrefix | Added before each line in subgroups. |
getAsChars | On numeric values the values are returned as coded characters to make string arrays readable. |
MLuint64 ml::DMTagData::getEncodedSimpleTypeByteSize | ( | DMEncodedStructureType | encType | ) | const |
Returns the byte size of the encoded simple, on arrays, structs or bad types it returns 0.
std::string ml::DMTagData::getFourPercents | ( | ) | const |
Reads and returns the four starting percent characters.
MLuint64 ml::DMTagData::getFourPercentSizeOf | ( | ) | const |
Returns the file format dependent size in bytes of the "%%%%" code.
MLuint64 ml::DMTagData::getLengthOfStructureGroupNameSizeOf | ( | ) | const |
Returns the file format dependent size in bytes of a structure info entry describing perhaps the length of group name of an entry, but which is normally empty.
MLuint64 ml::DMTagData::getNInfoSizeOf | ( | ) | const |
Returns the file format dependent size in bytes of the entry containing the size of the info array.
MLuint64 ml::DMTagData::getNumberOfEntriesInGroupSizeOf | ( | ) | const |
Returns the file format dependent size in bytes of the structure info entry describing the number of group entries.
MLuint64 ml::DMTagData::getNumberOfFieldsInStructure | ( | ) | const |
If isStructure() is true it returns the number of structure entries, otherwise it returns 0.
MLuint64 ml::DMTagData::getPositionAfterEnd | ( | ) | const |
If isStructure() or isSimpleType() is returns the file position after the end of the simple type or the structure, otherwise 0.
double ml::DMTagData::getSimpleTypeValueAsDouble | ( | MLuint64 | byteOffset = 0 | ) | const |
If isSimpleType() is true it returns the value entry as double, otherwise ML_DOUBLE_MAX.
If isSimpleType() is true it returns the value entry as MLint64, otherwise ML_INT64_MAX.
If isSimpleType() is true it returns the value entry as MLuint64, otherwise ML_UINT64_MAX.
std::string ml::DMTagData::getSimpleTypeValueAsString | ( | const std::string & | groupPrefix = "" | ) | const |
If isSimpleType() is true it returns the value entry as string, otherwise an "".
groupPrefix | Added before each line in subgroups. |
MLuint64 ml::DMTagData::getStructureFieldDataTypeSizeOf | ( | ) | const |
Returns the file format dependent size in bytes of a structure info entry describing a data type of an entry.
DMEncodedStructureType ml::DMTagData::getStructureFieldType | ( | MLuint64 | structFieldIndex | ) | const |
If isStructure() is false it returns DM_Undefined, if isStructure() is true then it returns the n'th entry of structure types, or DM_InvalidType if an incorrect value was found.
std::string ml::DMTagData::getStructureFieldValueAsString | ( | MLuint64 | structFieldIndex, |
const std::string & | groupPrefix = "" , |
||
bool | getAsChars = false |
||
) | const |
If isStructure() is true it returns the n'th value entry of structure types as string, otherwise an "".
structFieldIndex | Index to the n'th field to be read from the structure; must be smaller than the number of fields in the structure, otherwise an empty string is returned. |
groupPrefix | Added before each line in subgroups. |
getAsChars | On numeric values the values are returned as coded characters to make string arrays readable. |
If isStructure() is true then it returns the byte size value entry structFieldIndex, otherwise it returns 0.
MLuint64 ml::DMTagData::getTagTypeSizeOf | ( | ) | const |
Returns the file format dependent size in bytes of the entry containing the data type of the tag.
void* ml::DMTagData::getValueAsMemoryChunk | ( | MLuint64 & | numBytes | ) |
Returns the value section of the tag as memory chunk; the return value must be freed with MLFree.
In case of failure nullptr is returned.
numBytes | returns the size of the returned chunk in bytes. |
bool ml::DMTagData::isArrayOfSimpleType | ( | ) | const |
Returns true if the encoded type is an array of simple types, otherwise false.
bool ml::DMTagData::isComplexArray | ( | ) | const |
Returns true if the encoded type is a complex array, otherwise false.
bool ml::DMTagData::isSimpleType | ( | ) | const |
Returns true if the encoded type is a simple type, otherwise false.
bool ml::DMTagData::isStringType | ( | ) | const |
Returns true if the encoded type is a string, otherwise false.
bool ml::DMTagData::isStructure | ( | ) | const |
Returns true if the encoded type is a structure, otherwise false.
Note that complex arrays also are structures.
bool ml::DMTagData::isValidStructType | ( | MLuint64 | typeVal | ) | const |
Returns true if typeVal is a valid type allowed in a structure, otherwise false.
MLuint64 ml::DMTagData::numInfoArrayEntries | ( | ) | const |
Reads the length of definition of encoded type.