37 lines
690 B
C++
Executable File
37 lines
690 B
C++
Executable File
#ifndef TURNREADER_H
|
|
#define TURNREADER_H
|
|
|
|
#include "../reader/SensorReaderTurn.h"
|
|
#include "TurnObservation.h"
|
|
|
|
class TurnReader {
|
|
public:
|
|
static TurnObservation* readTurn(const SensorEntryTurn& se) {
|
|
|
|
std::string tmp = se.data;
|
|
TurnObservation* obs = new TurnObservation();
|
|
|
|
while(!tmp.empty()) {
|
|
|
|
int pos = tmp.find(',');
|
|
std::string heading = tmp.substr(0, pos);
|
|
tmp = tmp.substr(pos);
|
|
assert(tmp[0] == ';'); tmp = tmp.substr(1);
|
|
|
|
std::string motion = tmp;
|
|
|
|
TurnObservation t(std::stof(heading), std::stof(motion));
|
|
|
|
|
|
|
|
}
|
|
|
|
return obs;
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
#endif // TURNREADER_H
|