Mantid
Loading...
Searching...
No Matches
BinaryStreamReader.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2015 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8//------------------------------------------------------------------------------
9// Includes
10//------------------------------------------------------------------------------
11#include "MantidKernel/DllConfig.h"
12
13#include <cstdint>
14#include <iosfwd>
15#include <string>
16#include <vector>
17
18namespace Mantid {
19namespace Kernel {
20
21// Forward declarations
22template <typename T> class Matrix;
23
32class MANTID_KERNEL_DLL BinaryStreamReader {
33public:
35 enum class MatrixOrdering { RowMajor, ColumnMajor };
36
37 BinaryStreamReader(std::istream &istrm);
38
46 BinaryStreamReader &operator>>(std::string &value);
50
53 BinaryStreamReader &read(std::vector<int16_t> &value, const size_t nvals);
54 BinaryStreamReader &read(std::vector<int32_t> &value, const size_t nvals);
55 BinaryStreamReader &read(std::vector<int64_t> &value, const size_t nvals);
56 BinaryStreamReader &read(std::vector<float> &value, const size_t nvals);
57 BinaryStreamReader &read(std::vector<double> &value, const size_t nvals);
58 BinaryStreamReader &read(std::string &value, const size_t length);
60
63 BinaryStreamReader &read(std::vector<std::string> &value, const std::vector<int32_t> &shape, MatrixOrdering order);
64 BinaryStreamReader &read(Kernel::Matrix<float> &value, const std::vector<int32_t> &shape, MatrixOrdering order);
65 BinaryStreamReader &read(Kernel::Matrix<double> &value, const std::vector<int32_t> &shape, MatrixOrdering order);
67
69 void moveStreamToPosition(size_t nbytes);
70
71private:
73 std::istream &m_istrm;
78};
79
80} // namespace Kernel
81} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
Assists with reading a binary file by providing standard overloads for the istream operators (>>) to ...
std::istream & m_istrm
Reference to the stream being read.
uint64_t m_strLengthSize
The default size in bytes of the type used to encode the length of a string in the file.
MatrixOrdering
Define the ordering of 2D structures in the file.
Numerical Matrix class.
Definition: Matrix.h:42
MANTID_API_DLL std::istream & operator>>(std::istream &istr, API::Boolean &)
Redaing a Boolean from an input stream.
Definition: Column.cpp:61
Helper class which provides the Collimation Length for SANS instruments.