NMEA: explicit specification of copy/move construction and assignment.
[marnav.git] / src / marnav / nmea / wnc.hpp
blob96a9b8e5225727dcd241c2254c5362412b3c0408
1 #ifndef __NMEA__WNC__HPP__
2 #define __NMEA__WNC__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/waypoint.hpp>
6 #include <marnav/utils/optional.hpp>
8 namespace marnav
10 namespace nmea
12 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(wnc)
14 /// @brief WNC - Distance - Waypoint to Waypoint
15 ///
16 /// @code
17 /// 1 2 3 4 5 6
18 /// | | | | | |
19 /// $--WNC,x.x,N,x.x,K,c--c,c--c*hh<CR><LF>
20 /// @endcode
21 ///
22 /// Field Number:
23 /// 1. Distance nautical miles
24 /// 2. Distance nautical miles unit
25 /// - N = Nautical Miles
26 /// 3. Distance Kilometers
27 /// 4. Distance Kilometers unit
28 /// - K = Kilometers
29 /// 5. TO Waypoint ID
30 /// 6. FROM Waypoint ID
31 ///
32 class wnc : public sentence
34 MARNAV_NMEA_SENTENCE_FRIENDS(wnc)
36 public:
37 constexpr static const sentence_id ID = sentence_id::WNC;
38 constexpr static const char * TAG = "WNC";
40 wnc();
41 wnc(const wnc &) = default;
42 wnc & operator=(const wnc &) = default;
43 wnc(wnc &&) = default;
44 wnc & operator=(wnc &&) = default;
46 protected:
47 wnc(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
48 virtual std::vector<std::string> get_data() const override;
50 private:
51 utils::optional<double> distance_nm;
52 utils::optional<unit::distance> distance_nm_unit;
53 utils::optional<double> distance_km;
54 utils::optional<unit::distance> distance_km_unit;
55 utils::optional<waypoint> waypoint_to;
56 utils::optional<waypoint> waypoint_from;
58 public:
59 MARNAV_NMEA_GETTER(distance_nm)
60 MARNAV_NMEA_GETTER(distance_nm_unit)
61 MARNAV_NMEA_GETTER(distance_km)
62 MARNAV_NMEA_GETTER(distance_km_unit)
63 MARNAV_NMEA_GETTER(waypoint_to)
64 MARNAV_NMEA_GETTER(waypoint_from)
66 void set_distance_nm(double t) noexcept;
67 void set_distance_km(double t) noexcept;
68 void set_waypoint_to(const waypoint & id) { waypoint_to = id; }
69 void set_waypoint_from(const waypoint & id) { waypoint_from = id; }
74 #endif