AIS: smaller public interface for AIS messages regarding encoding.
[marnav.git] / src / marnav / nmea / zfo.hpp
blob095f9ca88f87fc8b1a8eb6f991c88cffd94235d4
1 #ifndef __NMEA__ZFO__HPP__
2 #define __NMEA__ZFO__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/time.hpp>
6 #include <marnav/nmea/waypoint.hpp>
7 #include <marnav/utils/optional.hpp>
9 namespace marnav
11 namespace nmea
13 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(zfo)
15 /// @brief ZFO - UTC & Time from origin Waypoint
16 ///
17 /// @code
18 /// 1 2 3
19 /// | | |
20 /// $--ZFO,hhmmss.ss,hhmmss.ss,c--c*hh<CR><LF>
21 /// @endcode
22 ///
23 /// Field Number:
24 /// 1. Universal Time Coordinated (UTC)
25 /// 2. Elapsed Time
26 /// 3. Origin Waypoint ID
27 ///
28 class zfo : public sentence
30 MARNAV_NMEA_SENTENCE_FRIENDS(zfo)
32 public:
33 constexpr static const sentence_id ID = sentence_id::ZFO;
34 constexpr static const char * TAG = "ZFO";
36 virtual ~zfo() {}
38 zfo();
39 zfo(const zfo &) = default;
40 zfo & operator=(const zfo &) = default;
42 protected:
43 zfo(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
44 virtual std::vector<std::string> get_data() const override;
46 private:
47 utils::optional<nmea::time> time_utc;
48 utils::optional<nmea::duration> time_elapsed;
49 utils::optional<waypoint> waypoint_id;
51 public:
52 NMEA_GETTER(time_utc)
53 NMEA_GETTER(time_elapsed)
54 NMEA_GETTER(waypoint_id)
56 void set_time_utc(const nmea::time & t) noexcept { time_utc = t; }
57 void set_time_elapsed(const nmea::duration & t) noexcept { time_elapsed = t; }
58 void set_waypoint_id(const waypoint & id) { waypoint_id = id; }
63 #endif