@@ -43,24 +43,31 @@ class Duration;
43
43
namespace duration_literals
44
44
{
45
45
// / @brief Constructs a new Duration object from nanoseconds
46
+ // AXIVION Next Line AutosarC++19_03-A3.9.1 : Use of unsigned long long int in user-defined literals is enforced by the standard
46
47
constexpr Duration operator " " _ns(unsigned long long int value) noexcept ;
47
48
48
49
// / @brief Constructs a new Duration object from microseconds
50
+ // AXIVION Next Line AutosarC++19_03-A3.9.1 : Use of unsigned long long int in user-defined literals is enforced by the standard
49
51
constexpr Duration operator " " _us(unsigned long long int value) noexcept ;
50
52
51
53
// / @brief Constructs a new Duration object from milliseconds
54
+ // AXIVION Next Line AutosarC++19_03-A3.9.1 : Use of unsigned long long int in user-defined literals is enforced by the standard
52
55
constexpr Duration operator " " _ms(unsigned long long int value) noexcept ;
53
56
54
57
// / @brief Constructs a new Duration object from seconds
58
+ // AXIVION Next Line AutosarC++19_03-A3.9.1 : Use of unsigned long long int in user-defined literals is enforced by the standard
55
59
constexpr Duration operator " " _s(unsigned long long int value) noexcept ;
56
60
57
61
// / @brief Constructs a new Duration object from minutes
62
+ // AXIVION Next Line AutosarC++19_03-A3.9.1 : Use of unsigned long long int in user-defined literals is enforced by the standard
58
63
constexpr Duration operator " " _m(unsigned long long int value) noexcept ;
59
64
60
65
// / @brief Constructs a new Duration object from hours
66
+ // AXIVION Next Line AutosarC++19_03-A3.9.1 : Use of unsigned long long int in user-defined literals is enforced by the standard
61
67
constexpr Duration operator " " _h(unsigned long long int value) noexcept ;
62
68
63
69
// / @brief Constructs a new Duration object from days
70
+ // AXIVION Next Line AutosarC++19_03-A3.9.1 : Use of unsigned long long int in user-defined literals is enforced by the standard
64
71
constexpr Duration operator " " _d(unsigned long long int value) noexcept ;
65
72
} // namespace duration_literals
66
73
@@ -148,67 +155,47 @@ class Duration
148
155
149
156
// / @brief Construct a Duration object from timeval
150
157
// / @param[in] value as timeval
158
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Argument is larger than two words
151
159
constexpr explicit Duration (const struct timeval & value) noexcept ;
152
160
153
161
// / @brief Construct a Duration object from timespec
154
162
// / @param[in] value as timespec
163
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Argument is larger than two words
155
164
constexpr explicit Duration (const struct timespec & value) noexcept ;
156
165
157
166
// / @brief Construct a Duration object from itimerspec
158
167
// / @param[in] value as itimerspec
159
168
// / @note only it_interval from the itimerspec is used
169
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Argument is larger than two words
160
170
constexpr explicit Duration (const struct itimerspec & value) noexcept ;
161
171
162
172
// / @brief Construct a Duration object from std::chrono::milliseconds
163
173
// / @param[in] value as milliseconds
164
174
// / @attention Since negative durations are not allowed, the duration will be clamped to 0
165
- constexpr explicit Duration (const std::chrono::milliseconds& value) noexcept ;
175
+ constexpr explicit Duration (const std::chrono::milliseconds value) noexcept ;
166
176
167
177
// / @brief Construct a Duration object from std::chrono::nanoseconds
168
178
// / @param[in] value as nanoseconds
169
179
// / @attention Since negative durations are not allowed, the duration will be clamped to 0
170
- constexpr explicit Duration (const std::chrono::nanoseconds& value) noexcept ;
180
+ constexpr explicit Duration (const std::chrono::nanoseconds value) noexcept ;
171
181
172
182
// / @brief Assigns a std::chrono::milliseconds to an duration object
173
183
// / @param[in] rhs is the right hand side of the assignment
174
184
// / @return a reference to the Duration object with the assigned millisecond value
175
185
// / @attention Since negative durations are not allowed, the duration will be clamped to 0
176
- Duration & operator =(const std::chrono::milliseconds& rhs) noexcept ;
186
+ Duration & operator =(const std::chrono::milliseconds rhs) noexcept ;
177
187
178
188
// END CONSTRUCTORS AND ASSIGNMENT
179
189
180
190
// BEGIN COMPARISON
181
-
182
- // / @brief Equal to operator
183
- // / @param[in] rhs is the right hand side of the comparison
184
- // / @return true if duration equal to rhs
185
- constexpr bool operator ==(const Duration & rhs) const noexcept ;
186
-
187
- // / @brief Not equal to operator
188
- // / @param[in] rhs is the right hand side of the comparison
189
- // / @return true if duration not equal to rhs
190
- constexpr bool operator !=(const Duration & rhs) const noexcept ;
191
-
192
- // / @brief Less than operator
193
- // / @param[in] rhs is the right hand side of the comparison
194
- // / @return true if duration is less than rhs
195
- constexpr bool operator <(const Duration & rhs) const noexcept ;
196
-
197
- // / @brief Less than or equal to operator
198
- // / @param[in] rhs is the right hand side of the comparison
199
- // / @return true if duration is less than or equal to rhs
200
- constexpr bool operator <=(const Duration & rhs) const noexcept ;
201
-
202
- // / @brief Greater than operator
203
- // / @param[in] rhs is the right hand side of the comparison
204
- // / @return true if duration is greater than rhs
205
- constexpr bool operator >(const Duration & rhs) const noexcept ;
206
-
207
- // / @brief Greater than or equal to operator
208
- // / @param[in] rhs is the right hand side of the comparison
209
- // / @return true if duration is greater than or equal to rhs
210
- constexpr bool operator >=(const Duration & rhs) const noexcept ;
211
-
191
+ // AXIVION DISABLE STYLE AutosarC++19_03-A8.4.7 : Each argument is larger than two words
192
+ friend constexpr bool operator ==(const Duration & lhs, const Duration & rhs) noexcept ;
193
+ friend constexpr bool operator !=(const Duration & lhs, const Duration & rhs) noexcept ;
194
+ friend constexpr bool operator <(const Duration & lhs, const Duration & rhs) noexcept ;
195
+ friend constexpr bool operator <=(const Duration & lhs, const Duration & rhs) noexcept ;
196
+ friend constexpr bool operator >(const Duration & lhs, const Duration & rhs) noexcept ;
197
+ friend constexpr bool operator >=(const Duration & lhs, const Duration & rhs) noexcept ;
198
+ // AXIVION ENABLE STYLE AutosarC++19_03-A8.4.7
212
199
// END COMPARISON
213
200
214
201
// BEGIN ARITHMETIC
@@ -217,15 +204,32 @@ class Duration
217
204
// / saturates to Duration::max().
218
205
// / @param[in] rhs is the second summand
219
206
// / @return a new Duration object
207
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Argument is larger than two words
220
208
constexpr Duration operator +(const Duration & rhs) const noexcept ;
221
209
210
+ // / @brief Creates Duration object by addition. On overflow duration
211
+ // / saturates to Duration::max().
212
+ // / @param[in] rhs is the second summand
213
+ // / @return a new Duration object
214
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Argument is larger than two words
215
+ constexpr Duration & operator +=(const Duration & rhs) noexcept ;
216
+
222
217
// / @brief Creates Duration object by subtraction. On underflow duration
223
218
// / saturates to Duration::zero().
224
219
// / @param[in] rhs is the subtrahend
225
220
// / @return a new Duration object
226
221
// / @attention Since negative durations are not allowed, the duration will be clamped to 0
222
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Each argument is larger than two words
227
223
constexpr Duration operator -(const Duration & rhs) const noexcept ;
228
224
225
+ // / @brief Creates Duration object by subtraction. On underflow duration
226
+ // / saturates to Duration::zero().
227
+ // / @param[in] rhs is the subtrahend
228
+ // / @return a new Duration object
229
+ // / @attention Since negative durations are not allowed, the duration will be clamped to 0
230
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Argument is larger than two words
231
+ constexpr Duration & operator -=(const Duration & rhs) noexcept ;
232
+
229
233
// / @brief Creates Duration object by multiplication.
230
234
// / @tparam T is an arithmetic type for the multiplicator
231
235
// / @param[in] rhs is the multiplicator
@@ -276,7 +280,7 @@ class Duration
276
280
constexpr uint64_t toDays () const noexcept ;
277
281
278
282
// / @brief converts duration in a timespec c struct
279
- struct timespec timespec (const TimeSpecReference& reference = TimeSpecReference::None) const noexcept ;
283
+ struct timespec timespec (const TimeSpecReference reference = TimeSpecReference::None) const noexcept ;
280
284
281
285
// / @brief converts duration in a timeval c struct
282
286
// / timeval::tv_sec = seconds since the Epoch (01.01.1970)
@@ -285,17 +289,21 @@ class Duration
285
289
286
290
// END CONVERSION
287
291
292
+ // AXIVION DISABLE STYLE AutosarC++19_03-A3.9.1 : Use of unsigned long long int in user-defined literals is enforced by the standard
288
293
friend constexpr Duration duration_literals::operator " " _ns(unsigned long long int value) noexcept ;
289
294
friend constexpr Duration duration_literals::operator " " _us(unsigned long long int value) noexcept ;
290
295
friend constexpr Duration duration_literals::operator " " _ms(unsigned long long int value) noexcept ;
291
296
friend constexpr Duration duration_literals::operator " " _s(unsigned long long int value) noexcept ;
292
297
friend constexpr Duration duration_literals::operator " " _m(unsigned long long int value) noexcept ;
293
298
friend constexpr Duration duration_literals::operator " " _h(unsigned long long int value) noexcept ;
294
299
friend constexpr Duration duration_literals::operator " " _d(unsigned long long int value) noexcept ;
300
+ // AXIVION ENABLE STYLE AutosarC++19_03-A3.9.1
295
301
302
+ // AXIVION Next Construct AutosarC++19_03-A8.4.7 : Argument is larger than two words
296
303
template <typename T>
297
304
friend constexpr Duration operator *(const T& lhs, const Duration & rhs) noexcept ;
298
305
306
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Argument is larger than two words
299
307
friend std::ostream& operator <<(std::ostream& stream, const Duration & t) noexcept ;
300
308
friend iox::log::LogStream& operator <<(iox::log::LogStream& stream, const Duration t) noexcept ;
301
309
@@ -326,7 +334,7 @@ class Duration
326
334
327
335
private:
328
336
template <typename T>
329
- static constexpr unsigned long long int positiveValueOrClampToZero (const T value) noexcept ;
337
+ static constexpr uint64_t positiveValueOrClampToZero (const T value) noexcept ;
330
338
331
339
template <typename T>
332
340
constexpr Duration fromFloatingPointSeconds (const T floatingPointSeconds) const noexcept ;
@@ -351,12 +359,56 @@ class Duration
351
359
// / @param[in] rhs is the multiplicant
352
360
// / @return a new Duration object
353
361
// / @attention Since negative durations are not allowed, the duration will be clamped to 0
362
+ // AXIVION Next Construct AutosarC++19_03-A8.4.7 : Each argument is larger than two words
354
363
template <typename T>
355
364
constexpr Duration operator *(const T& lhs, const Duration & rhs) noexcept ;
356
365
357
366
// / @brief stream operator for the Duration class
367
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Argument is larger than two words
358
368
std::ostream& operator <<(std::ostream& stream, const Duration & t) noexcept ;
359
369
370
+ // / @brief Equal to operator
371
+ // / @param[in] lhs is the left hand side of the comparison
372
+ // / @param[in] rhs is the right hand side of the comparison
373
+ // / @return true if duration equal to rhs
374
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Each argument is larger than two words
375
+ constexpr bool operator ==(const Duration & lhs, const Duration & rhs) noexcept ;
376
+
377
+ // / @brief Not equal to operator
378
+ // / @param[in] lhs is the left hand side of the comparison
379
+ // / @param[in] rhs is the right hand side of the comparison
380
+ // / @return true if duration not equal to rhs
381
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Each argument is larger than two words
382
+ constexpr bool operator !=(const Duration & lhs, const Duration & rhs) noexcept ;
383
+
384
+ // / @brief Less than operator
385
+ // / @param[in] lhs is the left hand side of the comparison
386
+ // / @param[in] rhs is the right hand side of the comparison
387
+ // / @return true if duration is less than rhs
388
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Each argument is larger than two words
389
+ constexpr bool operator <(const Duration & lhs, const Duration & rhs) noexcept ;
390
+
391
+ // / @brief Greater than operator
392
+ // / @param[in] lhs is the left hand side of the comparison
393
+ // / @param[in] rhs is the right hand side of the comparison
394
+ // / @return true if duration is greater than rhs
395
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Each argument is larger than two words
396
+ constexpr bool operator >(const Duration & lhs, const Duration & rhs) noexcept ;
397
+
398
+ // / @brief Less than or equal to operator
399
+ // / @param[in] lhs is the left hand side of the comparison
400
+ // / @param[in] rhs is the right hand side of the comparison
401
+ // / @return true if duration is less than or equal to rhs
402
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Each argument is larger than two words
403
+ constexpr bool operator <=(const Duration & lhs, const Duration & rhs) noexcept ;
404
+
405
+ // / @brief Greater than or equal to operator
406
+ // / @param[in] lhs is the left hand side of the comparison
407
+ // / @param[in] rhs is the right hand side of the comparison
408
+ // / @return true if duration is greater than or equal to rhs
409
+ // AXIVION Next Line AutosarC++19_03-A8.4.7 : Each argument is larger than two words
410
+ constexpr bool operator >=(const Duration & lhs, const Duration & rhs) noexcept ;
411
+
360
412
} // namespace units
361
413
} // namespace iox
362
414
0 commit comments