LCOV - code coverage report
Current view: top level - src/microsim - MSEdgeWeightsStorage.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 1 1
Test Date: 2026-10-12 15:53:19 Functions: - 0 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2026 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    MSEdgeWeightsStorage.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @date    02.11.2009
      18              : ///
      19              : // A storage for edge travel times and efforts
      20              : /****************************************************************************/
      21              : #pragma once
      22              : #include <config.h>
      23              : 
      24              : #include <utils/common/ValueTimeLine.h>
      25              : 
      26              : 
      27              : // ===========================================================================
      28              : // class declarations
      29              : // ===========================================================================
      30              : class MSEdge;
      31              : class SUMOVehicle;
      32              : 
      33              : 
      34              : // ===========================================================================
      35              : // class definitions
      36              : // ===========================================================================
      37              : /**
      38              :  * @class MSEdgeWeightsStorage
      39              :  * @brief A storage for edge travel times and efforts
      40              :  */
      41              : class MSEdgeWeightsStorage {
      42              : public:
      43              :     /// @brief Constructor
      44              :     MSEdgeWeightsStorage();
      45              : 
      46              : 
      47              :     /// @brief Destructor
      48              :     ~MSEdgeWeightsStorage();
      49              : 
      50              : 
      51              :     /** @brief Returns a travel time for an edge and time if stored
      52              :      * @param[in] e The edge for which the travel time shall be retrieved
      53              :      * @param[in] t The time for which the travel time shall be retrieved
      54              :      * @param[in] value The value if the requested edge/time is described
      55              :      * @return Whether the requested edge/time is described
      56              :      */
      57              :     bool retrieveExistingTravelTime(const MSEdge* const e, const double t, double& value) const;
      58              : 
      59              : 
      60              :     /** @brief Returns an effort for an edge and time if stored
      61              :      * @param[in] e The edge for which the effort shall be retrieved
      62              :      * @param[in] t The time for which the effort shall be retrieved
      63              :      * @param[in] value The value if the requested edge/time is described
      64              :      * @return Whether the requested edge/time is described
      65              :      */
      66              :     bool retrieveExistingEffort(const MSEdge* const e, const double t, double& value) const;
      67              : 
      68              : 
      69              :     /** @brief Adds a travel time information for an edge and a time span
      70              :      * @param[in] e The described edge
      71              :      * @param[in] begin The begin of the described time span
      72              :      * @param[in] end The end of the described time span
      73              :      * @param[in] value The travel time value for this edge and time span
      74              :      */
      75              :     void addTravelTime(const MSEdge* const e, double begin, double end, double value);
      76              : 
      77              : 
      78              :     /** @brief Adds an effort information for an edge and a time span
      79              :      * @param[in] e The described edge
      80              :      * @param[in] begin The begin of the described time span
      81              :      * @param[in] end The end of the described time span
      82              :      * @param[in] value Theeffort value for this edge and time span
      83              :      */
      84              :     void addEffort(const MSEdge* const e, double begin, double end, double value);
      85              : 
      86              : 
      87              :     /** @brief Removes the travel time information for an edge
      88              :      * @param[in] e The described edge
      89              :      */
      90              :     void removeTravelTime(const MSEdge* const e);
      91              : 
      92              : 
      93              :     /** @brief Removes the effort information for an edge
      94              :      * @param[in] e The described edge
      95              :      */
      96              :     void removeEffort(const MSEdge* const e);
      97              : 
      98              : 
      99              :     /** @brief Returns whether neither travel times nor efforts are stored
     100              :      * @return Whether this storage holds no information at all
     101              :      */
     102              :     bool empty() const {
     103        32918 :         return myTravelTimes.empty() && myEfforts.empty();
     104              :     }
     105              : 
     106              : 
     107              :     /** @brief Returns the information whether any travel time is known for the given edge
     108              :      * @param[in] e The investigated edge
     109              :      * @return Whether any travel time information about this edge is stored
     110              :      */
     111              :     bool knowsTravelTime(const MSEdge* const e) const;
     112              : 
     113              : 
     114              :     /** @brief Returns the information whether any effort is known for the given edge
     115              :      * @param[in] e The investigated edge
     116              :      * @return Whether any travel time information about this edge is stored
     117              :      */
     118              :     bool knowsEffort(const MSEdge* const e) const;
     119              : 
     120              : 
     121              : private:
     122              :     /// @brief A map of edge->time->travel time
     123              :     std::map<const MSEdge*, ValueTimeLine<double> > myTravelTimes;
     124              : 
     125              :     /// @brief A map of edge->time->effort
     126              :     std::map<const MSEdge*, ValueTimeLine<double> > myEfforts;
     127              : 
     128              : 
     129              : private:
     130              :     /// @brief Invalidated copy constructor.
     131              :     MSEdgeWeightsStorage(const MSEdgeWeightsStorage&);
     132              : 
     133              :     /// @brief Invalidated assignment operator.
     134              :     MSEdgeWeightsStorage& operator=(const MSEdgeWeightsStorage&);
     135              : 
     136              : 
     137              : };
        

Generated by: LCOV version 2.0-1