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
psen_scan_v2_standalone::util::TenthOfDegree::TenthOfDegree
constexpr TenthOfDegree(const int16_t &tenth_of_degree)
Definition: tenth_of_degree.h:45
psen_scan_v2_standalone::util::TenthOfDegree::operator+
constexpr TenthOfDegree & operator+(const TenthOfDegree &rhs)
Definition: tenth_of_degree.h:108
psen_scan_v2_standalone::util::TenthOfDegree::operator/
constexpr TenthOfDegree operator/(const TenthOfDegree &rhs) const
Definition: tenth_of_degree.h:98
psen_scan_v2_standalone::util::TenthOfDegree::operator*
constexpr TenthOfDegree operator*(const size_t &rhs) const
Definition: tenth_of_degree.h:70
psen_scan_v2_standalone::util::TenthOfDegree::operator/
constexpr TenthOfDegree operator/(const int &rhs) const
Definition: tenth_of_degree.h:87
psen_scan_v2_standalone::data_conversion_layer::radToTenthDegree
static int16_t radToTenthDegree(const double &angle_in_rad)
Definition: angle_conversions.h:51
psen_scan_v2_standalone::util::TenthOfDegree::operator*
constexpr TenthOfDegree & operator*(const TenthOfDegree &rhs)
Definition: tenth_of_degree.h:59
psen_scan_v2_standalone::util::TenthOfDegree::fromRad
static TenthOfDegree fromRad(const double &angle_in_rad)
Definition: tenth_of_degree.h:37
psen_scan_v2_standalone::util::TenthOfDegree::operator>=
constexpr bool operator>=(const TenthOfDegree &rhs) const
Definition: tenth_of_degree.h:141
psen_scan_v2_standalone::util::TenthOfDegree::operator+
constexpr TenthOfDegree operator+(const TenthOfDegree &rhs) const
Definition: tenth_of_degree.h:103
psen_scan_v2_standalone::util::TenthOfDegree::operator*
constexpr TenthOfDegree operator*(const int &rhs) const
Definition: tenth_of_degree.h:65
psen_scan_v2_standalone::util::TenthOfDegree::value
constexpr int16_t value() const
Definition: tenth_of_degree.h:49
psen_scan_v2_standalone::util::TenthOfDegree::operator/
constexpr TenthOfDegree & operator/(const int &rhs)
Definition: tenth_of_degree.h:92
psen_scan_v2_standalone::util::TenthOfDegree::operator<
constexpr bool operator<(const TenthOfDegree &rhs) const
Definition: tenth_of_degree.h:156
psen_scan_v2_standalone::util::TenthOfDegree::operator!=
constexpr bool operator!=(const TenthOfDegree &rhs) const
Definition: tenth_of_degree.h:136
psen_scan_v2_standalone::util::TenthOfDegree::operator-
constexpr TenthOfDegree operator-(const TenthOfDegree &rhs) const
Definition: tenth_of_degree.h:120
psen_scan_v2_standalone::util::TenthOfDegree::operator-
TenthOfDegree & operator-(const TenthOfDegree &rhs)
Definition: tenth_of_degree.h:125
psen_scan_v2_standalone::util::TenthOfDegree::operator>
constexpr bool operator>(const TenthOfDegree &rhs) const
Definition: tenth_of_degree.h:151
psen_scan_v2_standalone::util::TenthOfDegree::operator*
constexpr TenthOfDegree & operator*(const int &rhs)
Definition: tenth_of_degree.h:75
psen_scan_v2_standalone::util::TenthOfDegree::operator*
constexpr TenthOfDegree & operator*(const size_t &rhs)
Definition: tenth_of_degree.h:81
psen_scan_v2_standalone::util::TenthOfDegree::toRad
constexpr double toRad() const
Definition: tenth_of_degree.h:54
psen_scan_v2_standalone
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition: udp_client.h:41
psen_scan_v2_standalone::util::TenthOfDegree::operator==
constexpr bool operator==(const TenthOfDegree &rhs) const
Definition: tenth_of_degree.h:131
psen_scan_v2_standalone::util::TenthOfDegree::operator<=
constexpr bool operator<=(const TenthOfDegree &rhs) const
Definition: tenth_of_degree.h:146
psen_scan_v2_standalone::util::TenthOfDegree::operator+=
constexpr TenthOfDegree & operator+=(const TenthOfDegree &rhs)
Definition: tenth_of_degree.h:114
psen_scan_v2_standalone::util::TenthOfDegree::tenth_of_degree_
int16_t tenth_of_degree_
Definition: tenth_of_degree.h:162
psen_scan_v2_standalone::data_conversion_layer::tenthDegreeToRad
static constexpr double tenthDegreeToRad(const int16_t &angle_in_tenth_degree)
Definition: angle_conversions.h:56
angle_conversions.h
psen_scan_v2_standalone::util::TenthOfDegree
Helper class representing angles in tenth of degree.
Definition: tenth_of_degree.h:34
psen_scan_v2_standalone::util::TenthOfDegree::TenthOfDegree
constexpr TenthOfDegree()=default


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Jun 22 2024 02:46:12