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

Method SerializeAccuratelyForIntermediate

generator/feature_builder.cpp:455–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455void FeatureBuilder::SerializeAccuratelyForIntermediate(Buffer & data) const
456{
457 CHECK(IsValid(), (*this));
458
459 data.clear();
460 PushBackByteSink<Buffer> sink(data);
461 m_params.Write(sink);
462 if (IsPoint())
463 {
464 rw::WritePOD(sink, m_center);
465 }
466 else
467 {
468 WriteVarUint(sink, static_cast<uint32_t>(m_polygons.size()));
469 for (PointSeq const & points : m_polygons)
470 rw::WriteVectorOfPOD(sink, points);
471
472 WriteVarInt(sink, m_coastCell);
473 }
474
475 // Save OSM IDs to link meta information with sorted features later.
476 rw::WriteVectorOfPOD(sink, m_osmIds);
477
478 // Check for correct serialization.
479#ifdef DEBUG
480 Buffer tmp(data);
481 FeatureBuilder fb;
482 fb.DeserializeAccuratelyFromIntermediate(tmp);
483 ASSERT(fb == *this, ("Source feature: ", *this, "Deserialized feature: ", fb));
484#endif
485}
486
487void FeatureBuilder::DeserializeAccuratelyFromIntermediate(Buffer & data)
488{

Callers 3

SerializeMethod · 0.80
CollectMethod · 0.80
UNIT_CLASS_TESTFunction · 0.80

Calls 10

WritePODFunction · 0.85
WriteVarUintFunction · 0.85
WriteVectorOfPODFunction · 0.85
WriteVarIntFunction · 0.85
ASSERTFunction · 0.85
IsValidFunction · 0.50
clearMethod · 0.45
WriteMethod · 0.45
sizeMethod · 0.45

Tested by 1

UNIT_CLASS_TESTFunction · 0.64