General: reorganization of header files
[marnav.git] / include / marnav / nmea / vpw.hpp
blob87a3940e93b2840d2749929f51794322e69f3a4d
1 #ifndef MARNAV__NMEA__VPW__HPP
2 #define MARNAV__NMEA__VPW__HPP
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
7 namespace marnav
9 namespace nmea
11 /// @brief VPW - Speed - Measured Parallel to Wind
12 ///
13 /// @code
14 /// 1 2 3 4
15 /// | | | |
16 /// $--VPW,x.x,N,x.x,M*hh<CR><LF>
17 /// @endcode
18 ///
19 /// Field Number:
20 ///
21 /// 1. Speed knots, "-" means downwind
22 /// 2. Speed knots unit
23 /// - N = Knots
24 /// 3. Speed meters per second, "-" means downwind
25 /// 4. Speed meters per second unit
26 /// - M = Meters per second
27 ///
28 class vpw : public sentence
30 friend class detail::factory;
32 public:
33 constexpr static sentence_id ID = sentence_id::VPW;
34 constexpr static const char * TAG = "VPW";
36 vpw();
37 vpw(const vpw &) = default;
38 vpw & operator=(const vpw &) = default;
39 vpw(vpw &&) = default;
40 vpw & operator=(vpw &&) = default;
42 protected:
43 vpw(talker talk, fields::const_iterator first, fields::const_iterator last);
44 virtual void append_data_to(std::string &) const override;
46 private:
47 utils::optional<double> speed_knots_; // negative means downwind
48 utils::optional<unit::velocity> speed_knots_unit_;
49 utils::optional<double> speed_meters_per_second_; // negative means downwind
50 utils::optional<unit::velocity> speed_meters_per_second_unit_;
52 public:
53 decltype(speed_knots_) get_speed_knots() const { return speed_knots_; }
54 decltype(speed_knots_unit_) get_speed_knots_unit() const { return speed_knots_unit_; }
55 decltype(speed_meters_per_second_) get_speed_meters_per_second() const
57 return speed_meters_per_second_;
59 decltype(speed_meters_per_second_unit_) get_speed_meters_per_second_unit() const
61 return speed_meters_per_second_unit_;
64 void set_speed_knots(double t) noexcept;
65 void set_speed_mps(double t) noexcept;
70 #endif