LCOV - code coverage report
Current view: top level - src/microsim/transportables - MSStageTranship.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 4 8 50.0 %
Date: 2024-05-06 15:32:35 Functions: 2 4 50.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    MSStageTranship.h
      15             : /// @author  Melanie Weber
      16             : /// @author  Andreas Kendziorra
      17             : /// @date    Thu, 12 Jun 2014
      18             : ///
      19             : // The class for modelling container-movements
      20             : /****************************************************************************/
      21             : #pragma once
      22             : #include <config.h>
      23             : 
      24             : #include <string>
      25             : #include <vector>
      26             : #include <set>
      27             : #include <utils/common/SUMOTime.h>
      28             : #include <utils/common/Command.h>
      29             : #include <utils/geom/Position.h>
      30             : #include <utils/geom/PositionVector.h>
      31             : #include <microsim/transportables/MSTransportable.h>
      32             : 
      33             : 
      34             : // ===========================================================================
      35             : // class declarations
      36             : // ===========================================================================
      37             : class MSNet;
      38             : class MSEdge;
      39             : class MSLane;
      40             : class OutputDevice;
      41             : class SUMOVehicleParameter;
      42             : class MSStoppingPlace;
      43             : class SUMOVehicle;
      44             : class MSVehicleType;
      45             : class MSCModel_NonInteracting;
      46             : class CState;
      47             : 
      48             : 
      49             : // ===========================================================================
      50             : // class definitions
      51             : // ===========================================================================
      52             : /**
      53             :  * A "real" stage performing the tranship of a container
      54             :  * A container is in this stage if it gets transhiped between two stops that are
      55             :  * assumed to be connected.
      56             :  */
      57             : class MSStageTranship : public MSStageMoving {
      58             : 
      59             : public:
      60             :     /// constructor
      61             :     MSStageTranship(const std::vector<const MSEdge*>& route, MSStoppingPlace* toStop, double speed, double departPos, double arrivalPos);
      62             : 
      63             :     /// destructor
      64             :     ~MSStageTranship();
      65             : 
      66             :     MSStage* clone() const;
      67             : 
      68             :     /// proceeds to the next step
      69             :     void proceed(MSNet* net, MSTransportable* transportable, SUMOTime now, MSStage* previous);
      70             : 
      71             :     /// @brief get travel distance in this stage
      72             :     double getDistance() const;
      73             : 
      74             :     /// Returns the current stage description as a string
      75           0 :     std::string getStageDescription(const bool isPerson) const {
      76             :         UNUSED_PARAMETER(isPerson);
      77           0 :         return "tranship";
      78             :     }
      79             :     std::string getStageSummary(const bool isPerson) const;
      80             : 
      81             :     /** @brief Called on writing tripinfo output
      82             :      * @param[in] os The stream to write the information into
      83             :      * @exception IOError not yet implemented
      84             :      */
      85             :     void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const;
      86             : 
      87             :     /** @brief Called on writing vehroute output
      88             :      * @param[in] isPerson Whether we are writing person or container info
      89             :      * @param[in] os The stream to write the information into
      90             :      * @param[in] withRouteLength whether route length shall be written
      91             :      * @param[in] previous The previous stage for additional info such as from edge
      92             :      * @exception IOError not yet implemented
      93             :      */
      94             :     void routeOutput(const bool isPerson, OutputDevice& os, const bool withRouteLength, const MSStage* const previous) const;
      95             : 
      96             :     /// @brief move forward and return whether the container arrived
      97             :     bool moveToNextEdge(MSTransportable* container, SUMOTime currentTime, int prevDir, MSEdge* nextInternal = 0);
      98             : 
      99             : 
     100             :     /// @brief the maximum speed of the transportable
     101      219163 :     inline double getMaxSpeed(const MSTransportable* const transportable = nullptr) const {
     102             :         UNUSED_PARAMETER(transportable);
     103      219163 :         return mySpeed;
     104             :     }
     105             : 
     106      109639 :     inline double getArrivalPos() const {
     107      109639 :         return myArrivalPos;
     108             :     }
     109             : 
     110           0 :     inline const MSEdge* getNextRouteEdge() const {
     111           0 :         return myRouteStep == myRoute.end() - 1 ? 0 : *(myRouteStep + 1);
     112             :     }
     113             : 
     114             : private:
     115             :     /// @brief Invalidated copy constructor.
     116             :     MSStageTranship(const MSStageTranship&);
     117             : 
     118             :     /// @brief Invalidated assignment operator.
     119             :     MSStageTranship& operator=(const MSStageTranship&);
     120             : 
     121             : };

Generated by: LCOV version 1.14