tenth_of_degree.h
Go to the documentation of this file.
1 // Copyright (c) 2020-2021 Pilz GmbH & Co. KG
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU Lesser General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with this program. If not, see <https://www.gnu.org/licenses/>.
15 
16 #ifndef PSEN_SCAN_V2_STANDALONE_TENTH_OF_DEGREE_H
17 #define PSEN_SCAN_V2_STANDALONE_TENTH_OF_DEGREE_H
18 
20 
22 {
23 namespace util
24 {
35 {
36 public:
37  static TenthOfDegree fromRad(const double& angle_in_rad)
38  {
40  }
41 
42 public:
43  explicit constexpr TenthOfDegree() = default;
44 
45  explicit constexpr TenthOfDegree(const int16_t& tenth_of_degree) : tenth_of_degree_(tenth_of_degree)
46  {
47  }
48 
49  constexpr int16_t value() const
50  {
51  return tenth_of_degree_;
52  }
53 
54  constexpr double toRad() const
55  {
57  }
58 
59  constexpr TenthOfDegree& operator*(const TenthOfDegree& rhs)
60  {
61  tenth_of_degree_ = value() * rhs.value();
62  return *this;
63  }
64 
65  constexpr TenthOfDegree operator*(const int& rhs) const
66  {
67  return TenthOfDegree(value() * rhs);
68  }
69 
70  constexpr TenthOfDegree operator*(const size_t& rhs) const
71  {
72  return TenthOfDegree(value() * rhs);
73  }
74 
75  constexpr TenthOfDegree& operator*(const int& rhs)
76  {
77  tenth_of_degree_ = value() * rhs;
78  return *this;
79  }
80 
81  constexpr TenthOfDegree& operator*(const size_t& rhs)
82  {
83  tenth_of_degree_ = value() * rhs;
84  return *this;
85  }
86 
87  constexpr TenthOfDegree operator/(const int& rhs) const
88  {
89  return TenthOfDegree(value() / rhs);
90  }
91 
92  constexpr TenthOfDegree& operator/(const int& rhs)
93  {
94  tenth_of_degree_ = value() / rhs;
95  return *this;
96  }
97 
98  constexpr TenthOfDegree operator/(const TenthOfDegree& rhs) const
99  {
100  return TenthOfDegree(value() / rhs.value());
101  }
102 
103  constexpr TenthOfDegree operator+(const TenthOfDegree& rhs) const
104  {
105  return TenthOfDegree(value() + rhs.value());
106  }
107 
108  constexpr TenthOfDegree& operator+(const TenthOfDegree& rhs)
109  {
110  tenth_of_degree_ = value() + rhs.value();
111  return *this;
112  }
113 
114  constexpr TenthOfDegree& operator+=(const TenthOfDegree& rhs)
115  {
116  tenth_of_degree_ = value() + rhs.value();
117  return *this;
118  }
119 
120  constexpr TenthOfDegree operator-(const TenthOfDegree& rhs) const
121  {
122  return TenthOfDegree(value() - rhs.value());
123  }
124 
126  {
127  tenth_of_degree_ = value() - rhs.value();
128  return *this;
129  }
130 
131  constexpr bool operator==(const TenthOfDegree& rhs) const
132  {
133  return value() == rhs.value();
134  }
135 
136  constexpr bool operator!=(const TenthOfDegree& rhs) const
137  {
138  return value() != rhs.value();
139  }
140 
141  constexpr bool operator>=(const TenthOfDegree& rhs) const
142  {
143  return value() >= rhs.value();
144  }
145 
146  constexpr bool operator<=(const TenthOfDegree& rhs) const
147  {
148  return value() <= rhs.value();
149  }
150 
151  constexpr bool operator>(const TenthOfDegree& rhs) const
152  {
153  return value() > rhs.value();
154  }
155 
156  constexpr bool operator<(const TenthOfDegree& rhs) const
157  {
158  return value() < rhs.value();
159  }
160 
161 private:
162  int16_t tenth_of_degree_{ 0 };
163 };
164 } // namespace util
165 } // namespace psen_scan_v2_standalone
166 
167 #endif // PSEN_SCAN_V2_STANDALONE_TENTH_OF_DEGREE_H
constexpr TenthOfDegree operator*(const int &rhs) const
constexpr TenthOfDegree & operator*(const int &rhs)
constexpr bool operator>(const TenthOfDegree &rhs) const
constexpr bool operator!=(const TenthOfDegree &rhs) const
constexpr bool operator<=(const TenthOfDegree &rhs) const
static TenthOfDegree fromRad(const double &angle_in_rad)
constexpr TenthOfDegree & operator/(const int &rhs)
constexpr TenthOfDegree & operator+(const TenthOfDegree &rhs)
constexpr bool operator==(const TenthOfDegree &rhs) const
constexpr TenthOfDegree(const int16_t &tenth_of_degree)
constexpr TenthOfDegree operator+(const TenthOfDegree &rhs) const
constexpr TenthOfDegree operator*(const size_t &rhs) const
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition: udp_client.h:41
static double constexpr tenthDegreeToRad(const int16_t &angle_in_tenth_degree)
constexpr TenthOfDegree & operator+=(const TenthOfDegree &rhs)
constexpr bool operator<(const TenthOfDegree &rhs) const
constexpr TenthOfDegree & operator*(const TenthOfDegree &rhs)
constexpr TenthOfDegree & operator*(const size_t &rhs)
constexpr TenthOfDegree operator/(const TenthOfDegree &rhs) const
static int16_t radToTenthDegree(const double &angle_in_rad)
constexpr TenthOfDegree operator-(const TenthOfDegree &rhs) const
TenthOfDegree & operator-(const TenthOfDegree &rhs)
constexpr bool operator>=(const TenthOfDegree &rhs) const
constexpr TenthOfDegree operator/(const int &rhs) const
Helper class representing angles in tenth of degree.


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Nov 5 2022 02:13:36