ad_rss
SituationSnapshotValidInputRange.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::situation::SituationSnapshot 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.situations, logErrors);
45  if (!inValidInputRange && logErrors)
46  {
47  spdlog::error("withinValidInputRange(::ad::rss::situation::SituationSnapshot)>> {} 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("withinValidInputRange(::ad::rss::situation::SituationSnapshot)>> {} element {} out of valid input "
58  "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
SituationSnapshot.hpp
SituationVectorValidInputRange.hpp
ad::rss::situation::SituationSnapshot
DataType SituationSnapshot.
Definition: SituationSnapshot.hpp:45
RssDynamicsValidInputRange.hpp
ad::rss::situation::SituationSnapshot::timeIndex
::ad::rss::world::TimeIndex timeIndex
Definition: SituationSnapshot.hpp:124
withinValidInputRange
bool withinValidInputRange(::ad::rss::situation::SituationSnapshot const &input, bool const logErrors=true)
check if the given SituationSnapshot is within valid input range
Definition: SituationSnapshotValidInputRange.hpp:39
ad::rss::situation::SituationSnapshot::situations
::ad::rss::situation::SituationVector situations
Definition: SituationSnapshot.hpp:137
ad::rss::situation::SituationSnapshot::defaultEgoVehicleRssDynamics
::ad::rss::world::RssDynamics defaultEgoVehicleRssDynamics
Definition: SituationSnapshot.hpp:132