MeVisLab Toolbox Reference
ml::XMLPersistenceOutputStream Class Reference

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

#include <mlXMLPersistenceStream.h>

Inheritance diagram for ml::XMLPersistenceOutputStream:
ml::AbstractPersistenceOutputStream ml::XMLPersistenceStream ml::AbstractPersistenceStream

Public Member Functions

 XMLPersistenceOutputStream ()
 this constructor creates a new XML document that can be written afterwards with writeToFile or writeToString More...
 
 XMLPersistenceOutputStream (DOMElement *container)
 this constructor takes an existing XML element - everything will be written relative to this element More...
 
virtual ~XMLPersistenceOutputStream ()
 this will free the XML document if the first constructor was used More...
 
virtual void writeToFile (const std::string &fileName)
 Writes the complete tree to a file. More...
 
virtual void writeToString (std::string &str)
 Writes the subtree rooted by this node to a string. More...
 
- Public Member Functions inherited from ml::AbstractPersistenceOutputStream
 ~AbstractPersistenceOutputStream () override=default
 
void startStructWithVersion (int version, const char *name=nullptr)
 Starts a versioned struct. More...
 
template<typename T >
void write (const std::vector< T > &values, const char *name=nullptr)
 Writes vectors of primitive values to the stream. More...
 
template<typename T , size_t n, class DataContainer >
void write (const FloatingPointVector< T, n, DataContainer > &value, const char *name=nullptr)
 Writes float vectors like vec3f to the stream. More...
 
template<typename T , size_t n>
void write (const TVectorNDBase< T, n > &value, const char *name=nullptr)
 Writes integer vectors like ImageVector to the stream. More...
 
template<typename T , size_t n>
void write (const FloatingPointMatrix< T, n > &value, const char *name=nullptr)
 Writes float matrices like mat4 to the stream. More...
 
virtual void writeObject (const Base *const obj, const char *name=nullptr)
 Writes a Base object to the stream. More...
 
virtual bool isValidElementName (const char *name)
 Checks whether name is valid for use with persistence entries. More...
 
virtual void write (bool value, const char *name=nullptr)
 Writes primitive values to the stream. More...
 
void write (MLint32 value, const char *name=nullptr)
 
void write (MLuint32 value, const char *name=nullptr)
 
void write (MLint64 value, const char *name=nullptr)
 
void write (MLuint64 value, const char *name=nullptr)
 
void write (MLfloat value, const char *name=nullptr)
 
void write (MLdouble value, const char *name=nullptr)
 
void write (const std::string &value, const char *name=nullptr)
 
void write (const char *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)
 Starts a new list of values in the data stream, must be ended with endList(). More...
 
void endList ()
 Ends reading/writing of the list. More...
 
void startStruct (const char *name=nullptr)
 Starts a new struct of values in the data stream, must be ended with endStruct(). More...
 
void endStruct ()
 Ends reading/writing of struct values. More...
 
bool isBinary () const override
 overridden methods More...
 
void writeString (const char *name, const std::string &value) override
 Abstract writing method that needs to be implemented by derived classes. More...
 
void writeData (const void *data, size_t len, const char *name) override
 Writes binary data to stream. More...
 
void startListImpl (const char *name, const char *xmlItemName, bool xmlSuppressScope) override
 Abstract methods called by above methods, needs to be implemented in derived classes. More...
 
void endListImpl () override
 
void startStructImpl (const char *name) override
 
void endStructImpl () override
 
void setObjectID (int id) override
 Implementation of Base object persistence, sets attribute on currently open struct Implementation hint: these can be stored unnamed if they are read or not is always deduced from the current state of the persistence stream. More...
 
void setObjectType (const char *type) override
 Sets base type. More...
 
void setObjectVersion (int version) override
 Sets persistence version. More...
 
void writeValues (const char *name, const MLint32 *values, size_t n, bool fixedList) override
 Abstract writing methods that need to be implemented by derived classes. More...
 
void writeValues (const char *name, const MLuint32 *values, size_t n, bool fixedList) override
 
void writeValues (const char *name, const MLint64 *values, size_t n, bool fixedList) override
 
void writeValues (const char *name, const MLuint64 *values, size_t n, bool fixedList) override
 
void writeValues (const char *name, const MLfloat *values, size_t n, bool fixedList) override
 
void writeValues (const char *name, const MLdouble *values, size_t n, bool fixedList) override
 

Additional Inherited Members

- Protected Member Functions inherited from ml::AbstractPersistenceOutputStream
 AbstractPersistenceOutputStream ()
 
void nameCheck (const char *name) override
 Overridden to perform an additional check in Debug mode if name is suitable for the persistence format (uses isValidElementName), prints an error if not. More...
 
- Protected Member Functions inherited from ml::AbstractPersistenceStream
 AbstractPersistenceStream ()
 
virtual ~AbstractPersistenceStream ()
 
bool isInList () const
 Checks whether the stream is currently in 'list' mode. Otherwise, it is in 'struct' mode. More...
 
size_t nestingDepth () const
 Returns depth of nesting stack (created by startList/startStruct), used to check nesting rules. More...
 
virtual void internalError (const char *msg, const char *arg=nullptr)
 Logs an internal error. Usually called to indicate wrong usage of interface. More...
 

Detailed Description

Implementation for AbstractPersistenceOutputStream using Xerces DOM Parser.

Definition at line 61 of file mlXMLPersistenceStream.h.

Constructor & Destructor Documentation

◆ XMLPersistenceOutputStream() [1/2]

ml::XMLPersistenceOutputStream::XMLPersistenceOutputStream ( )

this constructor creates a new XML document that can be written afterwards with writeToFile or writeToString

◆ XMLPersistenceOutputStream() [2/2]

ml::XMLPersistenceOutputStream::XMLPersistenceOutputStream ( DOMElement *  container)

this constructor takes an existing XML element - everything will be written relative to this element

◆ ~XMLPersistenceOutputStream()

virtual ml::XMLPersistenceOutputStream::~XMLPersistenceOutputStream ( )
virtual

this will free the XML document if the first constructor was used

Member Function Documentation

◆ endListImpl()

void ml::XMLPersistenceOutputStream::endListImpl ( )
overrideprotectedvirtual

◆ endStructImpl()

void ml::XMLPersistenceOutputStream::endStructImpl ( )
overrideprotectedvirtual

◆ isBinary()

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

overridden methods

Implements ml::AbstractPersistenceStream.

Definition at line 83 of file mlXMLPersistenceStream.h.

◆ setObjectID()

void ml::XMLPersistenceOutputStream::setObjectID ( int  id)
overrideprotectedvirtual

Implementation of Base object persistence, sets attribute on currently open struct Implementation hint: these can be stored unnamed if they are read or not is always deduced from the current state of the persistence stream.

Unique ID for each pointer value - currently unused.

Implements ml::AbstractPersistenceOutputStream.

◆ setObjectType()

void ml::XMLPersistenceOutputStream::setObjectType ( const char *  type)
overrideprotectedvirtual

Sets base type.

Implements ml::AbstractPersistenceOutputStream.

◆ setObjectVersion()

void ml::XMLPersistenceOutputStream::setObjectVersion ( int  version)
overrideprotectedvirtual

Sets persistence version.

Implements ml::AbstractPersistenceOutputStream.

◆ startListImpl()

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

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

Implementors do not need to perform error checking.

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

Implements ml::AbstractPersistenceStream.

◆ startStructImpl()

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

◆ writeData()

void ml::XMLPersistenceOutputStream::writeData ( const void *  data,
size_t  len,
const char *  name 
)
overridevirtual

Writes binary data to stream.

Implements ml::AbstractPersistenceOutputStream.

◆ writeString()

void ml::XMLPersistenceOutputStream::writeString ( const char *  name,
const std::string &  value 
)
overridevirtual

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

Implements ml::AbstractPersistenceOutputStream.

◆ writeToFile()

virtual void ml::XMLPersistenceOutputStream::writeToFile ( const std::string &  fileName)
virtual

Writes the complete tree to a file.

◆ writeToString()

virtual void ml::XMLPersistenceOutputStream::writeToString ( std::string &  str)
virtual

Writes the subtree rooted by this node to a string.

◆ writeValues() [1/6]

void ml::XMLPersistenceOutputStream::writeValues ( const char *  name,
const MLdouble values,
size_t  n,
bool  fixedList 
)
overrideprotectedvirtual

◆ writeValues() [2/6]

void ml::XMLPersistenceOutputStream::writeValues ( const char *  name,
const MLfloat values,
size_t  n,
bool  fixedList 
)
overrideprotectedvirtual

◆ writeValues() [3/6]

void ml::XMLPersistenceOutputStream::writeValues ( const char *  name,
const MLint32 values,
size_t  n,
bool  fixedList 
)
overrideprotectedvirtual

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

fixedList tells the stream if the number of elements to write is fixed and known when reading, or if it needs to be stored in the stream.

Implements ml::AbstractPersistenceOutputStream.

◆ writeValues() [4/6]

void ml::XMLPersistenceOutputStream::writeValues ( const char *  name,
const MLint64 values,
size_t  n,
bool  fixedList 
)
overrideprotectedvirtual

◆ writeValues() [5/6]

void ml::XMLPersistenceOutputStream::writeValues ( const char *  name,
const MLuint32 values,
size_t  n,
bool  fixedList 
)
overrideprotectedvirtual

◆ writeValues() [6/6]

void ml::XMLPersistenceOutputStream::writeValues ( const char *  name,
const MLuint64 values,
size_t  n,
bool  fixedList 
)
overrideprotectedvirtual

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