ad_map_access
RoadUserTypeValidInputRange.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>
23 #include "spdlog/fmt/ostr.h"
24 #include "spdlog/spdlog.h"
25 
36 inline bool withinValidInputRange(::ad::map::restriction::RoadUserType const &input, bool const logErrors = true)
37 {
38  bool inValidInputRange = (input == ::ad::map::restriction::RoadUserType::INVALID)
39  || (input == ::ad::map::restriction::RoadUserType::UNKNOWN) || (input == ::ad::map::restriction::RoadUserType::CAR)
40  || (input == ::ad::map::restriction::RoadUserType::BUS) || (input == ::ad::map::restriction::RoadUserType::TRUCK)
42  || (input == ::ad::map::restriction::RoadUserType::MOTORBIKE)
44  || (input == ::ad::map::restriction::RoadUserType::CAR_ELECTRIC)
46  || (input == ::ad::map::restriction::RoadUserType::CAR_PETROL)
48  if (!inValidInputRange && logErrors)
49  {
50  spdlog::error("withinValidInputRange(::ad::map::restriction::RoadUserType)>> {}, raw value: {} ",
51  input,
52  static_cast<int32_t>(input)); // LCOV_EXCL_BR_LINE
53  }
54  return inValidInputRange;
55 }
ad::map::restriction::RoadUserType::BUS
@ BUS
withinValidInputRange
bool withinValidInputRange(::ad::map::restriction::RoadUserType const &input, bool const logErrors=true)
check if the given RoadUserType is within valid input range
Definition: RoadUserTypeValidInputRange.hpp:36
ad::map::restriction::RoadUserType::CAR_DIESEL
@ CAR_DIESEL
ad::map::restriction::RoadUserType::CAR_HYBRID
@ CAR_HYBRID
ad::map::restriction::RoadUserType::INVALID
@ INVALID
ad::map::restriction::RoadUserType::BICYCLE
@ BICYCLE
RoadUserType.hpp
ad::map::restriction::RoadUserType::PEDESTRIAN
@ PEDESTRIAN
ad::map::restriction::RoadUserType
RoadUserType
DataType RoadUserType.
Definition: RoadUserType.hpp:41
ad::map::restriction::RoadUserType::UNKNOWN
@ UNKNOWN