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/physics/DurationValidInputRange.hpp" 24 : : #include "ad/physics/SpeedValidInputRange.hpp" 25 : : #include "ad/rss/world/LateralRssAccelerationValuesValidInputRange.hpp" 26 : : #include "ad/rss/world/LongitudinalRssAccelerationValuesValidInputRange.hpp" 27 : : #include "ad/rss/world/RssDynamics.hpp" 28 : : #include "ad/rss/world/UnstructuredSettingsValidInputRange.hpp" 29 : : #include "spdlog/fmt/ostr.h" 30 : : #include "spdlog/spdlog.h" 31 : : 32 : : /*! 33 : : * \brief check if the given RssDynamics is within valid input range 34 : : * 35 : : * \param[in] input the RssDynamics as an input value 36 : : * \param[in] logErrors enables error logging 37 : : * 38 : : * \returns \c true if RssDynamics is considered to be within the specified input range 39 : : * 40 : : * \note the specified input range is defined by the ranges of all members, plus: 41 : : * ::ad::physics::Distance(0.) <= lateral_fluctuation_margin <= ::ad::physics::Distance(1.) 42 : : * ::ad::physics::Duration(0.) < response_time <= ::ad::physics::Duration(10.) 43 : : */ 44 : 269647 : inline bool withinValidInputRange(::ad::rss::world::RssDynamics const &input, bool const logErrors = true) 45 : : { 46 : : // check for generic member input ranges 47 : 269647 : bool inValidInputRange = true; 48 : 269647 : inValidInputRange = withinValidInputRange(input.alpha_lon, logErrors) 49 [ + + ]: 261622 : && withinValidInputRange(input.alpha_lat, logErrors) 50 [ + + ]: 258617 : && withinValidInputRange(input.lateral_fluctuation_margin, logErrors) 51 [ + + ]: 258615 : && withinValidInputRange(input.response_time, logErrors) 52 [ + + ]: 257611 : && withinValidInputRange(input.max_speed_on_acceleration, logErrors) 53 [ + + ]: 257609 : && withinValidInputRange(input.unstructured_settings, logErrors) 54 [ + + + + ]: 531269 : && withinValidInputRange(input.min_longitudinal_safety_distance, logErrors); 55 [ + + + - ]: 269647 : if (!inValidInputRange && logErrors) 56 : : { 57 [ + - ]: 12042 : spdlog::error("withinValidInputRange(::ad::rss::world::RssDynamics)>> {} has invalid member", 58 : : input); // LCOV_EXCL_BR_LINE 59 : : } 60 : : 61 : : // check for individual input ranges 62 [ + + ]: 269647 : if (inValidInputRange) 63 : : { 64 [ + - ]: 257605 : inValidInputRange = (::ad::physics::Distance(0.) <= input.lateral_fluctuation_margin) 65 [ + + + - : 257605 : && (input.lateral_fluctuation_margin <= ::ad::physics::Distance(1.)); + + ] 66 [ + + + - ]: 257605 : if (!inValidInputRange && logErrors) 67 : : { 68 [ + - ]: 2 : spdlog::error( 69 : : "withinValidInputRange(::ad::rss::world::RssDynamics)>> {} element {} out of valid input range [{}, {}]", 70 : : input, 71 [ + - ]: 2 : input.lateral_fluctuation_margin, 72 : 2 : ::ad::physics::Distance(0.), 73 : 4 : ::ad::physics::Distance(1.)); // LCOV_EXCL_BR_LINE 74 : : } 75 : : } 76 : : 77 [ + + ]: 269647 : if (inValidInputRange) 78 : : { 79 : : inValidInputRange 80 [ + - + + : 257603 : = (::ad::physics::Duration(0.) < input.response_time) && (input.response_time <= ::ad::physics::Duration(10.)); + - + + ] 81 [ + + + - ]: 257603 : if (!inValidInputRange && logErrors) 82 : : { 83 [ + - ]: 4 : spdlog::error( 84 : : "withinValidInputRange(::ad::rss::world::RssDynamics)>> {} element {} out of valid input range [{}, {}]", 85 : : input, 86 [ + - ]: 4 : input.response_time, 87 : 4 : ::ad::physics::Duration(0.), 88 : 8 : ::ad::physics::Duration(10.)); // LCOV_EXCL_BR_LINE 89 : : } 90 : : } 91 : : 92 : 269647 : return inValidInputRange; 93 : : }