2021-06-25 21:15:55 -07:00
|
|
|
/*
|
|
|
|
* @file logicdata_csv_reader.h
|
|
|
|
*
|
|
|
|
* @date Jun 26, 2021
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2021
|
|
|
|
*/
|
2022-09-24 12:33:01 -07:00
|
|
|
|
2022-09-24 20:01:42 -07:00
|
|
|
const int NORMAL_ORDER[2] = {0, 1};
|
|
|
|
|
|
|
|
const int REVERSE_ORDER[2] = {1, 0};
|
2022-09-24 12:33:01 -07:00
|
|
|
|
2022-09-24 21:26:42 -07:00
|
|
|
|
|
|
|
|
2021-06-25 21:15:55 -07:00
|
|
|
class CsvReader {
|
|
|
|
public:
|
2021-07-13 11:24:47 -07:00
|
|
|
CsvReader(size_t triggerCount, size_t vvtCount) : CsvReader(triggerCount, vvtCount, 0.0) {}
|
|
|
|
CsvReader(size_t triggerCount, size_t vvtCount, double timestampOffset)
|
2021-07-01 14:29:31 -07:00
|
|
|
: m_triggerCount(triggerCount)
|
2021-07-13 11:24:47 -07:00
|
|
|
, m_vvtCount(vvtCount)
|
2021-07-01 14:29:31 -07:00
|
|
|
, m_timestampOffset(timestampOffset)
|
|
|
|
{
|
|
|
|
}
|
2021-12-01 10:35:44 -08:00
|
|
|
~CsvReader();
|
2021-07-01 14:29:31 -07:00
|
|
|
|
2022-09-24 21:26:42 -07:00
|
|
|
bool twoBanksSingleCamMode = true;
|
|
|
|
|
2022-09-24 20:07:55 -07:00
|
|
|
void open(const char *fileName, const int* triggerColumnIndeces = NORMAL_ORDER, const int *vvtColumnIndeces = NORMAL_ORDER);
|
2021-07-01 14:29:31 -07:00
|
|
|
bool haveMore();
|
|
|
|
void processLine(EngineTestHelper *eth);
|
|
|
|
void readLine(EngineTestHelper *eth);
|
2021-12-01 10:35:44 -08:00
|
|
|
double readTimestampAndValues(double *v);
|
2021-07-01 14:29:31 -07:00
|
|
|
|
|
|
|
int lineIndex() const {
|
|
|
|
return m_lineIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const size_t m_triggerCount;
|
2021-07-13 11:24:47 -07:00
|
|
|
const size_t m_vvtCount;
|
2021-07-01 14:29:31 -07:00
|
|
|
const double m_timestampOffset;
|
|
|
|
|
2021-12-01 10:35:44 -08:00
|
|
|
FILE *fp = nullptr;
|
2021-06-25 21:33:28 -07:00
|
|
|
char buffer[255];
|
|
|
|
|
2021-11-15 20:42:23 -08:00
|
|
|
bool currentState[2] = {0, 0};
|
|
|
|
bool currentVvtState[CAM_INPUTS_COUNT] = {0, 0};
|
2021-06-25 21:33:28 -07:00
|
|
|
|
2021-07-01 14:29:31 -07:00
|
|
|
int m_lineIndex = -1;
|
2021-06-25 21:33:28 -07:00
|
|
|
|
2022-09-24 19:55:54 -07:00
|
|
|
const int* triggerColumnIndeces;
|
2022-09-24 20:01:42 -07:00
|
|
|
const int* vvtColumnIndeces;
|
2021-06-25 21:15:55 -07:00
|
|
|
};
|
|
|
|
|