stromx  0.8.0
Public Member Functions | List of all members
stromx::runtime::XmlReader Class Reference

Reader for stromx files. More...

#include <XmlReader.h>

Public Member Functions

StreamreadStream (const std::string &filepath, const AbstractFactory *factory) const
 
StreamreadStream (FileInput &input, const std::string &filename, const AbstractFactory *factory) const
 
void readParameters (const std::string &filepath, const AbstractFactory *factory, const std::vector< stromx::runtime::Operator *> &operators) const
 
void readParameters (FileInput &input, const std::string &filename, const AbstractFactory *factory, const std::vector< stromx::runtime::Operator *> &operators) const
 

Detailed Description

Reader for stromx files.

Stromx can read and write stream and parameter files. A stream file contains all the operators, connections and threads of a stream. In addition, the settings of the parameters of each operator are stored. A parameter file contains the parameter settings of a list of operator. It can be used to set the parameters of an existing stream without changing its connections or threads.

Both stream and parameter files are XML files. Additionally, they can refer to dependend files which contain parameter information which should not be encoded as XML (such as image data). Thus the stream and parameter XML files are actually part of file bundles which are either stored in a common directory or in a zip archive. In the first case the path of the file is the path of XML file contained in the same directory as the dependend files. In the second case it is the path of zip file which contains the XML file and the dependend files. Zip files can also have the custom extension *.stromx.

Stream and parameter files can also be read from file inputs. File inputs are an abstraction of the file bundles mentioned above and are represented by a FileInput object. This allows the user to implement custom ways to store file bundles, e.g. in a database or using a different archive format.

Member Function Documentation

§ readParameters() [1/2]

void stromx::runtime::XmlReader::readParameters ( const std::string &  filepath,
const AbstractFactory factory,
const std::vector< stromx::runtime::Operator *> &  operators 
) const

Reads a parameter file. The file can be either an XML or a zip file. The functions sets the parameters of operators to the values in the file. If a parameter can not be set the error is silently ignored. In particular, only those operator parameters are set which can be written to in the current operator state.

Parameters
filepathThe path of the file to be read.
factoryThe factory is used to instantiate data objects in the stream. I.e. all required data types must have been registered with the factory.
Exceptions
DeserializationErrorFailed to deserialize data referenced in the XML file.
FileExceptionFailed to access the XML file or a data file.
FactoryExceptionFailed to allocate an operator or a data object.
InconsistentFileContentThe content of the file is inconsistent. This is probably due to a change of the file format.

§ readParameters() [2/2]

void stromx::runtime::XmlReader::readParameters ( FileInput input,
const std::string &  filename,
const AbstractFactory factory,
const std::vector< stromx::runtime::Operator *> &  operators 
) const

Reads a parameter file from an file input. The function sets the parameters of operators to the values in the file. If a parameter can not be set the error is silently ignored. In particular, only those operator parameters are set which can be written to in the current operator state.

Parameters
inputThe file input which provides the parameter files.
filenameThe name of the file in the input to be read.
factoryThe factory is used to instantiate data objects in the stream. I.e. all required data types must have been registered with the factory.
Exceptions
FileExceptionFailed to access the XML file or a data file.
FactoryExceptionFailed to allocate an operator or a data object.
DeserializationErrorFailed to deserialize data referenced in the XML file.

§ readStream() [1/2]

Stream * stromx::runtime::XmlReader::readStream ( const std::string &  filepath,
const AbstractFactory factory 
) const

Reads a stream file. The file can be either an XML or a zip file.

Parameters
filepathThe path of the file to be read.
factoryThe factory is used to instantiate the operators and data objects in the stream. I.e. all required operator and data types must have been registered with the factory.
Exceptions
DeserializationErrorFailed to deserialize data referenced in the XML file.
FileExceptionFailed to access the XML file or a data file.
FactoryExceptionFailed to allocate an operator or a data object.
InconsistentFileContentThe content of the file is inconsistent. This is probably due to a change of the file format.

§ readStream() [2/2]

Stream * stromx::runtime::XmlReader::readStream ( FileInput input,
const std::string &  filename,
const AbstractFactory factory 
) const

Reads a stream file from an file input.

Parameters
inputThe file input which provides the stream files.
filenameThe name of the file in the input to be read.
factoryThe factory is used to instantiate the operators and data objects in the stream. I.e. all required operator and data types must have been registered with the factory.
Exceptions
DeserializationErrorFailed to deserialize data referenced in the XML file.
FileExceptionFailed to access the XML file or a data file.
FactoryExceptionFailed to allocate an operator or a data object.
InconsistentFileContentThe content of the file is inconsistent. This is probably due to a change of the file format.

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