NMEA: explicit specification of copy/move construction and assignment.
[marnav.git] / src / marnav / nmea / hdg.hpp
blob198d9b21fc6c9f073e83eafd6c22482374182517
1 #ifndef __NMEA__HDG__HPP__
2 #define __NMEA__HDG__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(hdg)
13 /// @brief HDG - Heading - Deviation & Variation
14 ///
15 /// @code
16 /// 1 2 3 4 5
17 /// | | | | |
18 /// $--HDG,x.x,x.x,a,x.x,a*hh<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number:
22 /// 1. Magnetic Sensor heading in degrees
23 /// 2. Magnetic Deviation degrees
24 /// 3. Magnetic Deviation direction
25 /// - E = Easterly
26 /// - W = Westerly
27 /// 4. Magnetic Variation degrees
28 /// 5. Magnetic Variation direction
29 /// - E = Easterly
30 /// - W = Westerly
31 ///
32 class hdg : public sentence
34 MARNAV_NMEA_SENTENCE_FRIENDS(hdg)
36 public:
37 constexpr static const sentence_id ID = sentence_id::HDG;
38 constexpr static const char * TAG = "HDG";
40 hdg();
41 hdg(const hdg &) = default;
42 hdg & operator=(const hdg &) = default;
43 hdg(hdg &&) = default;
44 hdg & operator=(hdg &&) = default;
46 protected:
47 hdg(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> heading; // magnetic sensor heading in deg
52 utils::optional<double> magn_dev; // magnetic deviation in deg
53 utils::optional<direction> magn_dev_hem; // E:east, W:west
54 utils::optional<double> magn_var; // magnetic variation in deg
55 utils::optional<direction> magn_var_hem; // E:east, W:west
57 public:
58 MARNAV_NMEA_GETTER(heading)
59 MARNAV_NMEA_GETTER(magn_dev)
60 MARNAV_NMEA_GETTER(magn_dev_hem)
61 MARNAV_NMEA_GETTER(magn_var)
62 MARNAV_NMEA_GETTER(magn_var_hem)
64 void set_heading(double t) noexcept { heading = t; }
65 void set_magn_dev(double deg, direction hem);
66 void set_magn_var(double deg, direction hem);
71 #endif