ad_rss
RssStateSnapshotValidInputRange.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>
25 #include "spdlog/fmt/ostr.h"
26 #include "spdlog/spdlog.h"
27 
39 inline bool withinValidInputRange(::ad::rss::state::RssStateSnapshot const &input, bool const logErrors = true)
40 {
41  // check for generic member input ranges
42  bool inValidInputRange = true;
43  inValidInputRange = withinValidInputRange(input.defaultEgoVehicleRssDynamics, logErrors)
44  && withinValidInputRange(input.individualResponses, logErrors);
45  if (!inValidInputRange && logErrors)
46  {
47  spdlog::error("withinValidInputRange(::ad::rss::state::RssStateSnapshot)>> {} has invalid member",
48  input); // LCOV_EXCL_BR_LINE
49  }
50 
51  // check for individual input ranges
52  if (inValidInputRange)
53  {
54  inValidInputRange = (::ad::rss::world::TimeIndex(1) <= input.timeIndex);
55  if (!inValidInputRange && logErrors)
56  {
57  spdlog::error(
58  "withinValidInputRange(::ad::rss::state::RssStateSnapshot)>> {} element {} out of valid input range [{}, {}]",
59  input,
60  input.timeIndex,
62  "Undefined"); // LCOV_EXCL_BR_LINE
63  }
64  }
65 
66  return inValidInputRange;
67 }
ad::rss::world::TimeIndex
uint64_t TimeIndex
DataType TimeIndex.
Definition: TimeIndex.hpp:39
RssStateSnapshot.hpp
ad::rss::state::RssStateSnapshot::individualResponses
::ad::rss::state::RssStateVector individualResponses
Definition: RssStateSnapshot.hpp:140
RssDynamicsValidInputRange.hpp
withinValidInputRange
bool withinValidInputRange(::ad::rss::state::RssStateSnapshot const &input, bool const logErrors=true)
check if the given RssStateSnapshot is within valid input range
Definition: RssStateSnapshotValidInputRange.hpp:39
ad::rss::state::RssStateSnapshot::defaultEgoVehicleRssDynamics
::ad::rss::world::RssDynamics defaultEgoVehicleRssDynamics
Definition: RssStateSnapshot.hpp:135
ad::rss::state::RssStateSnapshot::timeIndex
::ad::rss::world::TimeIndex timeIndex
Definition: RssStateSnapshot.hpp:127
RssStateVectorValidInputRange.hpp
ad::rss::state::RssStateSnapshot
DataType RssStateSnapshot.
Definition: RssStateSnapshot.hpp:46