3 #ifndef __stir_IO_read_from_file_H__ 4 #define __stir_IO_read_from_file_H__ 44 template <
class DataT,
class FileT>
45 inline unique_ptr<DataT>
48 using hierarchy_base_type =
typename DataT::hierarchy_base_type;
55 auto data_ptr =
dynamic_cast<DataT*
>(uptr.get());
59 error(
"data read from file is an incorrect type");
63 return unique_ptr<DataT>(data_ptr);
84 template <
class DataT,
class FileT>
85 inline unique_ptr<DataT>
89 return read_from_file<DataT>(signature, file);
A class to read/store the file signature.
Definition: FileSignature.h:34
unique_ptr< DataT > read_from_file(FileT file)
Function that reads data from file using the default InputFileFormatRegistry.
Definition: read_from_file.h:86
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition: error.cxx:42
Import of std::unique_ptr into the stir namespace, together with work-arounds for other compilers...