ad_map_access
ContactTypeValidInputRange.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::lane::ContactType const &input, bool const logErrors = true)
37 {
38  bool inValidInputRange = (input == ::ad::map::lane::ContactType::INVALID)
39  || (input == ::ad::map::lane::ContactType::UNKNOWN) || (input == ::ad::map::lane::ContactType::FREE)
41  || (input == ::ad::map::lane::ContactType::LANE_CONTINUATION) || (input == ::ad::map::lane::ContactType::LANE_END)
42  || (input == ::ad::map::lane::ContactType::SINGLE_POINT) || (input == ::ad::map::lane::ContactType::STOP)
43  || (input == ::ad::map::lane::ContactType::STOP_ALL) || (input == ::ad::map::lane::ContactType::YIELD)
44  || (input == ::ad::map::lane::ContactType::GATE_BARRIER) || (input == ::ad::map::lane::ContactType::GATE_TOLBOOTH)
45  || (input == ::ad::map::lane::ContactType::GATE_SPIKES)
46  || (input == ::ad::map::lane::ContactType::GATE_SPIKES_CONTRA) || (input == ::ad::map::lane::ContactType::CURB_UP)
47  || (input == ::ad::map::lane::ContactType::CURB_DOWN) || (input == ::ad::map::lane::ContactType::SPEED_BUMP)
48  || (input == ::ad::map::lane::ContactType::TRAFFIC_LIGHT) || (input == ::ad::map::lane::ContactType::CROSSWALK)
49  || (input == ::ad::map::lane::ContactType::PRIO_TO_RIGHT) || (input == ::ad::map::lane::ContactType::RIGHT_OF_WAY)
51  if (!inValidInputRange && logErrors)
52  {
53  spdlog::error("withinValidInputRange(::ad::map::lane::ContactType)>> {}, raw value: {} ",
54  input,
55  static_cast<int32_t>(input)); // LCOV_EXCL_BR_LINE
56  }
57  return inValidInputRange;
58 }
ad::map::lane::ContactType::GATE_TOLBOOTH
@ GATE_TOLBOOTH
ad::map::lane::ContactType
ContactType
DataType ContactType.
Definition: ContactType.hpp:43
ad::map::lane::ContactType::GATE_SPIKES_CONTRA
@ GATE_SPIKES_CONTRA
ad::map::lane::ContactType::LANE_CHANGE
@ LANE_CHANGE
ad::map::lane::ContactType::CURB_DOWN
@ CURB_DOWN
ad::map::lane::ContactType::LANE_END
@ LANE_END
ad::map::lane::ContactType::STOP
@ STOP
ad::map::lane::ContactType::PRIO_TO_RIGHT
@ PRIO_TO_RIGHT
ad::map::lane::ContactType::PRIO_TO_RIGHT_AND_STRAIGHT
@ PRIO_TO_RIGHT_AND_STRAIGHT
ad::map::lane::ContactType::TRAFFIC_LIGHT
@ TRAFFIC_LIGHT
ContactType.hpp
ad::map::lane::ContactType::INVALID
@ INVALID
withinValidInputRange
bool withinValidInputRange(::ad::map::lane::ContactType const &input, bool const logErrors=true)
check if the given ContactType is within valid input range
Definition: ContactTypeValidInputRange.hpp:36
ad::map::lane::ContactType::UNKNOWN
@ UNKNOWN
ad::map::lane::ContactType::YIELD
@ YIELD