29 #include <boost/current_function.hpp>
31 #include <pni/core/types.hpp>
32 #include <pni/core/error.hpp>
94 void _read_entry_data(std::vector<T> &r,std::ifstream &stream);
107 void _read_entry_data(std::vector<string> &r,std::ifstream &stream);
134 std::streampos data);
157 static ifd_entry create_from_stream(std::ifstream &stream);
200 template<
typename T> std::vector<T> value(std::ifstream &stream);
210 template<
typename T> std::vector<T> ifd_entry::value(std::ifstream &stream)
213 std::vector<T> result(this->
size());
215 std::streampos orig_stream_pos = stream.tellg();
218 stream.seekg(this->_data,std::ios::beg);
229 this->_read_entry_data(result,stream);
233 e.append(EXCEPTION_RECORD);
235 stream.seekg(orig_stream_pos,std::ios::beg);
241 stream.seekg(orig_stream_pos,std::ios::beg);
247 template<
typename T>
void ifd_entry::
248 _read_entry_data(std::vector<T> &r,std::ifstream &stream)
250 if(this->_tid == ifd_entry_type_id::BYTE)
252 else if(this->_tid == ifd_entry_type_id::SHORT)
254 else if(this->_tid == ifd_entry_type_id::LONG)
256 else if(this->_tid == ifd_entry_type_id::RATIONAL)
258 else if(this->_tid == ifd_entry_type_id::SBYTE)
260 else if(this->_tid == ifd_entry_type_id::SSHORT)
262 else if(this->_tid == ifd_entry_type_id::SLONG)
264 else if(this->_tid == ifd_entry_type_id::SRATIONAL)
266 else if(this->_tid == ifd_entry_type_id::FLOAT)
268 else if(this->_tid == ifd_entry_type_id::DOUBLE)
272 throw type_error(EXCEPTION_RECORD,
"IFD entry ["+this->name()+
273 "] contains unknown data!");
std::ostream & operator<<(std::ostream &o, const column_info &ci)
Definition: column_info.cpp:95
string of 8Bit values with binary terminated with a binary 0
std::streampos _data
marks data position
Definition: ifd_entry.hpp:78
size_t size(const selection &s) noexcept
get selection size
Definition: selection.cpp:181
pni::core::type_id_t type_id(const h5datatype &o)
get type code
Definition: h5datatype.cpp:240
Definition: cbf_reader.hpp:41
class for IFD entries
Definition: ifd_entry.hpp:72
bool operator<(const index_value_type &lhs, const index_value_type &rhs)
comparison operator for index_value_type
Definition: dimensions.cpp:36
IFD entry reader template.
Definition: ifd_entry_reader.hpp:48
uint16 _tag
ID of the entry.
Definition: ifd_entry.hpp:75
ifd_entry_type_id _tid
type id of the entry
Definition: ifd_entry.hpp:76
void read(const OTYPE< IMPID > &o, ATYPE &a)
read data
Definition: read.hpp:63
size_t _size
number of elements of the entry
Definition: ifd_entry.hpp:77
ifd_entry_type_id
Definition: ifd_entry.hpp:43