29 #ifndef CDPL_UTIL_MULTIFORMATDATAWRITER_HPP
30 #define CDPL_UTIL_MULTIFORMATDATAWRITER_HPP
52 template <
typename DataType>
67 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out |
68 std::ios_base::trunc | std::ios_base::binary);
78 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out |
79 std::ios_base::trunc | std::ios_base::binary);
89 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out |
90 std::ios_base::trunc | std::ios_base::binary);
134 operator const void*()
const;
156 template <
typename DataType>
163 throw Base::IOError(
"MultiFormatDataWriter: could not deduce data format of '" + file_name +
"'");
165 writerPtr = handler->createWriter(file_name, mode);
166 dataFormat = handler->getDataFormat();
171 template <
typename DataType>
173 std::ios_base::openmode mode)
178 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt +
"'");
180 writerPtr = handler->createWriter(file_name, mode);
181 dataFormat = handler->getDataFormat();
186 template <
typename DataType>
188 std::ios_base::openmode mode):
194 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt.
getName() +
"'");
196 writerPtr = handler->createWriter(file_name, mode);
201 template <
typename DataType>
207 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt +
"'");
209 writerPtr = handler->createWriter(ios);
210 dataFormat = handler->getDataFormat();
215 template <
typename DataType>
222 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt.
getName() +
"'");
224 writerPtr = handler->createWriter(ios);
229 template <
typename DataType>
235 template <
typename DataType>
239 writerPtr->
write(obj);
243 template <
typename DataType>
249 template <
typename DataType>
252 return writerPtr->operator
const void*();
255 template <
typename DataType>
258 return writerPtr->operator!();
261 template <
typename DataType>
Definition of exception classes.
Definition of 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.
Singleton class that serves as a global registry for Base::DataInputHandler and Base::DataOutputHandl...
Definition: DataIOManager.hpp:110
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:678
static OutputHandlerPointer getOutputHandlerByFormat(const DataFormat &fmt)
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the specified d...
Definition: DataIOManager.hpp:655
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.