LCOV - code coverage report
Current view: top level - src/utils/router - AFInfo.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 16 0
Test Date: 2025-05-20 15:36:59 Functions: 0.0 % 12 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2012-2025 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    AFInfo.h
      15              : /// @author  Ruediger Ebendt
      16              : /// @date    01.12.2023
      17              : ///
      18              : // Definitions of informations associated with an edge for use in the arc flag
      19              : // routing algorithm (Hilger et al.). In more detail, these informations are:
      20              : // flag information for arc flag routing, a key for sorting the heap, a flag
      21              : // indicating whether the edge has already been touched, labels for holding
      22              : // (tentative / final) distances to the boundary nodes
      23              : /****************************************************************************/
      24              : #pragma once
      25              : #include <config.h>
      26              : #include <unordered_set>
      27              : 
      28              : template<class E>
      29              : class AFInfo {
      30              : public:
      31              :     /**
      32              :      * @class FlagInfo
      33              :      *
      34              :      * It holds a pointer to the associated edge, and flag information
      35              :      * for arc flag routing
      36              :      */
      37              :     class FlagInfo {
      38              :     public:
      39              :         /** @brief Constructor
      40              :         * param[in] e The edge
      41              :         */
      42            0 :         FlagInfo(const E* const e) :
      43            0 :             edge(e) {
      44              :         }
      45              :         /** @brief Copy constructor
      46              :          * @param[in] other The other FLAG info instance to copy
      47              :          * @return This instance (i.e., the result of the copy)
      48              :          */
      49              :         FlagInfo& operator=(const FlagInfo& other) {
      50              :             // guard self assignment
      51              :             if (this == &other) {
      52              :                 return *this;
      53              :             }
      54              :             edge = other.edge;
      55              :             arcFlags = other.arcFlags;
      56              :             return *this;
      57              :         }
      58              :         /// @brief Destructor
      59            0 :         virtual ~FlagInfo() {}
      60              :         /// @brief Reset the flag information
      61            0 :         virtual void reset() {
      62              :             arcFlags.clear();
      63            0 :         }
      64              :         /// @brief The current edge
      65              :         const E* const edge;
      66              :         /// @brief The arc flags
      67              :         std::vector<bool> arcFlags;
      68              :     }; // end of class FlagInfo declaration
      69              : 
      70              :     /**
      71              :      * @class ArcInfoBase
      72              :      *
      73              :      * Derived from FlagInfo. Therefore holds a pointer
      74              :      * to the associated edge, and flag information for arc flag routing.
      75              :      * Additionally, it holds a key for sorting the heap, and a flag
      76              :      * indicating whether the edge has already been touched
      77              :      */
      78              :     class ArcInfoBase : public FlagInfo {
      79              :     public:
      80              :         /** @brief Constructor
      81              :          * param[in] e The edge
      82              :          */
      83            0 :         ArcInfoBase(const E* const e) :
      84              :             FlagInfo(e),
      85            0 :             key(std::numeric_limits<double>::max()),
      86            0 :             touched(false) {
      87              :         }
      88              :         /** @brief Copy constructor
      89              :          * @param[in] other The other ArcInfoBase instance to copy
      90              :          * @return This instance (i.e., the result of the copy)
      91              :          */
      92              :         ArcInfoBase& operator=(const ArcInfoBase& other) {
      93              :             // guard self assignment
      94              :             if (this == &other) {
      95              :                 return *this;
      96              :             }
      97              :             static_cast<FlagInfo>(this) = static_cast<FlagInfo>(other);
      98              :             key = other.key;
      99              :             touched = other.touched;
     100              :             return *this;
     101              :         }
     102            0 :         ~ArcInfoBase() {}
     103            0 :         void reset() {
     104              :             // do nothing
     105            0 :         }
     106              :         /// @brief The arc flags
     107              :         std::vector<bool> arcFlags;
     108              :         /// @brief The key for sorting the heap
     109              :         double key;
     110              :         /// @brief The flag indicating whether the edge has already been touched or not
     111              :         bool touched;
     112              :     }; // end of class ArcInfoBase declaration
     113              : 
     114              :     /**
     115              :      * @class ArcInfo
     116              :      *
     117              :      * Derived from ArcInfoBase. Therefore it tholds a
     118              :      * pointer to the associated edge, flag information for arc flag routing,
     119              :      * a key for sorting the heap, a flag indicating whether the edge has
     120              :      * already been touched. Additionally, it has labels for holding
     121              :      * (tentative/final) distances to the boundary nodes
     122              :      */
     123              :     class ArcInfo : public ArcInfoBase {
     124              :     public:
     125              :         /** @brief Constructor
     126              :          * param[in] e The edge
     127              :          */
     128            0 :         ArcInfo(const E* const e) :
     129            0 :             ArcInfoBase(e) {
     130              :         }
     131              :         /** @brief Copy constructor
     132              :           * @param[in] other The other arc info instance to copy
     133              :           * @return This instance (i.e., the result of the copy)
     134              :           */
     135              :         ArcInfo& operator=(const ArcInfo& other) {
     136              :             // guard self assignment
     137              :             if (this == &other) {
     138              :                 return *this;
     139              :             }
     140              :             static_cast<ArcInfoBase>(this) = static_cast<ArcInfoBase>(other);
     141              :             effortsToBoundaryNodes = other.effortsToBoundaryNodes;
     142              :             return *this;
     143              :         }
     144              :         /// @brief Destructor
     145            0 :         ~ArcInfo() {}
     146              :         /// @brief Reset the arc information
     147            0 :         void reset() {
     148              :             // do nothing
     149            0 :         }
     150              :         /// @brief The efforts to boundary nodes
     151              :         std::vector<double> effortsToBoundaryNodes;
     152              :     }; // end of class ArcInfo declaration
     153              : };
        

Generated by: LCOV version 2.0-1