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
 
 XMLPersistenceOutputStream (DOMElement *container)
 this constructor takes an existing XML element - everything will be written relative to this element
 
virtual ~XMLPersistenceOutputStream ()
 this will free the XML document if the first constructor was used
 
virtual void writeToFile (const std::string &fileName)
 Writes the complete tree to a file.
 
virtual void writeToString (std::string &str)
 Writes the subtree rooted by this node to a string.
 
- Public Member Functions inherited from ml::AbstractPersistenceOutputStream
 ~AbstractPersistenceOutputStream () override=default
 
void startStructWithVersion (int version, const char *name=nullptr)
 start a versioned struct
 
template<typename T >
void write (const std::vector< T > &values, const char *name=nullptr)
 Write vectors of primitive values to the stream.
 
template<typename T , size_t n, class DataContainer >
void write (const FloatingPointVector< T, n, DataContainer > &value, const char *name=nullptr)
 Write float vectors like vec3f to the stream.
 
template<typename T , size_t n>
void write (const TVectorNDBase< T, n > &value, const char *name=nullptr)
 Write integer vectors like ImageVector to the stream.
 
template<typename T , size_t n>
void write (const FloatingPointMatrix< T, n > &value, const char *name=nullptr)
 Write float matrices like mat4 to the stream.
 
virtual void writeObject (const Base *const obj, const char *name=nullptr)
 Write a Base object to the stream.
 
virtual bool isValidElementName (const char *name)
 check if name is valid for use with persistence entries (by default this checks if the name is valid for use as a XML tag, but implementations may relax - or tighten - this check)
 
virtual void write (bool value, const char *name=nullptr)
 Write primitive values to the stream.
 
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)
 Start a new list of values in the data stream, must be ended with endList().
 
void endList ()
 End reading/writing of the list.
 
void startStruct (const char *name=nullptr)
 Start a new struct of values in the data stream, must be ended with endStruct().
 
void endStruct ()
 End reading/writing of struct values.
 
bool isBinary () const override
 overridden methods
 
void writeString (const char *name, const std::string &value) override
 Abstract writing method that needs to be implemented by derived classes.
 
void writeData (const void *data, size_t len, const char *name) override
 Write binary data to stream.
 
void startListImpl (const char *name, const char *xmlItemName, bool xmlSuppressScope) override
 Abstract methods called by above methods, need to be implemented in derived classes.
 
void endListImpl () override
 
void startStructImpl (const char *name) override
 
void endStructImpl () override
 
void setObjectID (int id) override
 Implementation of Base object persistence, set 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.
 
void setObjectType (const char *type) override
 base type name
 
void setObjectVersion (int version) override
 persistence version
 
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.
 
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
 overriden to perform additional check in Debug mode if name is suitable for the persistence format (uses isValidElementName), prints an error if not
 
- Protected Member Functions inherited from ml::AbstractPersistenceStream
 AbstractPersistenceStream ()
 
virtual ~AbstractPersistenceStream ()
 
bool isInList () const
 Check if the stream is currently in "list" mode. Otherwise it is in "struct" mode.
 
size_t nestingDepth () const
 return depth of nesting stack (created by startList/startStruct), used to check nesting rules
 
virtual void internalError (const char *msg, const char *arg=nullptr)
 Log an internal error. Usually called to indicate wrong usage of interface.
 

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, set 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

base type name

Implements ml::AbstractPersistenceOutputStream.

◆ setObjectVersion()

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

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, 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::XMLPersistenceOutputStream::startStructImpl ( const char * name)
overrideprotectedvirtual

◆ writeData()

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

Write 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: