ad_rss
RssStateSnapshotValidInputRange.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>
26 #include "spdlog/fmt/ostr.h"
27 #include "spdlog/spdlog.h"
28 
40 inline bool withinValidInputRange(::ad::rss::state::RssStateSnapshot const &input, bool const logErrors = true)
41 {
42  // check for generic member input ranges
43  bool inValidInputRange = true;
44  inValidInputRange = withinValidInputRange(input.default_ego_vehicle_rss_dynamics, logErrors)
45  && withinValidInputRange(input.individual_responses, logErrors)
47  if (!inValidInputRange && logErrors)
48  {
49  spdlog::error("withinValidInputRange(::ad::rss::state::RssStateSnapshot)>> {} has invalid member",
50  input); // LCOV_EXCL_BR_LINE
51  }
52 
53  // check for individual input ranges
54  if (inValidInputRange)
55  {
56  inValidInputRange = (::ad::rss::world::TimeIndex(1) <= input.time_index);
57  if (!inValidInputRange && logErrors)
58  {
59  spdlog::error(
60  "withinValidInputRange(::ad::rss::state::RssStateSnapshot)>> {} element {} out of valid input range [{}, {}]",
61  input,
62  input.time_index,
64  "Undefined"); // LCOV_EXCL_BR_LINE
65  }
66  }
67 
68  return inValidInputRange;
69 }
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:40
uint64_t TimeIndex
DataType TimeIndex.
Definition: TimeIndex.hpp:39
DataType RssStateSnapshot.
Definition: RssStateSnapshot.hpp:47
::ad::rss::state::UnstructuredConstellationStateInformation unstructured_constellation_ego_information
Definition: RssStateSnapshot.hpp:146
::ad::rss::world::TimeIndex time_index
Definition: RssStateSnapshot.hpp:128
::ad::rss::state::RssStateVector individual_responses
Definition: RssStateSnapshot.hpp:141
::ad::rss::world::RssDynamics default_ego_vehicle_rss_dynamics
Definition: RssStateSnapshot.hpp:136