MeVisLab Toolbox Reference
ml::AbstractPersistenceStream Class Referenceabstract

AbstactPersistenceStream is the base class for AbstractPersistenceOutputStream and AbstractPersistenceInputStream and implements the methods that are common for both these classes. More...

#include <mlAbstractPersistenceStream.h>

Inheritance diagram for ml::AbstractPersistenceStream:
ml::AbstractPersistenceInputStream ml::AbstractPersistenceOutputStream ml::XMLPersistenceInputStream ml::XMLPersistenceOutputStream

Public Member Functions

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.
 
virtual bool isBinary () const =0
 Is the stream in a binary format? (otherwise in a readable text format)
 

Protected Member Functions

 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.
 
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.
 
virtual void startListImpl (const char *name, const char *xmlItemName, bool xmlSuppressScope)=0
 Abstract methods called by above methods, need to be implemented in derived classes.
 
virtual void endListImpl ()=0
 
virtual void startStructImpl (const char *name)=0
 
virtual void endStructImpl ()=0
 

Detailed Description

AbstactPersistenceStream is the base class for AbstractPersistenceOutputStream and AbstractPersistenceInputStream and implements the methods that are common for both these classes.

Definition at line 49 of file mlAbstractPersistenceStream.h.

Constructor & Destructor Documentation

◆ AbstractPersistenceStream()

ml::AbstractPersistenceStream::AbstractPersistenceStream ( )
protected

◆ ~AbstractPersistenceStream()

virtual ml::AbstractPersistenceStream::~AbstractPersistenceStream ( )
protectedvirtual

Member Function Documentation

◆ endList()

void ml::AbstractPersistenceStream::endList ( )

End reading/writing of the list.

◆ endListImpl()

virtual void ml::AbstractPersistenceStream::endListImpl ( )
protectedpure virtual

◆ endStruct()

void ml::AbstractPersistenceStream::endStruct ( )

End reading/writing of struct values.

◆ endStructImpl()

virtual void ml::AbstractPersistenceStream::endStructImpl ( )
protectedpure virtual

◆ internalError()

virtual void ml::AbstractPersistenceStream::internalError ( const char * msg,
const char * arg = nullptr )
protectedvirtual

Log an internal error. Usually called to indicate wrong usage of interface.

◆ isBinary()

virtual bool ml::AbstractPersistenceStream::isBinary ( ) const
pure virtual

Is the stream in a binary format? (otherwise in a readable text format)

Users might adapt the persistence depending on this value.

Implemented in ml::XMLPersistenceOutputStream, and ml::XMLPersistenceInputStream.

◆ isInList()

bool ml::AbstractPersistenceStream::isInList ( ) const
inlineprotected

Check if the stream is currently in "list" mode. Otherwise it is in "struct" mode.

Definition at line 96 of file mlAbstractPersistenceStream.h.

◆ nameCheck()

virtual void ml::AbstractPersistenceStream::nameCheck ( const char * name)
protectedvirtual

Check if the name is provided when being in a sub-group, or that no name is provided when being in a list.

Otherwise an error is logged.

Reimplemented in ml::AbstractPersistenceOutputStream.

◆ nestingDepth()

size_t ml::AbstractPersistenceStream::nestingDepth ( ) const
inlineprotected

return depth of nesting stack (created by startList/startStruct), used to check nesting rules

Definition at line 99 of file mlAbstractPersistenceStream.h.

◆ startList()

void ml::AbstractPersistenceStream::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().

Subsequent read or write calls are not allowed to provide a name for items. List items should all be of the same type.

For legacy reasons (old XML persistence interface) one can specify the name for list items and whether the list should not start a separate scope. (The list simply consists of items of the same name then. You still need to specify a object name for other formats.)

◆ startListImpl()

virtual void ml::AbstractPersistenceStream::startListImpl ( const char * name,
const char * xmlItemName,
bool xmlSuppressScope )
protectedpure virtual

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:

Implemented in ml::XMLPersistenceOutputStream, and ml::XMLPersistenceInputStream.

◆ startStruct()

void ml::AbstractPersistenceStream::startStruct ( const char * name = nullptr)

Start a new struct of values in the data stream, must be ended with endStruct().

Subsequent read or write calls need to provide a name for the different values.

◆ startStructImpl()

virtual void ml::AbstractPersistenceStream::startStructImpl ( const char * name)
protectedpure virtual

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