forked from FOME-Tech/fome-fw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logicdata_csv_reader.h
53 lines (39 loc) · 1.17 KB
/
logicdata_csv_reader.h
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
46
47
48
49
50
51
52
/*
* @file logicdata_csv_reader.h
*
* @date Jun 26, 2021
* @author Andrey Belomutskiy, (c) 2012-2021
*/
const int NORMAL_ORDER[2] = {0, 1};
const int REVERSE_ORDER[2] = {1, 0};
class CsvReader {
public:
CsvReader(size_t triggerCount, size_t vvtCount) : CsvReader(triggerCount, vvtCount, 0.0) {}
CsvReader(size_t triggerCount, size_t vvtCount, double timestampOffset)
: m_triggerCount(triggerCount)
, m_vvtCount(vvtCount)
, m_timestampOffset(timestampOffset)
{
}
~CsvReader();
bool twoBanksSingleCamMode = true;
void open(const char *fileName, const int* triggerColumnIndeces = NORMAL_ORDER, const int *vvtColumnIndeces = NORMAL_ORDER);
bool haveMore();
void processLine(EngineTestHelper *eth);
void readLine(EngineTestHelper *eth);
double readTimestampAndValues(double *v);
int lineIndex() const {
return m_lineIndex;
}
private:
const size_t m_triggerCount;
const size_t m_vvtCount;
const double m_timestampOffset;
FILE *fp = nullptr;
char buffer[255];
bool currentState[TRIGGER_INPUT_PIN_COUNT] = {0, 0};
bool currentVvtState[CAM_INPUTS_COUNT] = {0, 0};
int m_lineIndex = -1;
const int* m_triggerColumnIndeces;
const int* m_vvtColumnIndeces;
};