Branch data Line data Source code
1 : : /* 2 : : * ----------------- BEGIN LICENSE BLOCK --------------------------------- 3 : : * 4 : : * Copyright (C) 2018-2022 Intel Corporation 5 : : * 6 : : * SPDX-License-Identifier: LGPL-2.1-only 7 : : * 8 : : * ----------------- END LICENSE BLOCK ----------------------------------- 9 : : */ 10 : : 11 : : /** 12 : : * Generated file 13 : : * @file 14 : : * 15 : : * Generator Version : 11.0.0-2046 16 : : */ 17 : : 18 : : #pragma once 19 : : 20 : : #include <cmath> 21 : : #include <limits> 22 : : #include "ad/physics/DistanceValidInputRange.hpp" 23 : : #include "ad/rss/core/StructuredObjectState.hpp" 24 : : #include "ad/rss/world/VelocityValidInputRange.hpp" 25 : : #include "spdlog/fmt/ostr.h" 26 : : #include "spdlog/spdlog.h" 27 : : 28 : : /*! 29 : : * \brief check if the given StructuredObjectState is within valid input range 30 : : * 31 : : * \param[in] input the StructuredObjectState as an input value 32 : : * \param[in] logErrors enables error logging 33 : : * 34 : : * \returns \c true if StructuredObjectState is considered to be within the specified input range 35 : : * 36 : : * \note the specified input range is defined by the ranges of all members, plus: 37 : : * ::ad::physics::Distance(0.) <= distance_to_enter_intersection <= distance_to_leave_intersection 38 : : * distance_to_enter_intersection <= distance_to_leave_intersection <= ::ad::physics::Distance(1e4) 39 : : */ 40 : 233307 : inline bool withinValidInputRange(::ad::rss::core::StructuredObjectState const &input, bool const logErrors = true) 41 : : { 42 : : // check for generic member input ranges 43 : 233307 : bool inValidInputRange = true; 44 : 233307 : inValidInputRange = withinValidInputRange(input.velocity, logErrors) 45 [ + + ]: 233300 : && withinValidInputRange(input.distance_to_enter_intersection, logErrors) 46 [ + + + + ]: 466607 : && withinValidInputRange(input.distance_to_leave_intersection, logErrors); 47 [ + + + - ]: 233307 : if (!inValidInputRange && logErrors) 48 : : { 49 [ + - ]: 13 : spdlog::error("withinValidInputRange(::ad::rss::core::StructuredObjectState)>> {} has invalid member", 50 : : input); // LCOV_EXCL_BR_LINE 51 : : } 52 : : 53 : : // check for individual input ranges 54 [ + + ]: 233307 : if (inValidInputRange) 55 : : { 56 [ + - ]: 233294 : inValidInputRange = (::ad::physics::Distance(0.) <= input.distance_to_enter_intersection) 57 [ + + + - : 233294 : && (input.distance_to_enter_intersection <= input.distance_to_leave_intersection); + - ] 58 [ + + + - ]: 233294 : if (!inValidInputRange && logErrors) 59 : : { 60 [ + - ]: 1 : spdlog::error("withinValidInputRange(::ad::rss::core::StructuredObjectState)>> {} element {} out of valid input " 61 : : "range [{}, {}]", 62 : : input, 63 [ + - ]: 1 : input.distance_to_enter_intersection, 64 : 1 : ::ad::physics::Distance(0.), 65 : 1 : input.distance_to_leave_intersection); // LCOV_EXCL_BR_LINE 66 : : } 67 : : } 68 : : 69 [ + + ]: 233307 : if (inValidInputRange) 70 : : { 71 [ + - ]: 233293 : inValidInputRange = (input.distance_to_enter_intersection <= input.distance_to_leave_intersection) 72 [ + - + - : 233293 : && (input.distance_to_leave_intersection <= ::ad::physics::Distance(1e4)); + + ] 73 [ + + + - ]: 233293 : if (!inValidInputRange && logErrors) 74 : : { 75 [ + - ]: 1 : spdlog::error("withinValidInputRange(::ad::rss::core::StructuredObjectState)>> {} element {} out of valid input " 76 : : "range [{}, {}]", 77 : : input, 78 : 1 : input.distance_to_leave_intersection, 79 [ + - ]: 1 : input.distance_to_enter_intersection, 80 : 2 : ::ad::physics::Distance(1e4)); // LCOV_EXCL_BR_LINE 81 : : } 82 : : } 83 : : 84 : 233307 : return inValidInputRange; 85 : : }