| 82 | } |
| 83 | |
| 84 | void 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 | |
| 112 | bool DeserializeBoundariesTable(std::string const & path, OsmIdToBoundariesTable & table) |
| 113 | { |
no test coverage detected