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

Function SerializeBoundariesTable

generator/cities_boundaries_builder.cpp:84–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84void SerializeBoundariesTable(std::string const & path, OsmIdToBoundariesTable & table)
85{
86 using GeoIDsT = vector<base::GeoObjectId>;
87 using BoundariesT = vector<CityBoundary>;
88 vector<GeoIDsT> allIds;
89 vector<BoundariesT> allBoundaries;
90
91 table.ForEachCluster([&](GeoIDsT & ids, BoundariesT const & boundaries)
92 {
93 CHECK(!ids.empty(), ());
94 CHECK(!boundaries.empty(), ());
95
96 allIds.push_back(std::move(ids));
97 allBoundaries.push_back(boundaries);
98 });
99
100 LOG(LINFO, ("Saved boundary clusters count =", allIds.size()));
101
102 FileWriter sink(path);
103 CitiesBoundariesSerDes::Serialize(sink, allBoundaries);
104 for (auto const & ids : allIds)
105 {
106 WriteToSink(sink, static_cast<uint64_t>(ids.size()));
107 for (auto const & id : ids)
108 WriteToSink(sink, id.GetEncodedId());
109 }
110}
111
112bool DeserializeBoundariesTable(std::string const & path, OsmIdToBoundariesTable & table)
113{

Callers 1

ProcessMethod · 0.85

Calls 7

SerializeFunction · 0.85
WriteToSinkFunction · 0.85
ForEachClusterMethod · 0.80
GetEncodedIdMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected