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

Method SerializeForIntermediate

generator/feature_builder.cpp:382–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380}
381
382void FeatureBuilder::SerializeForIntermediate(Buffer & data) const
383{
384 CHECK(IsValid(), (*this));
385
386 data.clear();
387
388 serial::GeometryCodingParams cp;
389
390 PushBackByteSink<Buffer> sink(data);
391 m_params.Write(sink);
392
393 if (m_params.GetGeomType() == GeomType::Point)
394 {
395 serial::SavePoint(sink, m_center, cp);
396 }
397 else
398 {
399 WriteVarUint(sink, static_cast<uint32_t>(m_polygons.size()));
400
401 for (PointSeq const & points : m_polygons)
402 serial::SaveOuterPath(points, cp, sink);
403
404 WriteVarInt(sink, m_coastCell);
405 }
406
407 // Save OSM IDs to link meta information with sorted features later.
408 rw::WriteVectorOfPOD(sink, m_osmIds);
409
410 // Check for correct serialization.
411#ifdef DEBUG
412 Buffer tmp(data);
413 FeatureBuilder fb;
414 fb.DeserializeFromIntermediate(tmp);
415 ASSERT(fb == *this, ("Source feature: ", *this, "Deserialized feature: ", fb));
416#endif
417}
418
419void FeatureBuilder::DeserializeFromIntermediate(Buffer & data)
420{

Callers 2

SerializeMethod · 0.80
UNIT_CLASS_TESTFunction · 0.80

Calls 12

SavePointFunction · 0.85
WriteVarUintFunction · 0.85
SaveOuterPathFunction · 0.85
WriteVarIntFunction · 0.85
WriteVectorOfPODFunction · 0.85
ASSERTFunction · 0.85
IsValidFunction · 0.50
clearMethod · 0.45
WriteMethod · 0.45
GetGeomTypeMethod · 0.45
sizeMethod · 0.45

Tested by 1

UNIT_CLASS_TESTFunction · 0.64