NMEA: explicit specification of copy/move construction and assignment.
[marnav.git] / src / marnav / nmea / xdr.hpp
blob9896463eb041b880396fd11c490c69e72e119901
1 #ifndef __NMEA__XDR__HPP__
2 #define __NMEA__XDR__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(xdr)
13 /// @brief XDR - Transducer Measurement
14 ///
15 /// @code
16 /// 1 2 3 4
17 /// | | | |
18 /// $--XDR,a,x.x,a,c--c, ..... *hh<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number:
22 /// 1. Transducer Type
23 /// 2. Measurement Data
24 /// 3. Units of measurement
25 /// 4. Name of transducer
26 ///
27 /// There may be any number of quadruplets like this, each describing a sensor.
28 /// The last field will be a checksum as usual.
29 ///
30 class xdr : public sentence
32 MARNAV_NMEA_SENTENCE_FRIENDS(xdr)
34 public:
35 struct transducer_info {
36 char transducer_type;
37 double measurement_data;
38 char units_of_measurement;
39 std::string name;
42 constexpr static const sentence_id ID = sentence_id::XDR;
43 constexpr static const char * TAG = "XDR";
45 constexpr static const int max_transducer_info = 10;
47 xdr();
48 xdr(const xdr &) = default;
49 xdr & operator=(const xdr &) = default;
50 xdr(xdr &&) = default;
51 xdr & operator=(xdr &&) = default;
53 protected:
54 xdr(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::array<utils::optional<transducer_info>, max_transducer_info> transducer_data;
60 void check_index(int index) const;
62 public:
63 utils::optional<transducer_info> get_info(int index) const;
65 void set_info(int index, const transducer_info & info);
70 #endif