MCPcopy Create free account
hub / github.com/comaps/comaps / ForEachOsmId2FeatureId

Function ForEachOsmId2FeatureId

generator/utils.hpp:72–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70
71template <typename ToDo>
72bool ForEachOsmId2FeatureId(std::string const & path, ToDo && toDo)
73{
74 generator::OsmID2FeatureID mapping;
75 try
76 {
77 FileReader reader(path);
78 NonOwningReaderSource source(reader);
79 mapping.ReadAndCheckHeader(source);
80 }
81 catch (FileReader::Exception const & e)
82 {
83 LOG(LERROR, ("Exception while reading file:", path, ", message:", e.Msg()));
84 return false;
85 }
86
87 mapping.ForEach([&](auto const & p) { toDo(p.first /* osm id */, p.second /* feature id */); });
88 return true;
89}
90
91bool ParseFeatureIdToOsmIdMapping(std::string const & path,
92 ankerl::unordered_dense::map<uint32_t, base::GeoObjectId> & mapping);

Callers 5

ForEachWayFromFileFunction · 0.85
FillOsmIdToFeatureIdsMapFunction · 0.85
FillOsmIdToFeatureIdsMapFunction · 0.85

Calls 2

ReadAndCheckHeaderMethod · 0.80
ForEachMethod · 0.45

Tested by

no test coverage detected