29 #ifndef CDPL_UTIL_MULTIFORMATDATAWRITER_HPP
30 #define CDPL_UTIL_MULTIFORMATDATAWRITER_HPP
49 template <
typename DataType>
57 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out |
58 std::ios_base::trunc | std::ios_base::binary);
61 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out |
62 std::ios_base::trunc | std::ios_base::binary);
65 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out |
66 std::ios_base::trunc | std::ios_base::binary);
82 operator const void*()
const;
100 template <
typename DataType>
107 throw Base::IOError(
"MultiFormatDataWriter: could not deduce data format of '" + file_name +
"'");
109 writerPtr = handler->createWriter(file_name, mode);
110 dataFormat = handler->getDataFormat();
115 template <
typename DataType>
117 std::ios_base::openmode mode)
122 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt +
"'");
124 writerPtr = handler->createWriter(file_name, mode);
125 dataFormat = handler->getDataFormat();
130 template <
typename DataType>
132 std::ios_base::openmode mode):
138 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt.
getName() +
"'");
140 writerPtr = handler->createWriter(file_name, mode);
145 template <
typename DataType>
151 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt +
"'");
153 writerPtr = handler->createWriter(ios);
154 dataFormat = handler->getDataFormat();
159 template <
typename DataType>
166 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt.
getName() +
"'");
168 writerPtr = handler->createWriter(ios);
173 template <
typename DataType>
179 template <
typename DataType>
183 writerPtr->
write(obj);
187 template <
typename DataType>
193 template <
typename DataType>
196 return writerPtr->operator
const void*();
199 template <
typename DataType>
202 return writerPtr->operator!();
205 template <
typename DataType>
Definition of exception classes.
Definition of the class CDPL::Base::DataIOManager.
void setParent(const ControlParameterContainer *cntnr)
Sets or removes the parent control-parameter container used to resolve requests for missing entries.
void invokeIOCallbacks(double progress) const
Invokes all registered I/O callback functions with the argument *this.
A singleton class that serves as a global registry for Base::DataInputHandler and Base::DataOutputHan...
Definition: DataIOManager.hpp:104
static OutputHandlerPointer getOutputHandlerByFileExtension(const std::string &file_ext)
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the data format...
Definition: DataIOManager.hpp:670
static OutputHandlerPointer getOutputHandlerByFormat(const DataFormat &fmt)
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the specified d...
Definition: DataIOManager.hpp:647
An interface for writing data objects of a given type to an arbitrary data sink.
Definition: DataWriter.hpp:63
DataType DataType
The type of the written data objects.
Definition: DataWriter.hpp:74
std::shared_ptr< DataWriter > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated DataWriter instances.
Definition: DataWriter.hpp:69
Thrown to indicate that an I/O operation has failed because of physical (e.g. broken pipe) or logical...
Definition: Base/Exceptions.hpp:250
The namespace of the Chemical Data Processing Library.