LCOV - code coverage report
Current view: top level - src/utils/router - FlippedNode.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 17 0
Test Date: 2025-05-19 15:30:56 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-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    FlippedNode.h
      15              : /// @author  Ruediger Ebendt
      16              : /// @date    01.12.2023
      17              : ///
      18              : // Wrapper around an RONode used for backward search. It swaps incoming
      19              : // with outgoing edges, and replaces the original edges by reversed
      20              : // ones (i.e., by instances of FlippedEdge)
      21              : /****************************************************************************/
      22              : #pragma once
      23              : #include <config.h>
      24              : #include <vector>
      25              : #include "FlippedEdge.h"
      26              : 
      27              : // ===========================================================================
      28              : // class definitions
      29              : // ===========================================================================
      30              : /// @brief the node type representing nodes used for backward search
      31              : template<class E, class N, class V>
      32              : class FlippedNode {
      33              : public:
      34              :     typedef std::vector<const FlippedEdge<E, N, V>*> ConstFlippedEdgeVector;
      35              : 
      36              :     /** Constructor
      37              :      * @param[in] originalNode The original node
      38              :      */
      39            0 :     FlippedNode(const N* originalNode) :
      40            0 :         myOriginalNode(originalNode) {}
      41              : 
      42              :     /// @brief Destructor
      43            0 :     ~FlippedNode() {}
      44              : 
      45              :     /** @brief Returns the position of the node
      46              :      * @return This node's position
      47              :      */
      48              :     const Position& getPosition() const {
      49            0 :         return myOriginalNode->getPosition();
      50              :     }
      51              :     /** @brief Returns the id(entifier) of the node
      52              :      * @return This node's id(entifier)
      53              :      */
      54              :     const std::string& getID() const {
      55            0 :         return myOriginalNode->getID();
      56              :     }
      57              : 
      58              :     /** @brief Returns the incoming edges of the node
      59              :      * @return The incoming edges of the node
      60              :      */
      61            0 :     const ConstFlippedEdgeVector& getIncoming() const {
      62            0 :         if (myIncoming.empty()) {
      63            0 :             const std::vector<const E*>& incoming = myOriginalNode->getOutgoing();
      64            0 :             for (const E* edge : incoming) {
      65            0 :                 myIncoming.push_back(edge->getFlippedRoutingEdge());
      66              :             }
      67              :         }
      68            0 :         return myIncoming;
      69              :     }
      70              : 
      71              :     /** @brief Returns the outgoing edges of the node
      72              :       * @return The outgoing edges of the node
      73              :       */
      74            0 :     const ConstFlippedEdgeVector& getOutgoing() const {
      75            0 :         if (myOutgoing.empty()) {
      76            0 :             const std::vector<const E*>& outgoing = myOriginalNode->getIncoming();
      77            0 :             for (const E* edge : outgoing) {
      78            0 :                 myOutgoing.push_back(edge->getFlippedRoutingEdge());
      79              :             }
      80              :         }
      81            0 :         return myOutgoing;
      82              :     }
      83              : 
      84              :     /// @brief Returns the original node
      85              :     const N* getOriginalNode() const {
      86              :         return myOriginalNode;
      87              :     }
      88              : private:
      89              :     /// @brief The original node
      90              :     const N* const myOriginalNode;
      91              :     /// @brief The incoming edges
      92              :     mutable ConstFlippedEdgeVector myIncoming;
      93              :     /// @brief The outgoing edges
      94              :     mutable ConstFlippedEdgeVector myOutgoing;
      95              : };
        

Generated by: LCOV version 2.0-1