Dev: minor cleanup of include blockers, they are now consistent.
[marnav.git] / src / marnav / nmea / tpc.hpp
blobcc08ad913c39d3f48657f4c29e580e67b1cacfb5
1 #ifndef __MARNAV__NMEA__TPC__HPP__
2 #define __MARNAV__NMEA__TPC__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
7 namespace marnav
9 namespace nmea
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(tpc)
13 /// @brief TPC - Trawl Position Cartesian Coordinates
14 ///
15 /// @code
16 /// 1 2 3 4 5 6
17 /// | | | | | |
18 /// $--TPC,x,M,y,P,z.z,M*hh,<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number:
22 /// 1. Horizontal distance from the vessel center line
23 /// 2. Unit of horizontal distance
24 /// - M = Meters
25 /// 3. Horizontal distance from the transducer to the trawl along the vessel
26 /// center line. The value is normally positive assuming the trawl is located
27 /// behind the vessel.
28 /// 4. Unit of horizontal distance from transducer to the trawl
29 /// - M = Meters
30 /// 5. Depth of the trawl below the surface
31 /// 6. Unit of Depth
32 /// - M = Meters
33 ///
34 class tpc : public sentence
36 MARNAV_NMEA_SENTENCE_FRIENDS(tpc)
38 public:
39 constexpr static const sentence_id ID = sentence_id::TPC;
40 constexpr static const char * TAG = "TPC";
42 tpc();
43 tpc(const tpc &) = default;
44 tpc & operator=(const tpc &) = default;
45 tpc(tpc &&) = default;
46 tpc & operator=(tpc &&) = default;
48 protected:
49 tpc(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
50 virtual std::vector<std::string> get_data() const override;
52 private:
53 double distance_centerline = 0.0;
54 unit::distance distance_centerline_unit = unit::distance::meter;
55 double distance_transducer = 0.0;
56 unit::distance distance_transducer_unit = unit::distance::meter;
57 double depth = 0.0;
58 unit::distance depth_unit = unit::distance::meter;
60 public:
61 decltype(distance_centerline) get_distance_centerline() const
63 return distance_centerline;
65 decltype(distance_centerline_unit) get_distance_centerline_unit() const
67 return distance_centerline_unit;
69 decltype(distance_transducer) get_distance_transducer() const
71 return distance_transducer;
73 decltype(distance_transducer_unit) get_distance_transducer_unit() const
75 return distance_transducer_unit;
77 decltype(depth) get_depth() const { return depth; }
78 decltype(depth_unit) get_depth_unit() const { return depth_unit; }
80 void set_distance_centerline(double t) noexcept
82 distance_centerline = t;
83 distance_centerline_unit = unit::distance::meter;
85 void set_distance_transducer(double t) noexcept
87 distance_transducer = t;
88 distance_centerline_unit = unit::distance::meter;
90 void set_depth(double t) noexcept
92 depth = t;
93 distance_centerline_unit = unit::distance::meter;
99 #endif