MeVisLab Toolbox Reference
mlDMTagData.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
5 
10 //----------------------------------------------------------------------------------
11 
12 #pragma once
13 
14 #include "MLDMFileReaderSystem.h"
15 
17 #include <mlDMFileReaderDefs.h>
18 
19 ML_START_NAMESPACE
20 
21 //----------------------------------------------------------------------------------
23 //----------------------------------------------------------------------------------
25  public:
26 
29  MLuint64 originPosition);
30 
32  std::string getFourPercents() const;
33 
36 
38  bool isSimpleType() const;
39 
41  bool isStringType() const;
42 
44  bool isArrayOfSimpleType() const;
45 
48  bool isStructure() const;
49 
51  bool isComplexArray() const;
52 
55 
60 
63 
66 
69 
72 
76 
79 
83 
85  bool isValidStructType(MLuint64 typeVal) const;
86 
88  std::string getDataTypeAsString(DMEncodedStructureType encType) const;
89 
92 
97 
101 
106 
110 
114 
118 
125  std::string calculateStructValueAsString(MLuint64 structDescPos,
126  MLuint64 structDataPos,
127  const std::string &groupPrefix) const;
128 
139  DMEncodedStructureType encType,
140  MLuint64 structInfoPos,
141  const std::string &groupPrefix="",
142  bool getAsChars=false) const;
143 
146  DMEncodedStructureType encType,
147  const std::string &groupPrefix="",
148  bool getAsChars=false) const;
149 
157  std::string getStructureFieldValueAsString(MLuint64 structFieldIndex,
158  const std::string &groupPrefix="",
159  bool getAsChars=false) const;
160 
163  std::string getSimpleTypeValueAsString(const std::string &groupPrefix="") const;
164 
166  double getSimpleTypeValueAsDouble(MLuint64 byteOffset=0) const;
167 
170 
173 
184  std::string getAsString(const std::string &prefix="",
185  const std::string &sep=", ",
186  const std::string &groupPrefix="",
187  const size_t maxNumBinaryEntries=8,
188  const size_t maxNumStringEntries=20) const;
189 
193  void *getValueAsMemoryChunk(MLuint64 &numBytes) ML_RETURN_VALUE_SHOULD_BE_USED;
194 
195  private:
197  DMTagData &operator=(const DMTagData &);
198 
200  DMTagData(const DMTagData &);
201 
203  DMFileReader &_reader;
204 
206  const MLuint64 _originPosition;
207 
209  mutable MLuint64 _numInfoArrayEntries;
210 
212  mutable DMEncodedStructureType _dataType;
213 
215  mutable bool _dataTypeValid;
216 
218  mutable MLuint64 _dataSectionSize;
219 };
220 
222 MLDMFileReader_EXPORT std::ostream& operator<<(std::ostream& os, const DMTagData &obj);
223 
224 ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLDMFileReader_EXPORT
If included by external modules, exported symbols are declared as import symbols.
A tool classes to load Digital Microscopy files.
Representation for the DM file as data structure.
Definition: mlDMTagData.h:24
bool isArrayOfSimpleType() const
Returns true if the encoded type is an array of simple types, otherwise false.
MLuint64 getNumberOfFieldsInStructure() const
If isStructure() is true it returns the number of structure entries, otherwise it returns 0.
DMTagData(DMFileReader &reader, MLuint64 originPosition)
Constructor initialized with its reader and the data structure position in the file.
MLuint64 getStructureFieldDataTypeSizeOf() const
Returns the file format dependent size in bytes of a structure info entry describing a data type of a...
std::string getDataTypeAsString(DMEncodedStructureType encType) const
Returns a human readable string version for the provided encType.
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,...
std::string getFourPercents() const
Reads and returns the four starting percent characters.
bool isSimpleType() const
Returns true if the encoded type is a simple type, otherwise false.
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.
DMEncodedStructureType getDataType() const
If isStructure() is false it returns DM_Undefined, if isStructure() is true then it returns the data ...
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.
MLuint64 getEncodedSimpleTypeByteSize(DMEncodedStructureType encType) const
Returns the byte size of the encoded simple, on arrays, structs or bad types it returns 0.
MLuint64 getTagTypeSizeOf() const
Returns the file format dependent size in bytes of the entry containing the data type of the tag.
MLuint64 getEmptyStructEntrySizeOf() const
Returns the file format dependent size in bytes of the structure info entry perhaps describing the le...
MLuint64 numInfoArrayEntries() const
Reads the length of definition of encoded type.
MLuint64 getDataSectionPosition() const
If isStructure() or isSimpleType is true it returns the position of the start of the value section of...
bool isStringType() const
Returns true if the encoded type is a string, otherwise false.
MLint64 getSimpleTypeValueAsMLint64(MLuint64 byteOffset=0) const
If isSimpleType() is true it returns the value entry as MLint64, otherwise ML_INT64_MAX.
MLuint64 getLengthOfStructureGroupNameSizeOf() const
Returns the file format dependent size in bytes of a structure info entry describing perhaps the leng...
std::string calculateStructValueAsString(MLuint64 structDescPos, MLuint64 structDataPos, const std::string &groupPrefix) const
Converts a structure entry to a string.
bool isStructure() const
Returns true if the encoded type is a structure, otherwise false.
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.
MLuint64 getDataSectionSize() const
If isStructure() is true it returns the byte size of the data section of the structure,...
MLuint64 getPositionAfterEnd() const
If isStructure() or isSimpleType() is returns the file position after the end of the simple type or t...
DMEncodedStructureType getStructureFieldType(MLuint64 structFieldIndex) const
If isStructure() is false it returns DM_Undefined, if isStructure() is true then it returns the n'th ...
double getSimpleTypeValueAsDouble(MLuint64 byteOffset=0) const
If isSimpleType() is true it returns the value entry as double, otherwise ML_DOUBLE_MAX.
MLuint64 getNInfoSizeOf() const
Returns the file format dependent size in bytes of the entry containing the size of the info array.
MLuint64 getStructureValueEntryByteSize(MLuint64 structFieldIndex) const
If isStructure() is true then it returns the byte size value entry structFieldIndex,...
bool isComplexArray() const
Returns true if the encoded type is a complex array, otherwise false.
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 ...
MLuint64 getNumberOfEntriesInGroupSizeOf() const
Returns the file format dependent size in bytes of the structure info entry describing the number of ...
bool isValidStructType(MLuint64 typeVal) const
Returns true if typeVal is a valid type allowed in a structure, otherwise false.
MLuint64 getFourPercentSizeOf() const
Returns the file format dependent size in bytes of the "%%%%" code.
std::string getSimpleTypeValueAsString(const std::string &groupPrefix="") const
If isSimpleType() is true it returns the value entry as string, otherwise an "".
MLuint64 getSimpleTypeValueAsMLuint64(MLuint64 byteOffset=0) const
If isSimpleType() is true it returns the value entry as MLuint64, otherwise ML_UINT64_MAX.
MLuint64 calculateStructureSize(MLuint64 pos) const
Determines the size of a structure in bytes which is described at position pos where the structure ty...
Project wide definitions.
UINT64 MLuint64
Introduce platform independent 64 bit unsigned integer type.
Definition: mlTypeDefs.h:513
INT64 MLint64
Include 64 bit integer support for Windows or Unix.
Definition: mlTypeDefs.h:500
MLDMFileReader_EXPORT std::ostream & operator<<(std::ostream &os, const DMTagData &obj)
Output to std::ostream.
DMEncodedStructureType
Enumerator describing the encoded type; the enumerator value is the same as the stored value in file.