LCOV - code coverage report
Current view: top level - include/ad/map/route - Routing.hpp (source / functions) Hit Total Coverage
Test: ad_map_access Lines: 10 10 100.0 %
Date: 2022-10-04 09:48:07 Functions: 2 2 100.0 %
Branches: 2 2 100.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 <set>
      15                 :            : #include "ad/map/point/ParaPointOperation.hpp"
      16                 :            : 
      17                 :            : /* @brief namespace ad */
      18                 :            : namespace ad {
      19                 :            : /* @brief namespace map */
      20                 :            : namespace map {
      21                 :            : /* @brief namespace route */
      22                 :            : namespace route {
      23                 :            : /**
      24                 :            :  * @brief provides route planning capabilities on the road network of the map
      25                 :            :  */
      26                 :            : namespace planning {
      27                 :            : 
      28                 :            : /**
      29                 :            :  * @brief direction at the para point in respect to the lane orientation
      30                 :            :  */
      31                 :            : enum class RoutingDirection
      32                 :            : {
      33                 :            :   DONT_CARE, ///< Vehicle direction is not relevant.
      34                 :            :   POSITIVE,  ///< Vehicle direction is same as Lane orientation.
      35                 :            :   NEGATIVE   ///< Vehicle direction is opposite of Lane orientation.
      36                 :            : };
      37                 :            : 
      38                 :            : /**
      39                 :            :  * @brief routing para point
      40                 :            :  *
      41                 :            :  * It is essential to know in which direction a vehicle is oriented in respect to the lane when trying to route.
      42                 :            :  * Therefore, the routing para point extends the para point by a RoutingDirection.
      43                 :            :  */
      44                 :            : struct RoutingParaPoint
      45                 :            : {
      46                 :            :   /**
      47                 :            :    * @brief Standard comparison operator.
      48                 :            :    * @returns True if two objects can be taken as equal.
      49                 :            :    */
      50                 :            :   bool operator==(const RoutingParaPoint &other) const
      51                 :            :   {
      52                 :            :     return (direction == other.direction) && (point == other.point);
      53                 :            :   }
      54                 :            : 
      55                 :            :   /**
      56                 :            :    * @brief Standard comparison operator.
      57                 :            :    * @returns True if two objects can be taken as distinct.
      58                 :            :    */
      59                 :            :   bool operator!=(const RoutingParaPoint &other) const
      60                 :            :   {
      61                 :            :     return !operator==(other);
      62                 :            :   }
      63                 :            : 
      64                 :            :   /**
      65                 :            :    * @brief Standard comparison operator.
      66                 :            :    * @returns True if this objects can be taken as smaller than the other.
      67                 :            :    */
      68                 :     841208 :   bool operator<(const RoutingParaPoint &other) const
      69                 :            :   {
      70         [ +  + ]:     841208 :     if (direction == other.direction)
      71                 :            :     {
      72                 :     604731 :       return point < other.point;
      73                 :            :     }
      74                 :     236477 :     return direction < other.direction;
      75                 :            :   }
      76                 :            : 
      77                 :            :   point::ParaPoint point;
      78                 :            :   RoutingDirection direction{RoutingDirection::DONT_CARE};
      79                 :            : };
      80                 :            : 
      81                 :            : /**
      82                 :            :  * @brief create a RoutingParaPoint
      83                 :            :  *
      84                 :            :  * @param[in] laneId  the lane id
      85                 :            :  * @param[in] parametricOffset the parametric offset
      86                 :            :  * @param[in] routingDirection the routing direction in respect to the lane orientation
      87                 :            :  *   Be aware: this might be different from the nominal driving direction!
      88                 :            :  */
      89                 :      51403 : inline RoutingParaPoint createRoutingParaPoint(lane::LaneId const &laneId,
      90                 :            :                                                physics::ParametricValue const &parametricOffset,
      91                 :            :                                                RoutingDirection const &routingDirection = RoutingDirection::DONT_CARE)
      92                 :            : {
      93                 :      51403 :   RoutingParaPoint routingPoint;
      94                 :      51403 :   routingPoint.point.laneId = laneId;
      95                 :      51403 :   routingPoint.point.parametricOffset = parametricOffset;
      96                 :      51403 :   routingPoint.direction = routingDirection;
      97                 :      51403 :   return routingPoint;
      98                 :            : }
      99                 :            : 
     100                 :            : } // namespace planning
     101                 :            : } // namespace route
     102                 :            : } // namespace map
     103                 :            : } // namespace ad

Generated by: LCOV version 1.14