-
Notifications
You must be signed in to change notification settings - Fork 7
/
file.cpp
45 lines (39 loc) · 1.07 KB
/
file.cpp
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
43
44
45
#include "file.h"
File::File(const QString &name, QObject *parent) :
QFile(name, parent)
{
}
Measurements *File::getMeasurements(bool isMaster)
{
this->seek(0);
Measurements* measurements = new Measurements;
quint8 measurementData = 0;
quint8 baseMask;
if(isMaster) {
baseMask = baseAMask;
} else {
baseMask = baseBMask;
}
bool bit;
bool valid;
bool photon;
for(qint64 i = 0; i < this->size(); i++) {
this->getChar((char*)&measurementData);
if(isMaster) {
valid = true;
bit = measurementData & bitAMask;
} else {
// bool base = (bool)(measurementData & baseBMask);
photon = (bool)(measurementData & photon01Mask);
valid = photon ^ ((bool)(measurementData & photon02Mask));
bit = !photon;
}
Measurement *measurement = new Measurement(measurementData & baseMask, bit, valid);
measurements->append(measurement);
/*
if(i >= 200)
break;
*/
}
return measurements;
}