ad_map_access
VehicleDescriptorValidInputRange.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: MIT
7  *
8  * ----------------- END LICENSE BLOCK -----------------------------------
9  */
10 
18 #pragma once
19 
20 #include <cmath>
21 #include <limits>
24 #include "ad/physics/DistanceValidInputRange.hpp"
25 #include "ad/physics/WeightValidInputRange.hpp"
26 #include "spdlog/fmt/ostr.h"
27 #include "spdlog/spdlog.h"
28 
39 inline bool withinValidInputRange(::ad::map::restriction::VehicleDescriptor const &input, bool const logErrors = true)
40 {
41  // check for generic member input ranges
42  bool inValidInputRange = true;
43  inValidInputRange = withinValidInputRange(input.type, logErrors) && withinValidInputRange(input.width, logErrors)
44  && withinValidInputRange(input.height, logErrors) && withinValidInputRange(input.length, logErrors)
45  && withinValidInputRange(input.weight, logErrors);
46  if (!inValidInputRange && logErrors)
47  {
48  spdlog::error("withinValidInputRange(::ad::map::restriction::VehicleDescriptor)>> {} has invalid member",
49  input); // LCOV_EXCL_BR_LINE
50  }
51 
52  return inValidInputRange;
53 }
withinValidInputRange
bool withinValidInputRange(::ad::map::restriction::VehicleDescriptor const &input, bool const logErrors=true)
check if the given VehicleDescriptor is within valid input range
Definition: VehicleDescriptorValidInputRange.hpp:39
RoadUserTypeValidInputRange.hpp
ad::map::restriction::VehicleDescriptor
DataType VehicleDescriptor.
Definition: VehicleDescriptor.hpp:46
VehicleDescriptor.hpp