General: reorganization of header files
[marnav.git] / include / marnav / nmea / tpc.hpp
blobf9a1cf1ca19c832cedd96b06ec251401874b4dd3
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 /// @brief TPC - Trawl Position Cartesian Coordinates
12 ///
13 /// @code
14 /// 1 2 3 4 5 6
15 /// | | | | | |
16 /// $--TPC,x,M,y,P,z.z,M*hh,<CR><LF>
17 /// @endcode
18 ///
19 /// Field Number:
20 /// 1. Horizontal distance from the vessel center line
21 /// 2. Unit of horizontal distance
22 /// - M = Meters
23 /// 3. Horizontal distance from the transducer to the trawl along the vessel
24 /// center line. The value is normally positive assuming the trawl is located
25 /// behind the vessel.
26 /// 4. Unit of horizontal distance from transducer to the trawl
27 /// - M = Meters
28 /// 5. Depth of the trawl below the surface
29 /// 6. Unit of Depth
30 /// - M = Meters
31 ///
32 class tpc : public sentence
34 friend class detail::factory;
36 public:
37 constexpr static sentence_id ID = sentence_id::TPC;
38 constexpr static const char * TAG = "TPC";
40 tpc();
41 tpc(const tpc &) = default;
42 tpc & operator=(const tpc &) = default;
43 tpc(tpc &&) = default;
44 tpc & operator=(tpc &&) = default;
46 protected:
47 tpc(talker talk, fields::const_iterator first, fields::const_iterator last);
48 virtual void append_data_to(std::string &) const override;
50 private:
51 double distance_centerline_ = 0.0;
52 unit::distance distance_centerline_unit_ = unit::distance::meter;
53 double distance_transducer_ = 0.0;
54 unit::distance distance_transducer_unit_ = unit::distance::meter;
55 double depth_ = 0.0;
56 unit::distance depth_unit_ = unit::distance::meter;
58 public:
59 decltype(distance_centerline_) get_distance_centerline() const
61 return distance_centerline_;
63 decltype(distance_centerline_unit_) get_distance_centerline_unit() const
65 return distance_centerline_unit_;
67 decltype(distance_transducer_) get_distance_transducer() const
69 return distance_transducer_;
71 decltype(distance_transducer_unit_) get_distance_transducer_unit() const
73 return distance_transducer_unit_;
75 decltype(depth_) get_depth() const { return depth_; }
76 decltype(depth_unit_) get_depth_unit() const { return depth_unit_; }
78 void set_distance_centerline(double t) noexcept
80 distance_centerline_ = t;
81 distance_centerline_unit_ = unit::distance::meter;
83 void set_distance_transducer(double t) noexcept
85 distance_transducer_ = t;
86 distance_centerline_unit_ = unit::distance::meter;
88 void set_depth(double t) noexcept
90 depth_ = t;
91 distance_centerline_unit_ = unit::distance::meter;
97 #endif