LCOV - code coverage report
Current view: top level - include/ad/map/lane - ContactOperation.hpp (source / functions) Hit Total Coverage
Test: ad_map_access Lines: 2 2 100.0 %
Date: 2022-10-04 09:48:07 Functions: 1 1 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // ----------------- BEGIN LICENSE BLOCK ---------------------------------
       2                 :            : //
       3                 :            : // Copyright (C) 2018-2021 Intel Corporation
       4                 :            : //
       5                 :            : // SPDX-License-Identifier: MIT
       6                 :            : //
       7                 :            : // ----------------- END LICENSE BLOCK -----------------------------------
       8                 :            : /**
       9                 :            :  * @file
      10                 :            :  */
      11                 :            : 
      12                 :            : #pragma once
      13                 :            : 
      14                 :            : #include "ad/map/lane/ContactLaneValidInputRange.hpp"
      15                 :            : #include "ad/map/lane/Types.hpp"
      16                 :            : #include "ad/map/restriction/RestrictionOperation.hpp"
      17                 :            : 
      18                 :            : /** @brief namespace ad */
      19                 :            : namespace ad {
      20                 :            : /** @brief namespace map */
      21                 :            : namespace map {
      22                 :            : /** @brief namespace lane */
      23                 :            : namespace lane {
      24                 :            : 
      25                 :            : /**
      26                 :            :  * @brief Provides opposite Location.
      27                 :            :  * @param[in] e Base location.
      28                 :            :  * @returns Opposite location. INVALID if there is no opposite.
      29                 :            :  */
      30                 :            : inline ContactLocation oppositeLocation(ContactLocation const &e)
      31                 :            : {
      32                 :            :   switch (e)
      33                 :            :   {
      34                 :            :     case ContactLocation::INVALID:
      35                 :            :       return ContactLocation::INVALID;
      36                 :            :     case ContactLocation::UNKNOWN:
      37                 :            :       return ContactLocation::INVALID;
      38                 :            :     case ContactLocation::LEFT:
      39                 :            :       return ContactLocation::RIGHT;
      40                 :            :     case ContactLocation::RIGHT:
      41                 :            :       return ContactLocation::LEFT;
      42                 :            :     case ContactLocation::SUCCESSOR:
      43                 :            :       return ContactLocation::PREDECESSOR;
      44                 :            :     case ContactLocation::PREDECESSOR:
      45                 :            :       return ContactLocation::SUCCESSOR;
      46                 :            :     case ContactLocation::OVERLAP:
      47                 :            :       return ContactLocation::OVERLAP;
      48                 :            :     default:
      49                 :            :       return ContactLocation::INVALID;
      50                 :            :   }
      51                 :            : }
      52                 :            : 
      53                 :            : /**
      54                 :            :  * @brief Checks if vehicle fits the restriction criteria of the contact lane.
      55                 :            :  * @param[in] contactLane contact lane.
      56                 :            :  * @param[in] vehicle Description of the vehicle.
      57                 :            :  * @returns true of vehicle fits the restrictions criteria.
      58                 :            :  */
      59                 :         12 : inline bool isAccessOk(ContactLane const &contactLane, restriction::VehicleDescriptor const &vehicle)
      60                 :            : {
      61                 :         12 :   return restriction::isAccessOk(contactLane.restrictions, vehicle);
      62                 :            : }
      63                 :            : 
      64                 :            : /**
      65                 :            :  * @brief checks if the given ContactLane is valid
      66                 :            :  *
      67                 :            :  * The contactLane is valid if it's within valid input range.
      68                 :            :  */
      69                 :            : inline bool isValid(ContactLane const &contactLane, bool const logErrors = true)
      70                 :            : {
      71                 :            :   return withinValidInputRange(contactLane, logErrors);
      72                 :            : }
      73                 :            : 
      74                 :            : } // namespace lane
      75                 :            : } // namespace map
      76                 :            : } // namespace ad

Generated by: LCOV version 1.14