ad_rss
ObjectValidInputRange.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/rss/world/Object.hpp"
27 #include "spdlog/fmt/ostr.h"
28 #include "spdlog/spdlog.h"
29 
40 inline bool withinValidInputRange(::ad::rss::world::Object const &input, bool const logErrors = true)
41 {
42  // check for generic member input ranges
43  bool inValidInputRange = true;
44  inValidInputRange = withinValidInputRange(input.object_type, logErrors)
45  && withinValidInputRange(input.occupied_regions, logErrors) && withinValidInputRange(input.velocity, logErrors)
46  && withinValidInputRange(input.state, logErrors);
47  if (!inValidInputRange && logErrors)
48  {
49  spdlog::error("withinValidInputRange(::ad::rss::world::Object)>> {} has invalid member",
50  input); // LCOV_EXCL_BR_LINE
51  }
52 
53  return inValidInputRange;
54 }
bool withinValidInputRange(::ad::rss::world::Object const &input, bool const logErrors=true)
check if the given Object is within valid input range
Definition: ObjectValidInputRange.hpp:40
DataType Object.
Definition: Object.hpp:49
::ad::rss::world::ObjectType object_type
Definition: Object.hpp:131
::ad::rss::world::Velocity velocity
Definition: Object.hpp:141
::ad::rss::world::OccupiedRegionVector occupied_regions
Definition: Object.hpp:136
::ad::rss::world::ObjectState state
Definition: Object.hpp:146