MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / writeCellMetrics

Function writeCellMetrics

include/customizer/files.hpp:46–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44// writes .osrm.cell_metrics file
45template <typename CellMetricT>
46inline void
47writeCellMetrics(const std::filesystem::path &path,
48 const std::unordered_map<std::string, std::vector<CellMetricT>> &metrics)
49{
50 static_assert(std::is_same<CellMetricView, CellMetricT>::value ||
51 std::is_same<CellMetric, CellMetricT>::value,
52 "");
53
54 const auto fingerprint = storage::tar::FileWriter::GenerateFingerprint;
55 storage::tar::FileWriter writer{path, fingerprint};
56
57 for (const auto &pair : metrics)
58 {
59 const auto &metric_name = pair.first;
60 const auto &metric_exclude_classes = pair.second;
61
62 auto prefix = "/mld/metrics/" + metric_name + "/exclude";
63 writer.WriteElementCount64(prefix, metric_exclude_classes.size());
64
65 auto id = 0;
66 for (auto &exclude_metric : metric_exclude_classes)
67 {
68 serialization::write(writer, prefix + "/" + std::to_string(id++), exclude_metric);
69 }
70 }
71}
72
73// reads .osrm.mldgr file
74template <typename MultiLevelGraphT>

Callers 1

RunMethod · 0.85

Calls 4

to_stringFunction · 0.85
writeFunction · 0.70
WriteElementCount64Method · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected