| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | /* | |||
| 2 | * mlg_reader.h | |||
| 3 | * | |||
| 4 | */ | |||
| 5 | ||||
| 6 | #pragma once | |||
| 7 | ||||
| 8 | #include <vector> | |||
| 9 | #include <map> | |||
| 10 | #include "MlgDataType.h" | |||
| 11 | #include "MlgRecord.h" | |||
| 12 | #include "LogLine.h" | |||
| 13 | #include <functional> | |||
| 14 | ||||
| 15 | using after_header_callback_t = std::function<void()>; | |||
| 16 | using mlg_logline_callback_t = std::function<void(std::map<const std::string, float>& currentSnapshot)>; | |||
| 17 | ||||
| 18 | class BinarySensorReader { | |||
| 19 | public: | |||
| 20 | after_header_callback_t afterHeaderCallback{}; | |||
| 21 | ||||
| 22 | void openMlg(const std::string fileName); | |||
| 23 | void readMlg(mlg_logline_callback_t callback); | |||
| 24 | std::map<const std::string, float>& readBlock(); | |||
| 25 | bool eof(); | |||
| 26 | ||||
| 27 | ✗ | ~BinarySensorReader() { | ||
| 28 | ✗ | for (auto record : records) { | ||
| 29 | ✗ | delete record; | ||
| 30 | } | |||
| 31 | ✗ | } | ||
| 32 | private: | |||
| 33 | std::ifstream ifs; | |||
| 34 | void readLoggerFieldData(); | |||
| 35 | int readRecordsMetadata(std::ifstream &ifs, int numberOfFields); | |||
| 36 | ||||
| 37 | std::vector<Record*> records; | |||
| 38 | std::map<std::string, const Record*> recordByName; | |||
| 39 | std::map<const std::string, float> currentSnapshot; | |||
| 40 | //std::vector<LogLine> logContent; | |||
| 41 | int recordCounter = 0; | |||
| 42 | }; | |||
| 43 |