ad_map_access
TrafficLightTypeValidInputRange.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::landmark::TrafficLightType const &input, bool const logErrors = true)
37 {
38  bool inValidInputRange = (input == ::ad::map::landmark::TrafficLightType::INVALID)
40  || (input == ::ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW)
42  || (input == ::ad::map::landmark::TrafficLightType::LEFT_RED_YELLOW_GREEN)
44  || (input == ::ad::map::landmark::TrafficLightType::STRAIGHT_RED_YELLOW_GREEN)
46  || (input == ::ad::map::landmark::TrafficLightType::RIGHT_STRAIGHT_RED_YELLOW_GREEN)
48  || (input == ::ad::map::landmark::TrafficLightType::BIKE_RED_GREEN)
50  || (input == ::ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_YELLOW_GREEN)
52  || (input == ::ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_YELLOW_GREEN);
53  if (!inValidInputRange && logErrors)
54  {
55  spdlog::error("withinValidInputRange(::ad::map::landmark::TrafficLightType)>> {}, raw value: {} ",
56  input,
57  static_cast<int32_t>(input)); // LCOV_EXCL_BR_LINE
58  }
59  return inValidInputRange;
60 }
ad::map::landmark::TrafficLightType::SOLID_RED_YELLOW_GREEN
@ SOLID_RED_YELLOW_GREEN
ad::map::landmark::TrafficLightType::BIKE_RED_YELLOW_GREEN
@ BIKE_RED_YELLOW_GREEN
ad::map::landmark::TrafficLightType::UNKNOWN
@ UNKNOWN
ad::map::landmark::TrafficLightType
TrafficLightType
DataType TrafficLightType.
Definition: TrafficLightType.hpp:43
ad::map::landmark::TrafficLightType::BIKE_PEDESTRIAN_RED_GREEN
@ BIKE_PEDESTRIAN_RED_GREEN
ad::map::landmark::TrafficLightType::INVALID
@ INVALID
ad::map::landmark::TrafficLightType::PEDESTRIAN_RED_GREEN
@ PEDESTRIAN_RED_GREEN
ad::map::landmark::TrafficLightType::LEFT_STRAIGHT_RED_YELLOW_GREEN
@ LEFT_STRAIGHT_RED_YELLOW_GREEN
ad::map::landmark::TrafficLightType::RIGHT_RED_YELLOW_GREEN
@ RIGHT_RED_YELLOW_GREEN
TrafficLightType.hpp
withinValidInputRange
bool withinValidInputRange(::ad::map::landmark::TrafficLightType const &input, bool const logErrors=true)
check if the given TrafficLightType is within valid input range
Definition: TrafficLightTypeValidInputRange.hpp:36