ad_rss
RoadAreaValidInputRange.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>
24 #include "spdlog/fmt/ostr.h"
25 #include "spdlog/spdlog.h"
26 
39 inline bool withinValidInputRange(::ad::rss::world::RoadArea const &input, bool const logErrors = true)
40 {
41  bool inValidInputRange = (input.size() <= std::size_t(50));
42  if (!inValidInputRange && logErrors)
43  {
44  spdlog::error("withinValidInputRange(::ad::rss::world::RoadArea)>> {}, invalid input range",
45  input); // LCOV_EXCL_BR_LINE
46  }
47 
48  if (inValidInputRange)
49  {
50  for (auto const &member : input)
51  {
52  bool memberInValidInputRange = withinValidInputRange(member, logErrors);
53  inValidInputRange = inValidInputRange && memberInValidInputRange;
54  if (!memberInValidInputRange && logErrors)
55  {
56  spdlog::error("withinValidInputRange(::ad::rss::world::RoadArea)>> {}, invalid member {}",
57  input,
58  member); // LCOV_EXCL_BR_LINE
59  }
60  }
61  }
62  return inValidInputRange;
63 }
ad::rss::world::RoadArea
std::vector<::ad::rss::world::RoadSegment > RoadArea
DataType RoadArea.
Definition: RoadArea.hpp:43
RoadSegmentValidInputRange.hpp
RoadArea.hpp
withinValidInputRange
bool withinValidInputRange(::ad::rss::world::RoadArea const &input, bool const logErrors=true)
check if the given RoadArea is within valid input range
Definition: RoadAreaValidInputRange.hpp:39