ad_rss
RelativePositionValidInputRange.hpp
Go to the documentation of this file.
1 /*
2  * ----------------- BEGIN LICENSE BLOCK ---------------------------------
3  *
4  * Copyright (C) 2018-2022 Intel Corporation
5  *
6  * SPDX-License-Identifier: LGPL-2.1-only
7  *
8  * ----------------- END LICENSE BLOCK -----------------------------------
9  */
10 
18 #pragma once
19 
20 #include <cmath>
21 #include <limits>
22 #include "ad/physics/DistanceValidInputRange.hpp"
26 #include "spdlog/fmt/ostr.h"
27 #include "spdlog/spdlog.h"
28 
39 inline bool withinValidInputRange(::ad::rss::core::RelativePosition const &input, bool const logErrors = true)
40 {
41  // check for generic member input ranges
42  bool inValidInputRange = true;
43  inValidInputRange = withinValidInputRange(input.longitudinal_position, logErrors)
44  && withinValidInputRange(input.longitudinal_distance, logErrors)
45  && withinValidInputRange(input.lateral_position, logErrors)
46  && withinValidInputRange(input.lateral_distance, logErrors);
47  if (!inValidInputRange && logErrors)
48  {
49  spdlog::error("withinValidInputRange(::ad::rss::core::RelativePosition)>> {} has invalid member",
50  input); // LCOV_EXCL_BR_LINE
51  }
52 
53  return inValidInputRange;
54 }
bool withinValidInputRange(::ad::rss::core::RelativePosition const &input, bool const logErrors=true)
check if the given RelativePosition is within valid input range
Definition: RelativePositionValidInputRange.hpp:39
DataType RelativePosition.
Definition: RelativePosition.hpp:46
::ad::physics::Distance lateral_distance
Definition: RelativePosition.hpp:140
::ad::physics::Distance longitudinal_distance
Definition: RelativePosition.hpp:130
::ad::rss::core::LateralRelativePosition lateral_position
Definition: RelativePosition.hpp:135
::ad::rss::core::LongitudinalRelativePosition longitudinal_position
Definition: RelativePosition.hpp:124