LCOV - code coverage report
Current view: top level - generated/include/ad/map/lane - LaneIdValidInputRange.hpp (source / functions) Hit Total Coverage
Test: ad_map_access Lines: 10 13 76.9 %
Date: 2022-10-04 09:48:07 Functions: 1 1 100.0 %
Branches: 14 28 50.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: MIT
       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/map/lane/LaneId.hpp"
      23                 :            : #include "spdlog/fmt/ostr.h"
      24                 :            : #include "spdlog/spdlog.h"
      25                 :            : 
      26                 :            : /*!
      27                 :            :  * \brief check if the given LaneId is within valid input range
      28                 :            :  *
      29                 :            :  * \param[in] input the LaneId as an input value
      30                 :            :  * \param[in] logErrors enables error logging
      31                 :            :  *
      32                 :            :  * \returns \c true if LaneId is considered to be within the specified input range
      33                 :            :  *
      34                 :            :  * \note the specified input range is defined by
      35                 :            :  *       std::numeric_limits<::ad::map::lane::LaneId>::lowest() <= \c input <=
      36                 :            :  * std::numeric_limits<::ad::map::lane::LaneId>::max()
      37                 :            :  *       1 <= \c input
      38                 :            :  */
      39                 :      32524 : inline bool withinValidInputRange(::ad::map::lane::LaneId const &input, bool const logErrors = true)
      40                 :            : {
      41                 :            :   // check for generic numeric limits of the type
      42   [ +  -  +  -  :      65048 :   bool inValidInputRange = input.isValid() && (std::numeric_limits<::ad::map::lane::LaneId>::lowest() <= input)
                   +  - ]
      43   [ +  -  +  -  :      65048 :     && (input <= std::numeric_limits<::ad::map::lane::LaneId>::max());
                   +  - ]
      44   [ -  +  -  - ]:      32524 :   if (!inValidInputRange && logErrors)
      45                 :            :   {
      46         [ #  # ]:          0 :     spdlog::error("withinValidInputRange(::ad::map::lane::LaneId)>> {} out of numerical limits [{}, {}]",
      47                 :            :                   input,
      48                 :          0 :                   std::numeric_limits<::ad::map::lane::LaneId>::lowest(),
      49                 :          0 :                   std::numeric_limits<::ad::map::lane::LaneId>::max()); // LCOV_EXCL_BR_LINE
      50                 :            :   }
      51                 :            :   // check for individual input range
      52         [ +  - ]:      32524 :   if (inValidInputRange)
      53                 :            :   {
      54         [ +  - ]:      32524 :     inValidInputRange = (::ad::map::lane::LaneId(1) <= input);
      55   [ +  +  +  + ]:      32524 :     if (!inValidInputRange && logErrors)
      56                 :            :     {
      57         [ +  - ]:         24 :       spdlog::error("withinValidInputRange(::ad::map::lane::LaneId)>> {} out of valid input range [{}, {}]",
      58                 :            :                     input,
      59                 :         48 :                     ::ad::map::lane::LaneId(1),
      60                 :            :                     "Undefined"); // LCOV_EXCL_BR_LINE
      61                 :            :     }
      62                 :            :   }
      63                 :      32524 :   return inValidInputRange;
      64                 :            : }

Generated by: LCOV version 1.14