| 24 | static double const kMaxDeltaLon; |
| 25 | |
| 26 | struct DataPoint |
| 27 | { |
| 28 | // TODO(@m): document the version format |
| 29 | DataPoint() = default; |
| 30 | |
| 31 | DataPoint(uint64_t timestamp, ms::LatLon latLon, uint8_t traffic) |
| 32 | : m_timestamp(timestamp) |
| 33 | , m_latLon(latLon) |
| 34 | , m_traffic(traffic) |
| 35 | {} |
| 36 | // Uint64 should be enough for all our use cases. |
| 37 | // It is expected that |m_timestamp| stores time since epoch in seconds. |
| 38 | uint64_t m_timestamp = 0; |
| 39 | ms::LatLon m_latLon = ms::LatLon::Zero(); |
| 40 | // A pod type instead of the traffic::SpeedGroup enum |
| 41 | // so as not to introduce a cyclic dependency. |
| 42 | // This field was added in Version 1 (and was the only addition). |
| 43 | uint8_t m_traffic = 0; |
| 44 | |
| 45 | bool operator==(DataPoint const & p) const { return m_timestamp == p.m_timestamp && m_latLon == p.m_latLon; } |
| 46 | }; |
| 47 | |
| 48 | // Serializes |points| to |writer| by storing delta-encoded points. |
| 49 | // Returns the number of bytes written. |