NMEA: explicit specification of copy/move construction and assignment.
[marnav.git] / src / marnav / nmea / dtm.hpp
blob0b6847695168c764b44a1520270d034180299296
1 #ifndef __NMEA__DTM__HPP__
2 #define __NMEA__DTM__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(dtm)
13 /// @brief DTM - Datum Reference
14 ///
15 /// @code
16 /// 1 2 3 4 5 6 7 8 9
17 /// | | | | | | | | |
18 /// $ --DTM,ref,x,llll,c,llll,c,aaa,ref*hh<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number:
22 /// 1. Local datum code.
23 /// - W84 = WGS84
24 /// 2. Local datum subcode. May be blank.
25 /// 3. Latitude offset (minutes)
26 /// 4. Latitude hemisphere
27 /// - N = North
28 /// - S = South
29 /// 5. Longitude offset (minutes)
30 /// 6. Longitude hemisphere
31 /// - E = East
32 /// - W = West
33 /// 7. Altitude offset in meters
34 /// 8. Datum name. What’s usually seen here is "W84", the standard WGS84 datum used by GPS.
35 /// - W84 = WGS84
36 ///
37 /// @note Datum code, subcode and datum name are truncated to 5 characters.
38 ///
39 class dtm : public sentence
41 MARNAV_NMEA_SENTENCE_FRIENDS(dtm)
43 public:
44 constexpr static const sentence_id ID = sentence_id::DTM;
45 constexpr static const char * TAG = "DTM";
47 dtm();
48 dtm(const dtm &) = default;
49 dtm & operator=(const dtm &) = default;
50 dtm(dtm &&) = default;
51 dtm & operator=(dtm &&) = default;
53 protected:
54 dtm(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
55 virtual std::vector<std::string> get_data() const override;
57 private:
58 std::string ref = "W84";
59 utils::optional<std::string> subcode;
60 double lat_offset = 0.0;
61 direction lat_hem = direction::north;
62 double lon_offset = 0.0;
63 direction lon_hem = direction::east;
64 double altitude = 0.0;
65 std::string name = "W84";
67 public:
68 MARNAV_NMEA_GETTER(ref)
69 MARNAV_NMEA_GETTER(subcode)
70 MARNAV_NMEA_GETTER(lat_offset)
71 MARNAV_NMEA_GETTER(lat_hem)
72 MARNAV_NMEA_GETTER(lon_offset)
73 MARNAV_NMEA_GETTER(lon_hem)
74 MARNAV_NMEA_GETTER(altitude)
75 MARNAV_NMEA_GETTER(name)
77 void set_ref(const std::string & t) noexcept;
78 void set_subcode(const std::string & t) noexcept;
79 void set_lat_offset(double t, direction h);
80 void set_lon_offset(double t, direction h);
81 void set_altitude(double t) { altitude = t; }
82 void set_name(const std::string & t) noexcept;
87 #endif