MeVisLab Toolbox Reference
ml::XMLPersistenceInputStream Class Reference

Implementation for AbstractPersistenceInputStream using Xerces DOM Parser. More...

#include <mlXMLPersistenceStream.h>

Inheritance diagram for ml::XMLPersistenceInputStream:
ml::AbstractPersistenceInputStream ml::XMLPersistenceStream ml::AbstractPersistenceStream

Public Member Functions

 XMLPersistenceInputStream ()
 this is the default constructor, use readFromFile or readFromString to fill the DOM More...
 
 XMLPersistenceInputStream (DOMElement *container)
 this constructor will read from the given XML element More...
 
virtual ~XMLPersistenceInputStream ()
 the destructor will free the DOM document if readFromFile or readFromString was used More...
 
virtual void readFromFile (const std::string &fileName)
 Read the complete tree from a file. More...
 
virtual void readFromString (const std::string &str)
 Read the complete tree from a string. More...
 
- Public Member Functions inherited from ml::AbstractPersistenceInputStream
virtual ~AbstractPersistenceInputStream ()
 
int startStructWithVersion (const char *name=nullptr)
 start a struct, returns version of struct (0 if not given) More...
 
template<typename T >
void read (std::vector< T > &values, const char *name=nullptr)
 Read vectors of primitive values from the stream. More...
 
template<typename T , size_t n, class DataContainer >
void read (FloatingPointVector< T, n, DataContainer > &value, const char *name=nullptr)
 Read float vectors like vec3f from the stream. More...
 
template<typename T , size_t n>
void read (TVectorNDBase< T, n > &value, const char *name=nullptr)
 Read integer vectors like ImageVector from the stream. More...
 
template<typename T , size_t n>
void read (FloatingPointMatrix< T, n > &value, const char *name=nullptr)
 Read float matrices like mat4 from the stream. More...
 
template<typename T >
void readOptional (T &value, const T &defaultValue, const char *name=nullptr)
 Perform optional reading for all above methods. More...
 
virtual BasereadObject (const char *name=nullptr)
 Read Base object from stream. More...
 
bool hasNextInStruct (std::string &name)
 Returns true if there is another element in the current struct scope, and if so then sets name to its name. More...
 
bool isNextInStruct (const char *name)
 Check if an item with the given name comes next in the stream. More...
 
bool hasNextListItem ()
 Check if there is another item in the current list. More...
 
void versionCheck (const char *className, int objectVersion, int storedVersion)
 print a warning if the storedVersion is greater than the objectVersion More...
 
virtual void read (bool &value, const char *name=nullptr)
 Read primitive values from the stream. More...
 
void read (MLint32 &value, const char *name=nullptr)
 
void read (MLuint32 &value, const char *name=nullptr)
 
void read (MLint64 &value, const char *name=nullptr)
 
void read (MLuint64 &value, const char *name=nullptr)
 
void read (MLfloat &value, const char *name=nullptr)
 
void read (MLdouble &value, const char *name=nullptr)
 
void read (std::string &value, const char *name=nullptr)
 
- Public Member Functions inherited from ml::AbstractPersistenceStream
void startList (const char *name=nullptr, const char *xmlItemName="Item", bool xmlSuppressScope=false)
 Start a new list of values in the data stream, must be ended with endList(). More...
 
void endList ()
 End reading/writing of the list. More...
 
void startStruct (const char *name=nullptr)
 Start a new struct of values in the data stream, must be ended with endStruct(). More...
 
void endStruct ()
 End reading/writing of struct values. More...
 

Static Public Member Functions

static void normalizeWindowsFileName (std::string &str)
 replace / with \ character More...
 
bool isBinary () const override
 overridden methods More...
 
void readString (const char *name, std::string &value) override
 Abstract reading method that needs to be implemented by derived classes. More...
 
void readData (std::string &value, const char *name) override
 Same as above for binary data (std::string misused as binary data container) More...
 
void startListImpl (const char *name, const char *xmlItemName, bool xmlSuppressScope) override
 Abstract methods called by above methods, need to be implemented in derived classes. More...
 
void endListImpl () override
 
void startStructImpl (const char *name) override
 
void endStructImpl () override
 
bool hasNextInStructImpl (std::string &name) override
 Check if an item with the given name comes next in the stream. More...
 
bool hasNextListItemImpl () override
 Check if there is another item in the current list. More...
 
bool getObjectID (int &id) override
 Implementation of Base object persistence, get attribute of currently open structget unique id of object - currently unused. More...
 
bool getObjectType (std::string &type) override
 base type name More...
 
bool getObjectVersion (int &version) override
 persistence version More...
 
void readValues (const char *name, size_t expected, std::vector< MLint32 > &values) override
 Abstract reading methods that need to be implemented by derived classes. More...
 
void readValues (const char *name, size_t expected, std::vector< MLuint32 > &values) override
 
void readValues (const char *name, size_t expected, std::vector< MLint64 > &values) override
 
void readValues (const char *name, size_t expected, std::vector< MLuint64 > &values) override
 
void readValues (const char *name, size_t expected, std::vector< MLfloat > &values) override
 
void readValues (const char *name, size_t expected, std::vector< MLdouble > &values) override
 
void formatError (const std::string &msg) override
 overload, improves message with current parsing location More...
 

Additional Inherited Members

- Protected Member Functions inherited from ml::AbstractPersistenceInputStream
 AbstractPersistenceInputStream ()
 
- Protected Member Functions inherited from ml::AbstractPersistenceStream
 AbstractPersistenceStream ()
 
virtual ~AbstractPersistenceStream ()
 
virtual void nameCheck (const char *name)
 Check if the name is provided when being in a sub-group, or that no name is provided when being in a list. More...
 
bool isInList () const
 Check if the stream is currently in "list" mode. Otherwise it is in "struct" mode. More...
 
size_t nestingDepth () const
 return depth of nesting stack (created by startList/startStruct), used to check nesting rules More...
 
virtual void internalError (const char *msg, const char *arg=nullptr)
 Log an internal error. Usually called to indicate wrong usage of interface. More...
 

Detailed Description

Implementation for AbstractPersistenceInputStream using Xerces DOM Parser.

Definition at line 132 of file mlXMLPersistenceStream.h.

Constructor & Destructor Documentation

◆ XMLPersistenceInputStream() [1/2]

ml::XMLPersistenceInputStream::XMLPersistenceInputStream ( )

this is the default constructor, use readFromFile or readFromString to fill the DOM

◆ XMLPersistenceInputStream() [2/2]

ml::XMLPersistenceInputStream::XMLPersistenceInputStream ( DOMElement *  container)

this constructor will read from the given XML element

◆ ~XMLPersistenceInputStream()

virtual ml::XMLPersistenceInputStream::~XMLPersistenceInputStream ( )
virtual

the destructor will free the DOM document if readFromFile or readFromString was used

Member Function Documentation

◆ endListImpl()

void ml::XMLPersistenceInputStream::endListImpl ( )
overrideprotectedvirtual

◆ endStructImpl()

void ml::XMLPersistenceInputStream::endStructImpl ( )
overrideprotectedvirtual

◆ formatError()

void ml::XMLPersistenceInputStream::formatError ( const std::string &  msg)
overrideprotectedvirtual

overload, improves message with current parsing location

Reimplemented from ml::AbstractPersistenceInputStream.

◆ getObjectID()

bool ml::XMLPersistenceInputStream::getObjectID ( int &  id)
overrideprotectedvirtual

Implementation of Base object persistence, get attribute of currently open structget unique id of object - currently unused.

Implements ml::AbstractPersistenceInputStream.

◆ getObjectType()

bool ml::XMLPersistenceInputStream::getObjectType ( std::string &  type)
overrideprotectedvirtual

base type name

Implements ml::AbstractPersistenceInputStream.

◆ getObjectVersion()

bool ml::XMLPersistenceInputStream::getObjectVersion ( int &  version)
overrideprotectedvirtual

persistence version

Implements ml::AbstractPersistenceInputStream.

◆ hasNextInStructImpl()

bool ml::XMLPersistenceInputStream::hasNextInStructImpl ( std::string &  name)
overrideprotectedvirtual

Check if an item with the given name comes next in the stream.

The stream is guaranteed to be in a "struct" scope.

Implements ml::AbstractPersistenceInputStream.

◆ hasNextListItemImpl()

bool ml::XMLPersistenceInputStream::hasNextListItemImpl ( )
overrideprotectedvirtual

Check if there is another item in the current list.

The stream is guaranteed to be in a "list" scope.

Implements ml::AbstractPersistenceInputStream.

◆ isBinary()

bool ml::XMLPersistenceInputStream::isBinary ( ) const
inlineoverridevirtual

overridden methods

Implements ml::AbstractPersistenceStream.

Definition at line 155 of file mlXMLPersistenceStream.h.

◆ normalizeWindowsFileName()

static void ml::XMLPersistenceInputStream::normalizeWindowsFileName ( std::string &  str)
static

replace / with \ character

◆ readData()

void ml::XMLPersistenceInputStream::readData ( std::string &  value,
const char *  name 
)
overridevirtual

Same as above for binary data (std::string misused as binary data container)

Implements ml::AbstractPersistenceInputStream.

◆ readFromFile()

virtual void ml::XMLPersistenceInputStream::readFromFile ( const std::string &  fileName)
virtual

Read the complete tree from a file.

◆ readFromString()

virtual void ml::XMLPersistenceInputStream::readFromString ( const std::string &  str)
virtual

Read the complete tree from a string.

◆ readString()

void ml::XMLPersistenceInputStream::readString ( const char *  name,
std::string &  value 
)
overridevirtual

Abstract reading method that needs to be implemented by derived classes.

Implements ml::AbstractPersistenceInputStream.

◆ readValues() [1/6]

void ml::XMLPersistenceInputStream::readValues ( const char *  name,
size_t  expected,
std::vector< MLdouble > &  values 
)
overrideprotectedvirtual

◆ readValues() [2/6]

void ml::XMLPersistenceInputStream::readValues ( const char *  name,
size_t  expected,
std::vector< MLfloat > &  values 
)
overrideprotectedvirtual

◆ readValues() [3/6]

void ml::XMLPersistenceInputStream::readValues ( const char *  name,
size_t  expected,
std::vector< MLint32 > &  values 
)
overrideprotectedvirtual

Abstract reading methods that need to be implemented by derived classes.

If expected size is 0, the returned list may have any size, otherwise exactly that number of elements are returned (or an exception is thrown).

Implements ml::AbstractPersistenceInputStream.

◆ readValues() [4/6]

void ml::XMLPersistenceInputStream::readValues ( const char *  name,
size_t  expected,
std::vector< MLint64 > &  values 
)
overrideprotectedvirtual

◆ readValues() [5/6]

void ml::XMLPersistenceInputStream::readValues ( const char *  name,
size_t  expected,
std::vector< MLuint32 > &  values 
)
overrideprotectedvirtual

◆ readValues() [6/6]

void ml::XMLPersistenceInputStream::readValues ( const char *  name,
size_t  expected,
std::vector< MLuint64 > &  values 
)
overrideprotectedvirtual

◆ startListImpl()

void ml::XMLPersistenceInputStream::startListImpl ( const char *  name,
const char *  xmlItemName,
bool  xmlSuppressScope 
)
overrideprotectedvirtual

Abstract methods called by above methods, need to be implemented in derived classes.

Implementors don't need to do error checking.

xmlItemName and xmlSuppressScope only need to be regarded for XML format:

Implements ml::AbstractPersistenceStream.

◆ startStructImpl()

void ml::XMLPersistenceInputStream::startStructImpl ( const char *  name)
overrideprotectedvirtual

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