MeVisLab Toolbox Reference
ml::DMTagData Class 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...
 

Detailed Description

Representation for the DM file as data structure.

Definition at line 24 of file mlDMTagData.h.

Constructor & Destructor Documentation

◆ DMTagData()

ml::DMTagData::DMTagData ( DMFileReader reader,
MLuint64  originPosition 
)

Constructor initialized with its reader and the data structure position in the file.

Member Function Documentation

◆ calculateStructureSize()

MLuint64 ml::DMTagData::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.

numStructEntries is the number of entries to be scanned.

◆ calculateStructValueAsString()

std::string ml::DMTagData::calculateStructValueAsString ( MLuint64  structDescPos,
MLuint64  structDataPos,
const std::string &  groupPrefix 
) const

Converts a structure entry to a string.

Parameters
structDescPosThe position of the structure information where the structure type code DM_Struct must be readable as 32 bit word.
structDataPosThe position of the structure data element to decode.
groupPrefixAdded before each line in subgroups.
Returns
The structure value as a string or an empty string on any failure.

◆ getAsString()

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.

◆ getDataSectionPosition()

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.

◆ getDataSectionSize()

MLuint64 ml::DMTagData::getDataSectionSize ( ) const

If isStructure() is true it returns the byte size of the data section of the structure, otherwise 0.

◆ getDataType()

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.


◆ getDataTypeAsString()

std::string ml::DMTagData::getDataTypeAsString ( DMEncodedStructureType  encType) const

Returns a human readable string version for the provided encType.

◆ getEmptyStructEntrySizeOf()

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.

◆ getEncodedMemoryValueAsString() [1/2]

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.

◆ getEncodedMemoryValueAsString() [2/2]

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.

Parameters
dataPosThe position where the binary data is located.
encTypeThe type to be decoded.
structInfoPosmust 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.
groupPrefixAdded before each line in subgroups.
getAsCharsOn numeric values the values are returned as coded characters to make string arrays readable.

◆ getEncodedSimpleTypeByteSize()

MLuint64 ml::DMTagData::getEncodedSimpleTypeByteSize ( DMEncodedStructureType  encType) const

Returns the byte size of the encoded simple, on arrays, structs or bad types it returns 0.

◆ getFourPercents()

std::string ml::DMTagData::getFourPercents ( ) const

Reads and returns the four starting percent characters.

◆ getFourPercentSizeOf()

MLuint64 ml::DMTagData::getFourPercentSizeOf ( ) const

Returns the file format dependent size in bytes of the "%%%%" code.

◆ getLengthOfStructureGroupNameSizeOf()

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.

◆ getNInfoSizeOf()

MLuint64 ml::DMTagData::getNInfoSizeOf ( ) const

Returns the file format dependent size in bytes of the entry containing the size of the info array.

◆ getNumberOfEntriesInGroupSizeOf()

MLuint64 ml::DMTagData::getNumberOfEntriesInGroupSizeOf ( ) const

Returns the file format dependent size in bytes of the structure info entry describing the number of group entries.

◆ getNumberOfFieldsInStructure()

MLuint64 ml::DMTagData::getNumberOfFieldsInStructure ( ) const

If isStructure() is true it returns the number of structure entries, otherwise it returns 0.

◆ getPositionAfterEnd()

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.

◆ getSimpleTypeValueAsDouble()

double ml::DMTagData::getSimpleTypeValueAsDouble ( MLuint64  byteOffset = 0) const

If isSimpleType() is true it returns the value entry as double, otherwise ML_DOUBLE_MAX.

◆ getSimpleTypeValueAsMLint64()

MLint64 ml::DMTagData::getSimpleTypeValueAsMLint64 ( MLuint64  byteOffset = 0) const

If isSimpleType() is true it returns the value entry as MLint64, otherwise ML_INT64_MAX.

◆ getSimpleTypeValueAsMLuint64()

MLuint64 ml::DMTagData::getSimpleTypeValueAsMLuint64 ( MLuint64  byteOffset = 0) const

If isSimpleType() is true it returns the value entry as MLuint64, otherwise ML_UINT64_MAX.

◆ getSimpleTypeValueAsString()

std::string ml::DMTagData::getSimpleTypeValueAsString ( const std::string &  groupPrefix = "") const

If isSimpleType() is true it returns the value entry as string, otherwise an "".

Parameters
groupPrefixAdded before each line in subgroups.

◆ getStructureFieldDataTypeSizeOf()

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.

◆ getStructureFieldType()

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.


◆ getStructureFieldValueAsString()

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

Parameters
structFieldIndexIndex 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.
groupPrefixAdded before each line in subgroups.
getAsCharsOn numeric values the values are returned as coded characters to make string arrays readable.

◆ getStructureValueEntryByteSize()

MLuint64 ml::DMTagData::getStructureValueEntryByteSize ( MLuint64  structFieldIndex) const

If isStructure() is true then it returns the byte size value entry structFieldIndex, otherwise it returns 0.

◆ getTagTypeSizeOf()

MLuint64 ml::DMTagData::getTagTypeSizeOf ( ) const

Returns the file format dependent size in bytes of the entry containing the data type of the tag.

◆ getValueAsMemoryChunk()

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.

Parameters
numBytesreturns the size of the returned chunk in bytes.

◆ isArrayOfSimpleType()

bool ml::DMTagData::isArrayOfSimpleType ( ) const

Returns true if the encoded type is an array of simple types, otherwise false.

◆ isComplexArray()

bool ml::DMTagData::isComplexArray ( ) const

Returns true if the encoded type is a complex array, otherwise false.

◆ isSimpleType()

bool ml::DMTagData::isSimpleType ( ) const

Returns true if the encoded type is a simple type, otherwise false.

◆ isStringType()

bool ml::DMTagData::isStringType ( ) const

Returns true if the encoded type is a string, otherwise false.

◆ isStructure()

bool ml::DMTagData::isStructure ( ) const

Returns true if the encoded type is a structure, otherwise false.

Note that complex arrays also are structures.

◆ isValidStructType()

bool ml::DMTagData::isValidStructType ( MLuint64  typeVal) const

Returns true if typeVal is a valid type allowed in a structure, otherwise false.

◆ numInfoArrayEntries()

MLuint64 ml::DMTagData::numInfoArrayEntries ( ) const

Reads the length of definition of encoded type.


The documentation for this class was generated from the following file: