LCOV - code coverage report
Current view: top level - generated/include/ad/rss/world - VelocityValidInputRange.hpp (source / functions) Hit Total Coverage
Test: ad_rss Lines: 24 36 66.7 %
Date: 2025-07-22 06:53:46 Functions: 1 1 100.0 %
Branches: 45 86 52.3 %

           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/SpeedValidInputRange.hpp"
      23                 :            : #include "ad/rss/world/Velocity.hpp"
      24                 :            : #include "spdlog/fmt/ostr.h"
      25                 :            : #include "spdlog/spdlog.h"
      26                 :            : 
      27                 :            : /*!
      28                 :            :  * \brief check if the given Velocity is within valid input range
      29                 :            :  *
      30                 :            :  * \param[in] input the Velocity as an input value
      31                 :            :  * \param[in] logErrors enables error logging
      32                 :            :  *
      33                 :            :  * \returns \c true if Velocity is considered to be within the specified input range
      34                 :            :  *
      35                 :            :  * \note the specified input range is defined by the ranges of all members, plus:
      36                 :            :  *       ::ad::physics::Speed(0.) <= speed_lon_min <= speed_lon_max
      37                 :            :  *       speed_lon_min <= speed_lon_max <= ::ad::physics::Speed(100.)
      38                 :            :  *       ::ad::physics::Speed(-100.) <= speed_lat_min <= speed_lat_max
      39                 :            :  *       speed_lat_min <= speed_lat_max <= ::ad::physics::Speed(100.)
      40                 :            :  */
      41                 :     245491 : inline bool withinValidInputRange(::ad::rss::world::Velocity const &input, bool const logErrors = true)
      42                 :            : {
      43                 :            :   // check for generic member input ranges
      44                 :     245491 :   bool inValidInputRange = true;
      45                 :     245491 :   inValidInputRange = withinValidInputRange(input.speed_lon_min, logErrors)
      46   [ +  +  +  + ]:     245482 :     && withinValidInputRange(input.speed_lon_max, logErrors) && withinValidInputRange(input.speed_lat_min, logErrors)
      47   [ +  +  +  + ]:     490973 :     && withinValidInputRange(input.speed_lat_max, logErrors);
      48   [ +  +  +  - ]:     245491 :   if (!inValidInputRange && logErrors)
      49                 :            :   {
      50         [ +  - ]:         19 :     spdlog::error("withinValidInputRange(::ad::rss::world::Velocity)>> {} has invalid member",
      51                 :            :                   input); // LCOV_EXCL_BR_LINE
      52                 :            :   }
      53                 :            : 
      54                 :            :   // check for individual input ranges
      55         [ +  + ]:     245491 :   if (inValidInputRange)
      56                 :            :   {
      57                 :            :     inValidInputRange
      58   [ +  -  +  +  :     245472 :       = (::ad::physics::Speed(0.) <= input.speed_lon_min) && (input.speed_lon_min <= input.speed_lon_max);
             +  -  +  - ]
      59   [ +  +  +  - ]:     245472 :     if (!inValidInputRange && logErrors)
      60                 :            :     {
      61         [ +  - ]:          5 :       spdlog::error(
      62                 :            :         "withinValidInputRange(::ad::rss::world::Velocity)>> {} element {} out of valid input range [{}, {}]",
      63                 :            :         input,
      64         [ +  - ]:          5 :         input.speed_lon_min,
      65                 :          5 :         ::ad::physics::Speed(0.),
      66                 :          5 :         input.speed_lon_max); // LCOV_EXCL_BR_LINE
      67                 :            :     }
      68                 :            :   }
      69                 :            : 
      70         [ +  + ]:     245491 :   if (inValidInputRange)
      71                 :            :   {
      72                 :            :     inValidInputRange
      73   [ +  -  +  -  :     245467 :       = (input.speed_lon_min <= input.speed_lon_max) && (input.speed_lon_max <= ::ad::physics::Speed(100.));
             +  -  +  - ]
      74   [ -  +  -  - ]:     245467 :     if (!inValidInputRange && logErrors)
      75                 :            :     {
      76         [ #  # ]:          0 :       spdlog::error(
      77                 :            :         "withinValidInputRange(::ad::rss::world::Velocity)>> {} element {} out of valid input range [{}, {}]",
      78                 :            :         input,
      79                 :          0 :         input.speed_lon_max,
      80         [ #  # ]:          0 :         input.speed_lon_min,
      81                 :          0 :         ::ad::physics::Speed(100.)); // LCOV_EXCL_BR_LINE
      82                 :            :     }
      83                 :            :   }
      84                 :            : 
      85         [ +  + ]:     245491 :   if (inValidInputRange)
      86                 :            :   {
      87                 :            :     inValidInputRange
      88   [ +  -  +  -  :     245467 :       = (::ad::physics::Speed(-100.) <= input.speed_lat_min) && (input.speed_lat_min <= input.speed_lat_max);
             +  -  +  - ]
      89   [ -  +  -  - ]:     245467 :     if (!inValidInputRange && logErrors)
      90                 :            :     {
      91         [ #  # ]:          0 :       spdlog::error(
      92                 :            :         "withinValidInputRange(::ad::rss::world::Velocity)>> {} element {} out of valid input range [{}, {}]",
      93                 :            :         input,
      94         [ #  # ]:          0 :         input.speed_lat_min,
      95                 :          0 :         ::ad::physics::Speed(-100.),
      96                 :          0 :         input.speed_lat_max); // LCOV_EXCL_BR_LINE
      97                 :            :     }
      98                 :            :   }
      99                 :            : 
     100         [ +  + ]:     245491 :   if (inValidInputRange)
     101                 :            :   {
     102                 :            :     inValidInputRange
     103   [ +  -  +  -  :     245467 :       = (input.speed_lat_min <= input.speed_lat_max) && (input.speed_lat_max <= ::ad::physics::Speed(100.));
             +  -  +  - ]
     104   [ -  +  -  - ]:     245467 :     if (!inValidInputRange && logErrors)
     105                 :            :     {
     106         [ #  # ]:          0 :       spdlog::error(
     107                 :            :         "withinValidInputRange(::ad::rss::world::Velocity)>> {} element {} out of valid input range [{}, {}]",
     108                 :            :         input,
     109                 :          0 :         input.speed_lat_max,
     110         [ #  # ]:          0 :         input.speed_lat_min,
     111                 :          0 :         ::ad::physics::Speed(100.)); // LCOV_EXCL_BR_LINE
     112                 :            :     }
     113                 :            :   }
     114                 :            : 
     115                 :     245491 :   return inValidInputRange;
     116                 :            : }

Generated by: LCOV version 1.14