29 #ifndef CDPL_UTIL_MULTIFORMATDATAREADER_HPP
30 #define CDPL_UTIL_MULTIFORMATDATAREADER_HPP
49 template <
typename DataType>
57 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary);
60 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary);
63 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary);
89 operator const void*()
const;
109 template <
typename DataType>
115 throw Base::IOError(
"MultiFormatDataReader: could not deduce data format of '" + file_name +
"'");
117 readerPtr = handler->createReader(file_name, mode);
118 dataFormat = handler->getDataFormat();
123 template <
typename DataType>
125 std::ios_base::openmode mode)
130 throw Base::IOError(
"MultiFormatDataReader: could not find handler for format '" + fmt +
"'");
132 readerPtr = handler->createReader(file_name, mode);
133 dataFormat = handler->getDataFormat();
138 template <
typename DataType>
140 std::ios_base::openmode mode):
146 throw Base::IOError(
"MultiFormatDataReader: could not find handler for format '" + fmt.
getName() +
"'");
148 readerPtr = handler->createReader(file_name, mode);
153 template <
typename DataType>
159 throw Base::IOError(
"MultiFormatDataReader: could not find handler for format '" + fmt +
"'");
161 readerPtr = handler->createReader(is);
162 dataFormat = handler->getDataFormat();
167 template <
typename DataType>
174 throw Base::IOError(
"MultiFormatDataReader: could not find handler for format '" + fmt.
getName() +
"'");
176 readerPtr = handler->createReader(is);
181 template <
typename DataType>
187 template <
typename DataType>
191 readerPtr->
read(obj, overwrite);
195 template <
typename DataType>
199 readerPtr->
read(idx, obj, overwrite);
203 template <
typename DataType>
211 template <
typename DataType>
214 return readerPtr->hasMoreData();
217 template <
typename DataType>
220 return readerPtr->getRecordIndex();
223 template <
typename DataType>
226 readerPtr->setRecordIndex(idx);
229 template <
typename DataType>
232 return readerPtr->getNumRecords();
235 template <
typename DataType>
238 return readerPtr->operator
const void*();
241 template <
typename DataType>
244 return readerPtr->operator!();
247 template <
typename DataType>
253 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 InputHandlerPointer getInputHandlerByFormat(const DataFormat &fmt)
Returns a pointer to a Base::DataInputHandler implementation instance registered for the specified da...
Definition: DataIOManager.hpp:580
static InputHandlerPointer getInputHandlerByFileExtension(const std::string &file_ext)
Returns a pointer to a Base::DataInputHandler implementation instance registered for the data format ...
Definition: DataIOManager.hpp:591
An interface for reading data objects of a given type from an arbitrary data source.
Definition: DataReader.hpp:73
std::shared_ptr< DataReader > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated DataReader instances.
Definition: DataReader.hpp:84
DataType DataType
The type of the read data objects.
Definition: DataReader.hpp:79
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.