130 const std::string &sep=
", ",
131 const size_t maxNumBinaryEntries=8,
132 const size_t maxNumStringEntries=20)
const;
157 mutable std::string _errorStateString;
160 std::string _fileName;
169 bool _needsByteSwapping;
MLuint32 get32BitUWord(MLuint64 pos) const
Read an unsigned 32 bit word from position pos.
void _setNeedsByteSwapping(bool needsSwapping)
bool needsByteSwapping() const
MLuint64 get64BitUWord(MLuint64 pos) const
Read an unsigned 64 bit word from position pos.
virtual std::string getErrorState() const
Returns the current state string which is non empty on any error, empty otherwise.
MLint getFileSizeFromCurrentDescriptor()
Returns MLFileGetSizeFromDescriptor(_getFileDescriptor()).
const MLuint8 * getPrefetchDataChunk(MLuint64 pos, MLuint64 numBytes) const
void _appendErrNoToState(const std::string &errDesc) const
MLuint16 get16BitUWord(MLuint64 pos) const
Read an unsigned 16 bit word from position pos.
virtual const MLuint8 * getPrefetchData() const
Returns pointer to prefetch data (or nullptr if not available).
void appendStringToState(const std::string &errDesc) const
Appends the given string to error state string (which also sets bad read state).
std::string getNonTerminatedDataAsString(MLuint originPosition, MLuint numChars) const
virtual void clearErrorState()
Resets the error state to success, i.e. to an empty string.
MLuint16 get16BitUWordInLocalEndianess(MLuint64 pos) const
Read an unsigned 16 bit word from position pos and convert it in local endianness.
virtual void clearPrefetchData()
If any data is in the prefetch data memory then it is freed.
MLuint8 * getDataChunk(MLuint64 pos, MLuint64 numBytes) const
MLuint8 get8BitUWord(MLuint64 pos) const
Read an unsigned 8 bit word from position pos.
virtual bool isGood() const
Returns true if the recent operations since the last clearState() call were successful.
ByteDataReader()
Default constructor which gets its settings later.
ByteDataReader(const std::string &fileName)
Constructor already setting the file name.
virtual void setIndent(const std::string &indent)
Sets the default indentation string for tag dumps.
virtual bool isOpen() const
Returns true if the file is open, otherwise false.
virtual ~ByteDataReader()
virtual std::string getAsString(const std::string &prefix="", const std::string &sep=", ", const size_t maxNumBinaryEntries=8, const size_t maxNumStringEntries=20) const
MLuint32 get32BitUWordInLocalEndianess(MLuint64 pos) const
Read an unsigned 32 bit word from position pos and convert it in local endianness.
virtual const std::string & getIndent() const
The default indentation string for tag dumps.
virtual void close()
Closes the file if it was open, otherwise the call is ignored.
virtual std::string getFileName() const
Returns the currently used file name or "" on default case.
virtual void setFileName(const std::string &fileName)
Sets the new file name.
MLuint64 get64BitUWordInLocalEndianess(MLuint64 pos) const
Read an unsigned 64 bit word from position pos and convert it in local endianness.
int _getFileDescriptor() const
Returns the current file descriptor.
#define ML_ROOT_CLASS_HEADER(className)
UINT64 MLuint64
Introduce platform-independent 64-bit unsigned integer type.
std::ostream & operator<<(std::ostream &out, const ml::Variant &variant)