ad_rss
ProperResponseValidInputRange.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/geometry/HeadingRangeVectorValidInputRange.hpp"
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.dangerous_objects, logErrors)
48  && withinValidInputRange(input.longitudinal_response, logErrors)
50  && withinValidInputRange(input.lateral_response_left, logErrors)
51  && withinValidInputRange(input.heading_ranges, 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.time_index);
64  if (!inValidInputRange && logErrors)
65  {
66  spdlog::error(
67  "withinValidInputRange(::ad::rss::state::ProperResponse)>> {} element {} out of valid input range [{}, {}]",
68  input,
69  input.time_index,
71  "Undefined"); // LCOV_EXCL_BR_LINE
72  }
73  }
74 
75  return inValidInputRange;
76 }
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
uint64_t TimeIndex
DataType TimeIndex.
Definition: TimeIndex.hpp:39
DataType ProperResponse.
Definition: ProperResponse.hpp:50
::ad::rss::state::AccelerationRestriction acceleration_restrictions
Definition: ProperResponse.hpp:170
::ad::rss::state::LongitudinalResponse longitudinal_response
Definition: ProperResponse.hpp:149
::ad::rss::world::TimeIndex time_index
Definition: ProperResponse.hpp:133
::ad::rss::state::LateralResponse lateral_response_right
Definition: ProperResponse.hpp:154
::ad::rss::world::ObjectIdVector dangerous_objects
Definition: ProperResponse.hpp:144
::ad::rss::state::LateralResponse lateral_response_left
Definition: ProperResponse.hpp:159
::ad::geometry::HeadingRangeVector heading_ranges
Definition: ProperResponse.hpp:165
::ad::rss::state::UnstructuredConstellationResponse unstructured_constellation_response
Definition: ProperResponse.hpp:175