LCOV - code coverage report
Current view: top level - generated/include/ad/rss/world - RssDynamicsValidInputRange.hpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 26 26 100.0 %
Date: 2024-04-30 13:12:49 Functions: 1 1 100.0 %
Branches: 40 50 80.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * ----------------- BEGIN LICENSE BLOCK ---------------------------------
       3                 :            :  *
       4                 :            :  * Copyright (C) 2018-2020 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-1997
      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.) <= lateralFluctuationMargin <= ::ad::physics::Distance(1.)
      42                 :            :  *       ::ad::physics::Duration(0.) < responseTime <= ::ad::physics::Duration(10.)
      43                 :            :  */
      44                 :     269772 : inline bool withinValidInputRange(::ad::rss::world::RssDynamics const &input, bool const logErrors = true)
      45                 :            : {
      46                 :            :   // check for generic member input ranges
      47                 :     269772 :   bool inValidInputRange = true;
      48                 :     269772 :   inValidInputRange = withinValidInputRange(input.alphaLon, logErrors)
      49         [ +  + ]:     261748 :     && withinValidInputRange(input.alphaLat, logErrors)
      50         [ +  + ]:     258743 :     && withinValidInputRange(input.lateralFluctuationMargin, logErrors)
      51         [ +  + ]:     258741 :     && withinValidInputRange(input.responseTime, logErrors)
      52         [ +  + ]:     257737 :     && withinValidInputRange(input.maxSpeedOnAcceleration, logErrors)
      53   [ +  +  +  + ]:     531520 :     && withinValidInputRange(input.unstructuredSettings, logErrors);
      54   [ +  +  +  - ]:     269772 :   if (!inValidInputRange && logErrors)
      55                 :            :   {
      56         [ +  - ]:      12039 :     spdlog::error("withinValidInputRange(::ad::rss::world::RssDynamics)>> {} has invalid member",
      57                 :            :                   input); // LCOV_EXCL_BR_LINE
      58                 :            :   }
      59                 :            : 
      60                 :            :   // check for individual input ranges
      61         [ +  + ]:     269772 :   if (inValidInputRange)
      62                 :            :   {
      63         [ +  - ]:     257733 :     inValidInputRange = (::ad::physics::Distance(0.) <= input.lateralFluctuationMargin)
      64   [ +  +  +  -  :     257733 :       && (input.lateralFluctuationMargin <= ::ad::physics::Distance(1.));
                   +  + ]
      65   [ +  +  +  - ]:     257733 :     if (!inValidInputRange && logErrors)
      66                 :            :     {
      67         [ +  - ]:          2 :       spdlog::error(
      68                 :            :         "withinValidInputRange(::ad::rss::world::RssDynamics)>> {} element {} out of valid input range [{}, {}]",
      69                 :            :         input,
      70                 :          2 :         input.lateralFluctuationMargin,
      71                 :          2 :         ::ad::physics::Distance(0.),
      72                 :          4 :         ::ad::physics::Distance(1.)); // LCOV_EXCL_BR_LINE
      73                 :            :     }
      74                 :            :   }
      75                 :            : 
      76         [ +  + ]:     269772 :   if (inValidInputRange)
      77                 :            :   {
      78                 :            :     inValidInputRange
      79   [ +  -  +  +  :     257731 :       = (::ad::physics::Duration(0.) < input.responseTime) && (input.responseTime <= ::ad::physics::Duration(10.));
             +  -  +  + ]
      80   [ +  +  +  - ]:     257731 :     if (!inValidInputRange && logErrors)
      81                 :            :     {
      82         [ +  - ]:          4 :       spdlog::error(
      83                 :            :         "withinValidInputRange(::ad::rss::world::RssDynamics)>> {} element {} out of valid input range [{}, {}]",
      84                 :            :         input,
      85                 :          4 :         input.responseTime,
      86                 :          4 :         ::ad::physics::Duration(0.),
      87                 :          8 :         ::ad::physics::Duration(10.)); // LCOV_EXCL_BR_LINE
      88                 :            :     }
      89                 :            :   }
      90                 :            : 
      91                 :     269772 :   return inValidInputRange;
      92                 :            : }

Generated by: LCOV version 1.14