ad_rss
WorldModelValidInputRange.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::world::WorldModel 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.scenes, logErrors);
45  if (!inValidInputRange && logErrors)
46  {
47  spdlog::error("withinValidInputRange(::ad::rss::world::WorldModel)>> {} 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::world::WorldModel)>> {} 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
ad::rss::world::WorldModel::scenes
::ad::rss::world::SceneVector scenes
Definition: WorldModel.hpp:139
ad::rss::world::WorldModel::timeIndex
::ad::rss::world::TimeIndex timeIndex
Definition: WorldModel.hpp:126
SceneVectorValidInputRange.hpp
RssDynamicsValidInputRange.hpp
ad::rss::world::WorldModel::defaultEgoVehicleRssDynamics
::ad::rss::world::RssDynamics defaultEgoVehicleRssDynamics
Definition: WorldModel.hpp:134
withinValidInputRange
bool withinValidInputRange(::ad::rss::world::WorldModel const &input, bool const logErrors=true)
check if the given WorldModel is within valid input range
Definition: WorldModelValidInputRange.hpp:39
ad::rss::world::WorldModel
DataType WorldModel.
Definition: WorldModel.hpp:46
WorldModel.hpp