initial commit before ownership transfer
This commit is contained in:
51
code/reader/SensorReaderStep.h
Executable file
51
code/reader/SensorReaderStep.h
Executable file
@@ -0,0 +1,51 @@
|
||||
#ifndef SENSORREADERSTEP_H
|
||||
#define SENSORREADERSTEP_H
|
||||
|
||||
#include <fstream>
|
||||
|
||||
/** entry for one sensor */
|
||||
struct SensorEntryStep {
|
||||
|
||||
/** sensor data */
|
||||
float ts; //timestamp of the step
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/** read sensor data from CSV */
|
||||
class SensorReaderStep {
|
||||
|
||||
private:
|
||||
|
||||
std::ifstream fp;
|
||||
|
||||
public:
|
||||
|
||||
SensorReaderStep(const std::string& file) {
|
||||
fp.open(file);
|
||||
assert(fp.is_open());
|
||||
}
|
||||
|
||||
bool hasNext() {
|
||||
return !fp.bad() && !fp.eof();
|
||||
}
|
||||
|
||||
/** read the next sensor entry */
|
||||
SensorEntryStep getNext() {
|
||||
|
||||
char delim;
|
||||
SensorEntryStep entry;
|
||||
|
||||
fp >> entry.ts;
|
||||
|
||||
int i = 0;
|
||||
return entry;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // SENSORREADERSTEP_H
|
||||
Reference in New Issue
Block a user