ad_rss
ProperResponseValidInputRange.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: LGPL-2.1-only
7  *
8  * ----------------- END LICENSE BLOCK -----------------------------------
9  */
10 
18 #pragma once
19 
20 #include <cmath>
21 #include <limits>
29 #include "spdlog/fmt/ostr.h"
30 #include "spdlog/spdlog.h"
31 
43 inline bool withinValidInputRange(::ad::rss::state::ProperResponse const &input, bool const logErrors = true)
44 {
45  // check for generic member input ranges
46  bool inValidInputRange = true;
47  inValidInputRange = withinValidInputRange(input.dangerousObjects, logErrors)
48  && withinValidInputRange(input.longitudinalResponse, logErrors)
49  && withinValidInputRange(input.lateralResponseRight, logErrors)
50  && withinValidInputRange(input.lateralResponseLeft, logErrors)
51  && withinValidInputRange(input.headingRanges, logErrors)
54  if (!inValidInputRange && logErrors)
55  {
56  spdlog::error("withinValidInputRange(::ad::rss::state::ProperResponse)>> {} has invalid member",
57  input); // LCOV_EXCL_BR_LINE
58  }
59 
60  // check for individual input ranges
61  if (inValidInputRange)
62  {
63  inValidInputRange = (::ad::rss::world::TimeIndex(1) <= input.timeIndex);
64  if (!inValidInputRange && logErrors)
65  {
66  spdlog::error(
67  "withinValidInputRange(::ad::rss::state::ProperResponse)>> {} element {} out of valid input range [{}, {}]",
68  input,
69  input.timeIndex,
71  "Undefined"); // LCOV_EXCL_BR_LINE
72  }
73  }
74 
75  return inValidInputRange;
76 }
AccelerationRestrictionValidInputRange.hpp
ad::rss::world::TimeIndex
uint64_t TimeIndex
DataType TimeIndex.
Definition: TimeIndex.hpp:39
LongitudinalResponseValidInputRange.hpp
HeadingRangeVectorValidInputRange.hpp
ad::rss::state::ProperResponse::lateralResponseLeft
::ad::rss::state::LateralResponse lateralResponseLeft
Definition: ProperResponse.hpp:158
ad::rss::state::ProperResponse::headingRanges
::ad::rss::state::HeadingRangeVector headingRanges
Definition: ProperResponse.hpp:164
ad::rss::state::ProperResponse::lateralResponseRight
::ad::rss::state::LateralResponse lateralResponseRight
Definition: ProperResponse.hpp:153
withinValidInputRange
bool withinValidInputRange(::ad::rss::state::ProperResponse const &input, bool const logErrors=true)
check if the given ProperResponse is within valid input range
Definition: ProperResponseValidInputRange.hpp:43
ProperResponse.hpp
ad::rss::state::ProperResponse::timeIndex
::ad::rss::world::TimeIndex timeIndex
Definition: ProperResponse.hpp:133
LateralResponseValidInputRange.hpp
ad::rss::state::ProperResponse::longitudinalResponse
::ad::rss::state::LongitudinalResponse longitudinalResponse
Definition: ProperResponse.hpp:148
ad::rss::state::ProperResponse::unstructuredSceneResponse
::ad::rss::state::UnstructuredSceneResponse unstructuredSceneResponse
Definition: ProperResponse.hpp:174
ad::rss::state::ProperResponse::accelerationRestrictions
::ad::rss::state::AccelerationRestriction accelerationRestrictions
Definition: ProperResponse.hpp:169
ObjectIdVectorValidInputRange.hpp
ad::rss::state::ProperResponse
DataType ProperResponse.
Definition: ProperResponse.hpp:50
UnstructuredSceneResponseValidInputRange.hpp
ad::rss::state::ProperResponse::dangerousObjects
::ad::rss::world::ObjectIdVector dangerousObjects
Definition: ProperResponse.hpp:143