-
Notifications
You must be signed in to change notification settings - Fork 0
/
MatrixReader.hpp
42 lines (31 loc) · 1.04 KB
/
MatrixReader.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef MATRIXREADER_HPP
#define MATRIXREADER_HPP
#include <string>
#include <cstdint>
#include "Block.hpp"
#include "BitStream.hpp"
namespace dc {
/**
* A class to read a matrix of size <size>*<size> from a text file.
*/
template<size_t size = dc::BlockSize>
class MatrixReader {
private:
uint16_t matrix [size * size];
double expanded[size * size];
std::string m_errStr;
MatrixReader(uint32_t *matrix);
public:
MatrixReader(void);
~MatrixReader(void);
static MatrixReader<> fromBitstream(util::BitStreamReader &reader);
bool read(const std::string &fileName);
void write(util::BitStreamWriter &writer) const;
const std::string toString(void) const;
uint8_t getMaxBitLength(void) const;
const double* getData(void) const;
static constexpr size_t SIZE_LEN_BITS = 5;
};
extern template class dc::MatrixReader<dc::BlockSize>;
}
#endif // MATRIXREADER_HPP