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

Function readCellMetrics

include/customizer/files.hpp:17–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15// reads .osrm.cell_metrics file
16template <typename CellMetricT>
17inline void readCellMetrics(const std::filesystem::path &path,
18 std::unordered_map<std::string, std::vector<CellMetricT>> &metrics)
19{
20 static_assert(std::is_same<CellMetricView, CellMetricT>::value ||
21 std::is_same<CellMetric, CellMetricT>::value,
22 "");
23
24 const auto fingerprint = storage::tar::FileReader::VerifyFingerprint;
25 storage::tar::FileReader reader{path, fingerprint};
26
27 for (auto &pair : metrics)
28 {
29 const auto &metric_name = pair.first;
30 auto &metric_exclude_classes = pair.second;
31
32 auto prefix = "/mld/metrics/" + metric_name + "/exclude";
33 auto num_exclude_classes = reader.ReadElementCount64(prefix);
34 metric_exclude_classes.resize(num_exclude_classes);
35
36 auto id = 0;
37 for (auto &metric : metric_exclude_classes)
38 {
39 serialization::read(reader, prefix + "/" + std::to_string(id++), metric);
40 }
41 }
42}
43
44// writes .osrm.cell_metrics file
45template <typename CellMetricT>

Callers 1

PopulateUpdatableDataMethod · 0.85

Calls 4

to_stringFunction · 0.85
readFunction · 0.70
ReadElementCount64Method · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected