8 bool mmsi::operator==(const mmsi
& other
) const
10 // not comparing (this == &other) because the comparison
11 // of the value is trivial.
12 return value
== other
.value
;
15 bool mmsi::operator!=(const mmsi
& other
) const
17 return !(*this == other
);
20 mmsi::value_type
mmsi::regular_mid() const
24 return (value
/ 1000000) % 1000;
27 mmsi::value_type
mmsi::regular_id() const
31 return value
% 1000000;
34 mmsi::value_type
mmsi::group_mid() const
38 return (value
/ 100000) % 1000;
41 mmsi::value_type
mmsi::group_id() const
45 return value
% 100000;
48 mmsi::value_type
mmsi::coastal_mid() const
52 return (value
/ 10000) % 1000;
55 mmsi::value_type
mmsi::coastal_id() const
62 mmsi::value_type
mmsi::auxiliary_mid() const
66 return (value
/ 10000) % 1000;
69 mmsi::value_type
mmsi::auxiliary_id() const
76 mmsi::value_type
mmsi::mob_mid() const
80 return (value
/ 1000) % 1000;
83 mmsi::value_type
mmsi::mob_id() const
91 bool mmsi::is_regular() const
93 const value_type m
= (value
/ 1000000) % 1000;
94 return (m
>= 200) && (m
< 900);
98 bool mmsi::is_group() const
100 const value_type p
= value
/ 100000000;
101 const value_type m
= (value
/ 100000) % 1000;
102 return (p
== 0) && (m
>= 100) && !is_auxiliary() && !is_ais_aids();
105 /// True if 00MIDxxxx
106 bool mmsi::is_coastal() const
108 const value_type p
= value
/ 10000000;
112 /// True if 00MID0000 and same MID.
113 bool mmsi::is_all_coastal_for(value_type mid
) const
115 const value_type p
= value
/ 10000000;
116 const value_type m
= (value
/ 10000) % 1000;
117 const value_type i
= value
% 10000;
118 return (p
== 0) && (m
== mid
) && (mid
>= 100) && (i
== 0);
121 /// True if 009990000
122 bool mmsi::is_all_coastal() const
124 const value_type p
= value
/ 10000000;
125 const value_type m
= (value
/ 10000) % 1000;
126 const value_type i
= value
% 10000;
127 return (p
== 0) && (m
== 999) && (i
== 0);
130 /// True if 98MIDxxxx
131 bool mmsi::is_auxiliary() const
133 const value_type p
= value
/ 10000000;
137 /// True if 99MIDxxxx
138 bool mmsi::is_ais_aids() const
140 const value_type p
= value
/ 10000000;
144 /// True if 111MIDxxx
145 bool mmsi::is_sar_aircraft() const
147 const value_type p
= (value
/ 1000000) % 1000;
151 /// True if 970MIDxxx
152 bool mmsi::is_sart() const
154 const value_type p
= (value
/ 1000000) % 1000;
158 /// True if 972MIDxxx
159 bool mmsi::is_mob() const
161 const value_type p
= (value
/ 1000000) % 1000;
165 /// True if 974MIDxxx
166 bool mmsi::is_epirb_ais() const
168 const value_type p
= (value
/ 1000000) % 1000;