| 28 | namespace x3 = boost::spirit::x3; |
| 29 | |
| 30 | SegmentLookupTable readSegmentValues(const std::vector<std::string> &paths) |
| 31 | { |
| 32 | static const auto value_if_blank = std::numeric_limits<double>::quiet_NaN(); |
| 33 | const x3::real_parser<double, x3::ureal_policies<double>> unsigned_double; |
| 34 | CSVFilesParser<Segment, SpeedSource> parser( |
| 35 | 1, |
| 36 | x3::ulong_long >> ',' >> x3::ulong_long, |
| 37 | unsigned_double >> -(',' >> (x3::double_ | x3::attr(value_if_blank)))); |
| 38 | |
| 39 | // Check consistency of keys in the result lookup table |
| 40 | auto result = parser(paths); |
| 41 | const auto found_inconsistency = |
| 42 | std::find_if(std::begin(result.lookup), |
| 43 | std::end(result.lookup), |
| 44 | [](const auto &entry) { return entry.first.from == entry.first.to; }); |
| 45 | if (found_inconsistency != std::end(result.lookup)) |
| 46 | { |
| 47 | util::Log(logWARNING) << "Empty segment in CSV with node " + |
| 48 | std::to_string(found_inconsistency->first.from); |
| 49 | } |
| 50 | |
| 51 | return result; |
| 52 | } |
| 53 | |
| 54 | TurnLookupTable readTurnValues(const std::vector<std::string> &paths) |
| 55 | { |
no test coverage detected