| 98 | namespace serial |
| 99 | { |
| 100 | class GeometryCodingParams |
| 101 | { |
| 102 | public: |
| 103 | GeometryCodingParams(); |
| 104 | GeometryCodingParams(uint8_t coordBits, m2::PointD const & pt); |
| 105 | GeometryCodingParams(uint8_t coordBits, uint64_t basePointUint64); |
| 106 | |
| 107 | m2::PointU GetBasePoint() const { return m_BasePoint; } |
| 108 | uint64_t GetBasePointUint64() const { return m_BasePointUint64; } |
| 109 | int64_t GetBasePointInt64() const { return static_cast<int64_t>(m_BasePointUint64); } |
| 110 | |
| 111 | void SetBasePoint(m2::PointD const & pt); |
| 112 | |
| 113 | uint8_t GetCoordBits() const { return m_CoordBits; } |
| 114 | |
| 115 | template <typename WriterT> |
| 116 | void Save(WriterT & writer) const |
| 117 | { |
| 118 | WriteVarUint(writer, GetCoordBits()); |
| 119 | WriteVarUint(writer, m_BasePointUint64); |
| 120 | } |
| 121 | |
| 122 | template <typename SourceT> |
| 123 | void Load(SourceT & src) |
| 124 | { |
| 125 | uint32_t const coordBits = ReadVarUint<uint32_t>(src); |
| 126 | ASSERT_LESS(coordBits, 32, ()); |
| 127 | *this = GeometryCodingParams(coordBits, ReadVarUint<uint64_t>(src)); |
| 128 | } |
| 129 | |
| 130 | private: |
| 131 | uint64_t m_BasePointUint64; |
| 132 | m2::PointU m_BasePoint; |
| 133 | uint8_t m_CoordBits; |
| 134 | }; |
| 135 | |
| 136 | namespace pts |
| 137 | { |
no outgoing calls
no test coverage detected