STIR
6.2.0
|
A helper class to read data from a hdf5 file. More...
#include "stir/IO/InputStreamWithRecordsFromHDF5.h"
Public Types | |
typedef std::vector< std::streampos >::size_type | SavedPosition |
Public Member Functions | |
InputStreamWithRecordsFromHDF5 (const std::string &filename, const std::size_t size_of_record_signature, const std::size_t max_size_of_record) | |
Constructor taking a stream. More... | |
virtual Succeeded | get_next_record (RecordT &record) |
virtual Succeeded | set_up () |
Succeeded | reset () |
go back to starting position | |
SavedPosition | save_get_position () |
save current "get" position in an internal array More... | |
Succeeded | set_get_position (const SavedPosition &) |
set current "get" position to previously saved value | |
std::vector< std::streampos > | get_saved_get_positions () const |
Function that enables the user to store the saved get_positions. More... | |
void | set_saved_get_positions (const std::vector< std::streampos > &) |
Function that sets the saved get_positions. More... | |
A helper class to read data from a hdf5 file.
This class is really a helper class for reading different records from a stream. It is useful when all types of records have some kind of signature to allow the function to find out what the size of the record is. In that case, all IO handling is completely generic and is implemented in this class.
Current implementation needs a max_size_of_record
to allocate enough memory (on the stack) before reading. This is efficient in many cases, but impractical in others.
RecordT
needs to have the following member functions new
or on the stack.
|
explicit |
Constructor taking a stream.
Data will be assumed to start at the start of the DataSet. If reset() is used, it will go back to this starting position.
|
inline |
save current "get" position in an internal array
|
inline |
Function that enables the user to store the saved get_positions.
Together with set_saved_get_positions(), this allows reinstating the saved get_positions when reopening the same stream.
|
inline |
Function that sets the saved get_positions.
Normally, the argument results from a call to get_saved_get_positions() on the same stream.