ad_physics
generated
include
ad
physics
SpeedValidInputRange.hpp
Go to the documentation of this file.
1
/*
2
* ----------------- BEGIN LICENSE BLOCK ---------------------------------
3
*
4
* Copyright (C) 2018-2020 Intel Corporation
5
*
6
* SPDX-License-Identifier: MIT
7
*
8
* ----------------- END LICENSE BLOCK -----------------------------------
9
*/
10
18
#pragma once
19
20
#include <cmath>
21
#include <limits>
22
#include "
ad/physics/Speed.hpp
"
23
#include "spdlog/fmt/ostr.h"
24
#include "spdlog/spdlog.h"
25
39
inline
bool
withinValidInputRange
(::
ad::physics::Speed
const
&input,
bool
const
logErrors =
true
)
40
{
41
// check for generic numeric limits of the type
42
bool
inValidInputRange = input.
isValid
() && (
std::numeric_limits<::ad::physics::Speed>::lowest
() <= input)
43
&& (input <=
std::numeric_limits<::ad::physics::Speed>::max
());
44
if
(!inValidInputRange && logErrors)
45
{
46
spdlog::error(
"withinValidInputRange(::ad::physics::Speed)>> {} out of numerical limits [{}, {}]"
,
47
input,
48
std::numeric_limits<::ad::physics::Speed>::lowest
(),
49
std::numeric_limits<::ad::physics::Speed>::max
());
// LCOV_EXCL_BR_LINE
50
}
51
// check for individual input range
52
if
(inValidInputRange)
53
{
54
inValidInputRange = (
::ad::physics::Speed
(-100.) <= input) && (input <= ::
ad::physics::Speed
(100.));
55
if
(!inValidInputRange && logErrors)
56
{
57
spdlog::error(
"withinValidInputRange(::ad::physics::Speed)>> {} out of valid input range [{}, {}]"
,
58
input,
59
::
ad::physics::Speed
(-100.),
60
::
ad::physics::Speed
(100.));
// LCOV_EXCL_BR_LINE
61
}
62
}
63
return
inValidInputRange;
64
}
Speed.hpp
std::numeric_limits<::ad::physics::Speed >::max
static inline ::ad::physics::Speed max()
Definition:
Speed.hpp:529
ad::physics::Speed
DataType Speed.
Definition:
Speed.hpp:68
ad::physics::Speed::isValid
bool isValid() const
Definition:
Speed.hpp:404
std::numeric_limits<::ad::physics::Speed >::lowest
static inline ::ad::physics::Speed lowest()
Definition:
Speed.hpp:522
withinValidInputRange
bool withinValidInputRange(::ad::physics::Speed const &input, bool const logErrors=true)
check if the given Speed is within valid input range
Definition:
SpeedValidInputRange.hpp:39
Generated by
1.8.17