Dev: preparation script added for code coverage.
[marnav.git] / src / marnav / utils / mmsi.hpp
blob71fbc8b3135d1d6691f82ef6680bd22ebd8d5d7e
1 #ifndef __UTILS__MMSI__HPP__
2 #define __UTILS__MMSI__HPP__
4 #include <cstdint>
6 namespace marnav
8 namespace utils
11 /// @brief Represents a MMSI (Maritime Mobile Service Identiy).
12 ///
13 /// @see http://www.navcen.uscg.gov/?pageName=mtMmsi
14 ///
15 /// @note Not all variations and criterias are implemented.
16 ///
17 class mmsi
19 public:
20 using value_type = uint32_t;
22 static constexpr value_type initial_value = 0;
24 mmsi() noexcept {}
26 explicit mmsi(value_type t) noexcept : value(t) {}
28 mmsi(const mmsi &) = default;
29 mmsi(mmsi &&) noexcept = default;
30 mmsi & operator=(const mmsi &) = default;
31 mmsi & operator=(mmsi &&) noexcept = default;
33 bool operator==(const mmsi & other) const;
34 bool operator!=(const mmsi & other) const;
36 operator value_type() const { return value; }
38 value_type regular_mid() const;
39 value_type regular_id() const;
40 value_type group_mid() const;
41 value_type group_id() const;
42 value_type coastal_mid() const;
43 value_type coastal_id() const;
44 value_type auxiliary_mid() const;
45 value_type auxiliary_id() const;
46 value_type mob_mid() const;
47 value_type mob_id() const;
49 bool is_regular() const;
50 bool is_group() const;
51 bool is_coastal() const;
52 bool is_all_coastal_for(value_type mid) const;
53 bool is_all_coastal() const;
54 bool is_auxiliary() const;
55 bool is_ais_aids() const;
56 bool is_sar_aircraft() const;
57 bool is_sart() const;
58 bool is_mob() const;
59 bool is_epirb_ais() const;
61 private:
62 value_type value = initial_value;
67 #endif