29 #ifndef CDPL_UTIL_MULTIFORMATDATAWRITER_HPP
30 #define CDPL_UTIL_MULTIFORMATDATAWRITER_HPP
52 template <
typename DataType>
69 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out |
70 std::ios_base::trunc | std::ios_base::binary);
80 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out |
81 std::ios_base::trunc | std::ios_base::binary);
91 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out |
92 std::ios_base::trunc | std::ios_base::binary);
136 operator const void*()
const;
158 template <
typename DataType>
165 throw Base::IOError(
"MultiFormatDataWriter: could not deduce data format of '" + file_name +
"'");
167 writerPtr = handler->createWriter(file_name, mode);
168 dataFormat = handler->getDataFormat();
173 template <
typename DataType>
175 std::ios_base::openmode mode)
180 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt +
"'");
182 writerPtr = handler->createWriter(file_name, mode);
183 dataFormat = handler->getDataFormat();
188 template <
typename DataType>
190 std::ios_base::openmode mode):
196 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt.
getName() +
"'");
198 writerPtr = handler->createWriter(file_name, mode);
203 template <
typename DataType>
209 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt +
"'");
211 writerPtr = handler->createWriter(ios);
212 dataFormat = handler->getDataFormat();
217 template <
typename DataType>
224 throw Base::IOError(
"MultiFormatDataWriter: could not find handler for format '" + fmt.
getName() +
"'");
226 writerPtr = handler->createWriter(ios);
231 template <
typename DataType>
237 template <
typename DataType>
241 writerPtr->
write(obj);
245 template <
typename DataType>
251 template <
typename DataType>
254 return writerPtr->operator
const void*();
257 template <
typename DataType>
260 return writerPtr->operator!();
263 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:692
static OutputHandlerPointer getOutputHandlerByFormat(const DataFormat &fmt)
Returns a pointer to a Base::DataOutputHandler implementation instance registered for the specified d...
Definition: DataIOManager.hpp:669
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.