LCOV - code coverage report
Current view: top level - generated/include/ad/rss/situation - VehicleStateValidInputRange.hpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 26 26 100.0 %
Date: 2024-04-23 14:35:54 Functions: 1 1 100.0 %
Branches: 38 50 76.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/rss/situation/VehicleState.hpp"
      24                 :            : #include "ad/rss/situation/VelocityRangeValidInputRange.hpp"
      25                 :            : #include "ad/rss/world/ObjectStateValidInputRange.hpp"
      26                 :            : #include "ad/rss/world/ObjectTypeValidInputRange.hpp"
      27                 :            : #include "ad/rss/world/RssDynamicsValidInputRange.hpp"
      28                 :            : #include "spdlog/fmt/ostr.h"
      29                 :            : #include "spdlog/spdlog.h"
      30                 :            : 
      31                 :            : /*!
      32                 :            :  * \brief check if the given VehicleState is within valid input range
      33                 :            :  *
      34                 :            :  * \param[in] input the VehicleState as an input value
      35                 :            :  * \param[in] logErrors enables error logging
      36                 :            :  *
      37                 :            :  * \returns \c true if VehicleState is considered to be within the specified input range
      38                 :            :  *
      39                 :            :  * \note the specified input range is defined by the ranges of all members, plus:
      40                 :            :  *       ::ad::physics::Distance(0.) <= distanceToEnterIntersection <= distanceToLeaveIntersection
      41                 :            :  *       distanceToEnterIntersection <= distanceToLeaveIntersection <= ::ad::physics::Distance(1e4)
      42                 :            :  */
      43                 :     245530 : inline bool withinValidInputRange(::ad::rss::situation::VehicleState const &input, bool const logErrors = true)
      44                 :            : {
      45                 :            :   // check for generic member input ranges
      46                 :     245530 :   bool inValidInputRange = true;
      47                 :     245530 :   inValidInputRange = withinValidInputRange(input.velocity, logErrors)
      48         [ +  + ]:     245522 :     && withinValidInputRange(input.dynamics, logErrors)
      49         [ +  + ]:     233513 :     && withinValidInputRange(input.distanceToEnterIntersection, logErrors)
      50         [ +  + ]:     233511 :     && withinValidInputRange(input.distanceToLeaveIntersection, logErrors)
      51   [ +  +  +  +  :     491052 :     && withinValidInputRange(input.objectType, logErrors) && withinValidInputRange(input.objectState, logErrors);
                   +  + ]
      52   [ +  +  +  - ]:     245530 :   if (!inValidInputRange && logErrors)
      53                 :            :   {
      54         [ +  - ]:      12025 :     spdlog::error("withinValidInputRange(::ad::rss::situation::VehicleState)>> {} has invalid member",
      55                 :            :                   input); // LCOV_EXCL_BR_LINE
      56                 :            :   }
      57                 :            : 
      58                 :            :   // check for individual input ranges
      59         [ +  + ]:     245530 :   if (inValidInputRange)
      60                 :            :   {
      61         [ +  - ]:     233505 :     inValidInputRange = (::ad::physics::Distance(0.) <= input.distanceToEnterIntersection)
      62   [ +  +  +  -  :     233505 :       && (input.distanceToEnterIntersection <= input.distanceToLeaveIntersection);
                   +  - ]
      63   [ +  +  +  - ]:     233505 :     if (!inValidInputRange && logErrors)
      64                 :            :     {
      65         [ +  - ]:          1 :       spdlog::error(
      66                 :            :         "withinValidInputRange(::ad::rss::situation::VehicleState)>> {} element {} out of valid input range [{}, {}]",
      67                 :            :         input,
      68                 :          1 :         input.distanceToEnterIntersection,
      69                 :          1 :         ::ad::physics::Distance(0.),
      70                 :          1 :         input.distanceToLeaveIntersection); // LCOV_EXCL_BR_LINE
      71                 :            :     }
      72                 :            :   }
      73                 :            : 
      74         [ +  + ]:     245530 :   if (inValidInputRange)
      75                 :            :   {
      76         [ +  - ]:     233504 :     inValidInputRange = (input.distanceToEnterIntersection <= input.distanceToLeaveIntersection)
      77   [ +  -  +  -  :     233504 :       && (input.distanceToLeaveIntersection <= ::ad::physics::Distance(1e4));
                   +  + ]
      78   [ +  +  +  - ]:     233504 :     if (!inValidInputRange && logErrors)
      79                 :            :     {
      80         [ +  - ]:          1 :       spdlog::error(
      81                 :            :         "withinValidInputRange(::ad::rss::situation::VehicleState)>> {} element {} out of valid input range [{}, {}]",
      82                 :            :         input,
      83                 :          1 :         input.distanceToLeaveIntersection,
      84                 :          1 :         input.distanceToEnterIntersection,
      85                 :          2 :         ::ad::physics::Distance(1e4)); // LCOV_EXCL_BR_LINE
      86                 :            :     }
      87                 :            :   }
      88                 :            : 
      89                 :     245530 :   return inValidInputRange;
      90                 :            : }

Generated by: LCOV version 1.14