NMEA: removed macro 'MARNAV_NMEA_GETTER'.
[marnav.git] / src / marnav / nmea / bod.hpp
blob2131a2f87a368457d02f26375bd73ca45ed974bb
1 #ifndef __NMEA__BOD__HPP__
2 #define __NMEA__BOD__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(bod)
14 /// @brief BOD - Bearing - Waypoint to Waypoint
15 ///
16 /// @code
17 /// 1 2 3 4 5 6
18 /// | | | | | |
19 /// $--BOD,x.x,T,x.x,M,c--c,c--c*hh<CR><LF>
20 /// @endcode
21 ///
22 /// Field Number:
23 /// 1. Bearing Degrees True
24 /// 2. Bearing Degrees True reference
25 /// - T = True
26 /// 3. Bearing Degrees Magnetic
27 /// 4. Bearing Degrees Magnetic reference
28 /// - M = Magnetic
29 /// 5. TO Waypoint ID
30 /// 6. FROM Waypoint ID
31 ///
32 /// Example: <tt>$GPBOD,099.3,T,105.6,M,POINTB,*01</tt>
33 ///
34 class bod : public sentence
36 MARNAV_NMEA_SENTENCE_FRIENDS(bod)
38 public:
39 constexpr static const sentence_id ID = sentence_id::BOD;
40 constexpr static const char * TAG = "BOD";
42 bod();
43 bod(const bod &) = default;
44 bod & operator=(const bod &) = default;
45 bod(bod &&) = default;
46 bod & operator=(bod &&) = default;
48 protected:
49 bod(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 utils::optional<double> bearing_true;
54 utils::optional<reference> type_true; // T:true
55 utils::optional<double> bearing_magn;
56 utils::optional<reference> type_magn; // M:magnetic
57 utils::optional<waypoint> waypoint_to; // TO waypoint ID
58 utils::optional<waypoint> waypoint_from; // FROM waypoint ID
60 public:
61 decltype(bearing_true) get_bearing_true() const { return bearing_true; }
62 decltype(type_true) get_type_true() const { return type_true; }
63 decltype(bearing_magn) get_bearing_magn() const { return bearing_magn; }
64 decltype(type_magn) get_type_magn() const { return type_magn; }
65 decltype(waypoint_to) get_waypoint_to() const { return waypoint_to; }
66 decltype(waypoint_from) get_waypoint_from() const { return waypoint_from; }
68 void set_bearing_true(double t) noexcept;
69 void set_bearing_magn(double t) noexcept;
70 void set_waypoint_to(const waypoint & id) { waypoint_to = id; }
71 void set_waypoint_from(const waypoint & id) { waypoint_from = id; }
76 #endif