diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2018-04-10 17:49:58 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2018-04-12 15:04:50 +0300 |
commit | 84b72029731ff9e5f76d0e799f87fc4507e22619 (patch) | |
tree | 6567ba0301db2bc6df54b5398b35ed0ddd624cca /kml/serdes_binary.hpp | |
parent | 05411dec927ea3ad1b4af2d4f5716f6798b8fba3 (diff) |
Added new kml points format
Diffstat (limited to 'kml/serdes_binary.hpp')
-rw-r--r-- | kml/serdes_binary.hpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kml/serdes_binary.hpp b/kml/serdes_binary.hpp index b58febab37..8a903e0890 100644 --- a/kml/serdes_binary.hpp +++ b/kml/serdes_binary.hpp @@ -20,7 +20,8 @@ namespace binary enum class Version : uint8_t { V0 = 0, - Latest = V0 + V1 = 1, // 11th April 2018 (new Point2D storage, added deviceId, feature name -> custom name). + Latest = V1 }; class SerializerKml @@ -37,6 +38,11 @@ public: // Write format version. WriteToSink(sink, Version::Latest); + // Write device id. + auto const sz = m_data.m_deviceId.size(); + WriteVarUint(sink, static_cast<uint32_t>(sz)); + sink.Write(m_data.m_deviceId.data(), sz); + auto const startPos = sink.Pos(); // Reserve place for the header. @@ -117,6 +123,11 @@ public: if (v != Version::Latest) MYTHROW(DeserializeException, ("Incorrect file version.")); + // Read device id. + auto const sz = ReadVarUint<uint32_t>(source); + m_data.m_deviceId.resize(sz); + source.Read(&m_data.m_deviceId[0], sz); + auto subReader = reader.CreateSubReader(source.Pos(), source.Size()); InitializeIfNeeded(*subReader); |