LCOV - code coverage report
Current view: top level - src/router - RONode.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 5 5
Test Date: 2024-11-23 15:47:30 Functions: - 0 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2024 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    RONode.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @author  Ruediger Ebendt
      18              : /// @date    Sept 2002
      19              : ///
      20              : // Base class for nodes used by the router
      21              : /****************************************************************************/
      22              : #pragma once
      23              : #include <config.h>
      24              : 
      25              : #include <string>
      26              : #include <vector>
      27              : #include <utils/common/Named.h>
      28              : #include <utils/geom/Position.h>
      29              : #include <utils/router/FlippedNode.h>
      30              : #include <router/ROVehicle.h>
      31              : 
      32              : // ===========================================================================
      33              : // class declarations
      34              : // ===========================================================================
      35              : class ROEdge;
      36              : 
      37              : typedef std::vector<const ROEdge*> ConstROEdgeVector;
      38              : 
      39              : // ===========================================================================
      40              : // class definitions
      41              : // ===========================================================================
      42              : /**
      43              :  * @class RONode
      44              :  * @brief Base class for nodes used by the router
      45              :  */
      46              : class RONode : public Named {
      47              : public:
      48              :     /** @brief Constructor
      49              :      * @param[in] id The id of the node
      50              :      */
      51              :     RONode(const std::string& id);
      52              : 
      53              : 
      54              :     /// @brief Destructor
      55              :     ~RONode();
      56              : 
      57              : 
      58              :     /** @brief Sets the position of the node
      59              :      * @param[in] p The node's position
      60              :      */
      61              :     void setPosition(const Position& p);
      62              : 
      63              : 
      64              :     /** @brief Returns the position of the node
      65              :      * @return This node's position
      66              :      */
      67              :     const Position& getPosition() const {
      68       492629 :         return myPosition;
      69              :     }
      70              : 
      71              : 
      72              :     inline const ConstROEdgeVector& getIncoming() const {
      73              :         return myIncoming;
      74              :     }
      75              : 
      76              :     inline const ConstROEdgeVector& getOutgoing() const {
      77              :         return myOutgoing;
      78              :     }
      79              : 
      80              :     void addIncoming(ROEdge* edge) {
      81       446286 :         myIncoming.push_back(edge);
      82       446286 :     }
      83              : 
      84              :     void addOutgoing(ROEdge* edge) {
      85       446286 :         myOutgoing.push_back(edge);
      86       446286 :     }
      87              : 
      88              :     /// @brief Returns the flipped routing node
      89              :     // @note If not called before, the flipped routing node is created
      90              :     FlippedNode<ROEdge, RONode, ROVehicle>* getFlippedRoutingNode() const {
      91              :         if (myFlippedRoutingNode == nullptr) {
      92              :             myFlippedRoutingNode = new FlippedNode<ROEdge, RONode, ROVehicle>(this);
      93              :         }
      94              :         return myFlippedRoutingNode;
      95              :     }
      96              : 
      97              : private:
      98              :     /// @brief This node's position
      99              :     Position myPosition;
     100              : 
     101              :     /// @brief Incoming edges
     102              :     ConstROEdgeVector myIncoming;
     103              :     /// @brief Outgoing edges
     104              :     ConstROEdgeVector myOutgoing;
     105              :     /// @brief Flipped routing node
     106              :     mutable FlippedNode<ROEdge, RONode, ROVehicle>* myFlippedRoutingNode = nullptr;
     107              : 
     108              : 
     109              : private:
     110              :     /// @brief Invalidated copy constructor
     111              :     RONode(const RONode& src);
     112              : 
     113              :     /// @brief Invalidated assignment operator
     114              :     RONode& operator=(const RONode& src);
     115              : 
     116              : };
        

Generated by: LCOV version 2.0-1