1 /*
2 ===============================================================================
3 
4   FILE:  field_gpstime.hpp
5 
6   CONTENTS:
7 
8 
9   PROGRAMMERS:
10 
11     martin.isenburg@rapidlasso.com  -  http://rapidlasso.com
12     uday.karan@gmail.com - Hobu, Inc.
13 
14   COPYRIGHT:
15 
16     (c) 2007-2014, martin isenburg, rapidlasso - tools to catch reality
17     (c) 2014, Uday Verma, Hobu, Inc.
18 
19     This is free software; you can redistribute and/or modify it under the
20     terms of the GNU Lesser General Licence as published by the Free Software
21     Foundation. See the COPYING file for more information.
22 
23     This software is distributed WITHOUT ANY WARRANTY and without even the
24     implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25 
26   CHANGE HISTORY:
27 
28 ===============================================================================
29 */
30 
31 namespace lazperf
32 {
33 namespace detail
34 {
35 
36 class Gpstime10Base
37 {
38 protected:
39     Gpstime10Base();
40 
41     bool have_last_;
42     models::arithmetic m_gpstime_multi, m_gpstime_0diff;
43     unsigned int last;
44     unsigned int next;
45     std::array<las::gpstime, 4> last_gpstime;
46     std::array<int, 4> last_gpstime_diff;
47     std::array<int, 4> multi_extreme_counter;
48 };
49 
50 class Gpstime10Compressor : public Gpstime10Base
51 {
52 public:
53     Gpstime10Compressor(encoders::arithmetic<OutCbStream>&);
54 
55     const char *compress(const char *c);
56 
57 private:
58     void init();
59 
60     encoders::arithmetic<OutCbStream>& enc_;
61     bool compressor_inited_;
62     compressors::integer ic_gpstime;
63 };
64 
65 class Gpstime10Decompressor : public Gpstime10Base
66 {
67 public:
68     Gpstime10Decompressor(decoders::arithmetic<InCbStream>&);
69 
70     char *decompress(char *c);
71 
72 private:
73     void init();
74 
75     decoders::arithmetic<InCbStream>& dec_;
76     bool decompressor_inited_;
77     decompressors::integer ic_gpstime;
78 };
79 
80 } // namespace detail
81 } // namespace lazperf
82