General: standard compliance with underscores
[marnav.git] / include / marnav / ais / rate_of_turn.hpp
blob24e00419218aeaf10a015203ac10d5cd5d597e51
1 #ifndef MARNAV_AIS_RATE_OF_TURN_HPP
2 #define MARNAV_AIS_RATE_OF_TURN_HPP
4 #include <cstdint>
6 namespace marnav
8 namespace ais
10 class rate_of_turn
12 public:
13 using value_type = int8_t;
15 enum : value_type {
16 not_turning = 0,
17 more_5deg_per_30s_abs = 127,
18 more_5deg_per_30s_right = +more_5deg_per_30s_abs,
19 more_5deg_per_30s_left = -more_5deg_per_30s_abs,
20 no_information_available = -128
23 rate_of_turn() = default;
25 rate_of_turn(const rate_of_turn &) = default;
26 rate_of_turn & operator=(const rate_of_turn &) = default;
28 rate_of_turn(rate_of_turn &&) = default;
29 rate_of_turn & operator=(rate_of_turn &&) = default;
31 explicit rate_of_turn(double deg_per_minute);
33 explicit rate_of_turn(value_type raw_value)
34 : value_(raw_value)
38 double value() const;
40 value_type raw() const noexcept { return value_; }
42 operator double() const { return value(); }
44 bool available() const noexcept { return value_ != no_information_available; }
45 bool is_not_turning() const noexcept { return value_ == not_turning; }
46 bool is_more_5deg30s_right() const noexcept { return value_ == more_5deg_per_30s_right; }
47 bool is_more_5deg30s_left() const noexcept { return value_ == more_5deg_per_30s_left; }
49 private:
50 value_type value_ = no_information_available;
55 #endif