-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRawDataReader.h
More file actions
31 lines (26 loc) · 916 Bytes
/
RawDataReader.h
File metadata and controls
31 lines (26 loc) · 916 Bytes
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
#ifndef SSCOPE_RAWDATAREADER_H
#define SSCOPE_RAWDATAREADER_H
#include <QFile>
class RawDataReader {
public:
RawDataReader(const char* fname, int bufsize, int chunksize);
~RawDataReader();
inline int head() { return fHead; }
inline bool checkAndClearReset()
{ bool ret = fHadReset; fHadReset = false; return ret; }
void reset(int bufsize = -1);
bool readAll();
char* atRaw(int t);
private:
int do_read(char* buf, int len);
int fFd;
char* fBuf;
int fBufsize; // total buffer size in bytes
int fNChunks; // total buffer size in chunks
int fChunksize; // size of one chunk in bytes
int fBufPos; // buffer index for next byte to be read
int fHead; // id of newest available chunk
bool fHadEOF; // true after end-of-file (read() returns 0)
bool fHadReset; // true after new data stream has begun
};
#endif