LCOV - code coverage report
Current view: top level - src/microsim - MSStop.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 2 2
Test Date: 2024-11-22 15:46:21 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2005-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    MSStop.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @date    Mon, 13.12.2005
      18              : ///
      19              : // A lane area vehicles can halt at
      20              : /****************************************************************************/
      21              : #pragma once
      22              : #include <config.h>
      23              : 
      24              : #include <utils/vehicle/SUMOVehicleParameter.h>
      25              : #include "MSRoute.h"
      26              : 
      27              : 
      28              : // ===========================================================================
      29              : // class declarations
      30              : // ===========================================================================
      31              : class MSLane;
      32              : class MESegment;
      33              : class MSStoppingPlace;
      34              : class MSParkingArea;
      35              : class SUMOVehicle;
      36              : 
      37              : 
      38              : // ===========================================================================
      39              : // class definitions
      40              : // ===========================================================================
      41              : /** @class Stop
      42              :  * @brief Definition of vehicle stop (position and duration)
      43              :  */
      44       185513 : class MSStop {
      45              : public:
      46       127207 :     MSStop(const SUMOVehicleParameter::Stop& par) : pars(par) {}
      47              :     /// @brief The edge in the route to stop at
      48              :     MSRouteIterator edge;
      49              :     /// @brief The lane to stop at (microsim only)
      50              :     const MSLane* lane = nullptr;
      51              :     /// @brief The segment to stop at (mesosim only)
      52              :     const MESegment* segment = nullptr;
      53              :     /// @brief (Optional) bus stop if one is assigned to the stop
      54              :     MSStoppingPlace* busstop = nullptr;
      55              :     /// @brief (Optional) container stop if one is assigned to the stop
      56              :     MSStoppingPlace* containerstop = nullptr;
      57              :     /// @brief (Optional) parkingArea if one is assigned to the stop
      58              :     MSParkingArea* parkingarea = nullptr;
      59              :     /// @brief (Optional) charging station if one is assigned to the stop
      60              :     MSStoppingPlace* chargingStation = nullptr;
      61              :     /// @brief (Optional) overhead wire segment if one is assigned to the stop
      62              :     /// @todo Check that this should really be a stopping place instance
      63              :     MSStoppingPlace* overheadWireSegment = nullptr;
      64              :     /// @brief The stop parameter
      65              :     const SUMOVehicleParameter::Stop pars;
      66              :     /// @brief The stopping duration
      67              :     SUMOTime duration = -1;
      68              :     /// @brief whether an arriving person lets the vehicle continue
      69              :     bool triggered = false;
      70              :     /// @brief whether an arriving container lets the vehicle continue
      71              :     bool containerTriggered = false;
      72              :     /// @brief whether coupling another vehicle (train) the vehicle continue
      73              :     bool joinTriggered = false;
      74              :     /// @brief Information whether the stop has been reached
      75              :     bool reached = false;
      76              :     /// @brief The number of still expected persons
      77              :     int numExpectedPerson = 0;
      78              :     /// @brief The number of still expected containers
      79              :     int numExpectedContainer = 0;
      80              :     /// @brief The time at which the vehicle is able to board another person
      81              :     SUMOTime timeToBoardNextPerson = 0;
      82              :     /// @brief The time at which the vehicle is able to load another container
      83              :     SUMOTime timeToLoadNextContainer = 0;
      84              :     /// @brief the maximum time at which persons may board this vehicle
      85              :     SUMOTime endBoarding = SUMOTime_MAX;
      86              :     /// @brief whether this an opposite-direction stop
      87              :     bool isOpposite = false;
      88              :     /// @brief whether the decision to skip this stop has been made
      89              :     bool skipOnDemand = false;
      90              :     /// @brief whether the 'started' value was loaded from simulaton state
      91              :     bool startedFromState = false;
      92              : 
      93              :     /// @brief Write the current stop configuration (used for state saving)
      94              :     void write(OutputDevice& dev) const;
      95              : 
      96              :     /// @brief return halting position for upcoming stop;
      97              :     double getEndPos(const SUMOVehicle& veh) const;
      98              : 
      99              :     /// @brief return startPos taking into account opposite stopping
     100              :     double getReachedThreshold() const;
     101              : 
     102              :     /// @brief get a short description for showing in the gui
     103              :     std::string getDescription() const;
     104              : 
     105              :     /// @brief initialize attributes from the given stop parameters
     106              :     void initPars(const SUMOVehicleParameter::Stop& stopPar);
     107              : 
     108              :     const MSEdge* getEdge() const;
     109              : 
     110              :     /// @brief return flags as used by Vehicle::getStopState
     111              :     int getStateFlagsOld() const;
     112              : 
     113              :     /// @brief return minimum stop duration when starting stop at time
     114              :     SUMOTime getMinDuration(SUMOTime time) const;
     115              : 
     116              :     /// @brief return until / ended time
     117              :     SUMOTime getUntil() const;
     118              : 
     119              :     /// @brief return arrival / started time
     120              :     SUMOTime getArrival() const;
     121              : 
     122              :     /// @brief return speed for passing waypoint / skipping on-demand stop
     123              :     double getSpeed() const;
     124              : 
     125              :     /// @brief whether the stop is in range of the given position
     126              :     bool isInRange(const double pos, const double tolerance) const;
     127              : };
        

Generated by: LCOV version 2.0-1