2021-06-25 21:15:55 -07:00
|
|
|
/*
|
|
|
|
* @file logicdata_csv_reader.h
|
|
|
|
*
|
|
|
|
* @date Jun 26, 2021
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2021
|
|
|
|
*/
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void open(const char *fileName, const int* columnIndeces);
|
|
|
|
bool haveMore();
|
|
|
|
void processLine(EngineTestHelper *eth);
|
|
|
|
void readLine(EngineTestHelper *eth);
|
|
|
|
|
|
|
|
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-06-25 21:33:28 -07:00
|
|
|
FILE *fp;
|
|
|
|
char buffer[255];
|
|
|
|
|
|
|
|
bool currentState[2];
|
2021-07-13 12:27:27 -07:00
|
|
|
bool currentVvtState[CAM_INPUTS_COUNT];
|
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
|
|
|
|
2021-07-01 14:29:31 -07:00
|
|
|
const int* columnIndeces;
|
2021-06-25 21:15:55 -07:00
|
|
|
};
|
|
|
|
|