NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / talker_id.hpp
blob796fb69aea2b5d5466de3908fb53a69f47afebed
1 #ifndef __MARNAV__NMEA__TALKER_ID__HPP__
2 #define __MARNAV__NMEA__TALKER_ID__HPP__
4 #include <string>
6 namespace marnav
8 namespace nmea
10 /// This class represents a talker. Its purpose is to have a strong
11 /// type for talkers, instead of simply representing it with a string.
12 class talker
14 public:
15 explicit constexpr talker(const char * id)
16 : id_(id)
20 talker(const talker &) = default;
21 talker & operator=(const talker &) = default;
23 talker(talker &&) = default;
24 talker & operator=(talker &&) = default;
26 const char * str() const { return id_; }
28 bool operator==(const talker & t) const
30 return (this == &t) // same object
31 || (id_ == t.id_) // points to the same constant string
32 || (std::string{id_} == std::string{t.id_}); // most expensive test, luckily SSO
35 bool operator!=(const talker & t) const { return !(*this == t); }
37 private:
38 const char * id_;
41 talker make_talker(const std::string & s);
43 /// Namespace contains all defined talkers. For a more descriptive documentation
44 /// of all entries, see to_name(talker).
45 namespace talker_id
47 /// Number of known talkers.
48 constexpr std::size_t num_talkers = 65;
50 constexpr const talker none{""};
51 constexpr const talker autopilot_general{"AG"};
52 constexpr const talker autopilot_magnetic{"AP"};
53 constexpr const talker beidou_2{"BD"};
54 constexpr const talker computer_calculator{"CC"};
55 constexpr const talker communications_dsc{"CD"};
56 constexpr const talker computer_memory{"CM"};
57 constexpr const talker communications_satellite{"CS"};
58 constexpr const talker communications_mfhf{"CT"};
59 constexpr const talker communications_vhf{"CV"};
60 constexpr const talker communications_scanning_receiver{"CX"};
61 constexpr const talker decca_navigation{"DE"};
62 constexpr const talker direction_finder{"DF"};
63 constexpr const talker electronic_chart_display{"EC"};
64 constexpr const talker emergency_position_indicating_beacon{"EP"};
65 constexpr const talker engine_room_monitoring_systems{"ER"};
66 constexpr const talker galileo{"GA"};
67 constexpr const talker beidou_1{"GB"};
68 constexpr const talker global_positioning_system{"GP"};
69 constexpr const talker glonass{"GL"};
70 constexpr const talker mixed_gps_glonass{"GN"};
71 constexpr const talker magnetic_compass{"HC"};
72 constexpr const talker north_seeking_gyro{"HE"};
73 constexpr const talker non_north_seeking_gyro{"HN"};
74 constexpr const talker integrated_instrumentation{"II"};
75 constexpr const talker integrated_navigation{"IN"};
76 constexpr const talker loran_a{"LA"};
77 constexpr const talker loran_c{"LC"};
78 constexpr const talker microwave_positioning_system{"MP"};
79 constexpr const talker omega_navigation_system{"OM"};
80 constexpr const talker distress_alarm_system{"OS"};
81 constexpr const talker qzss_gps_augmentation_system{"QZ"};
82 constexpr const talker radar{"RA"};
83 constexpr const talker sounder_depth{"SD"};
84 constexpr const talker electronic_positioning_system{"SN"};
85 constexpr const talker sounder_scanning{"SS"};
86 constexpr const talker turn_rate_indicator{"TI"};
87 constexpr const talker transit_navigation_system{"TR"};
88 constexpr const talker velocity_sensor_doppler{"VD"};
89 constexpr const talker velocity_sensor_water_magnetic{"DM"};
90 constexpr const talker velocity_sensor_water_mechanical{"VW"};
91 constexpr const talker weather_instruments{"WI"};
92 constexpr const talker transducer_temperature{"YC"};
93 constexpr const talker transducer_displacement{"YD"};
94 constexpr const talker transducer_frequency{"YF"};
95 constexpr const talker transducer_level{"YL"};
96 constexpr const talker transducer_pressure{"YP"};
97 constexpr const talker transducer_flow_rate{"YR"};
98 constexpr const talker transducer_tachometer{"YT"};
99 constexpr const talker transducer_volume{"YV"};
100 constexpr const talker transducer{"YX"};
101 constexpr const talker timekeeper_atomic_clock{"ZA"};
102 constexpr const talker timekeeper_chronometer{"ZC"};
103 constexpr const talker timekeeper_quartz{"ZQ"};
104 constexpr const talker timekeeper_radio_update{"ZV"};
106 // AIS
107 constexpr const talker ais_base_station{"AB"};
108 constexpr const talker ais_dependent_base_station{"AD"};
109 constexpr const talker ais_mobile_station{"AI"};
110 constexpr const talker ais_aid_to_navigation_station{"AN"};
111 constexpr const talker ais_receiving_station{"AR"};
112 constexpr const talker ais_limited_base_station{"AS"};
113 constexpr const talker ais_transmitting_station{"AT"};
114 constexpr const talker ais_repeater_ais_station{"AX"};
115 constexpr const talker ais_base_station_obsolete{"BS"};
116 constexpr const talker ais_physical_shore_station{"SA"};
121 #endif