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

Method Save

generator/metalines_builder.cpp:200–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void MetalinesBuilder::Save()
201{
202 LOG(LINFO, ("Saving metalines to", GetFilename()));
203
204 std::unordered_multimap<size_t, std::shared_ptr<LineString>> keyToLineString;
205 FileReader reader(GetTmpFilename());
206 ReaderSource<FileReader> src(reader);
207 while (src.Size() > 0)
208 {
209 auto const key = ReadVarUint<uint64_t>(src);
210 keyToLineString.emplace(key, std::make_shared<LineString>(LineString::Deserialize(src)));
211 }
212
213 FileWriter writer(GetFilename());
214 uint32_t countLines = 0;
215 uint32_t countWays = 0;
216 auto const mergedData = LineStringMerger::Merge(keyToLineString);
217 for (auto const & p : mergedData)
218 {
219 for (auto const & lineString : p.second)
220 {
221 auto const & ways = lineString->GetWays();
222 rw::WriteVectorOfPOD(writer, ways);
223 countWays += ways.size();
224 ++countLines;
225 }
226 }
227
228 LOG(LINFO, ("Finished saving metalines. Wrote", countLines, "metalines [with", countWays, "ways]"));
229}
230
231void MetalinesBuilder::OrderCollectedData()
232{

Callers

nothing calls this directly

Calls 4

WriteVectorOfPODFunction · 0.85
SizeMethod · 0.45
emplaceMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected