LCOV - code coverage report
Current view: top level - src/activitygen/activities - AGTrip.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 34 34 100.0 %
Date: 2024-04-27 15:34:54 Functions: 5 5 100.0 %

          Line data    Source code
       1             : /****************************************************************************/
       2             : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3             : // Copyright (C) 2010-2024 German Aerospace Center (DLR) and others.
       4             : // activitygen module
       5             : // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
       6             : // This program and the accompanying materials are made available under the
       7             : // terms of the Eclipse Public License 2.0 which is available at
       8             : // https://www.eclipse.org/legal/epl-2.0/
       9             : // This Source Code may also be made available under the following Secondary
      10             : // Licenses when the conditions for such availability set forth in the Eclipse
      11             : // Public License 2.0 are satisfied: GNU General Public License, version 2
      12             : // or later which is available at
      13             : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      14             : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      15             : /****************************************************************************/
      16             : /// @file    AGTrip.h
      17             : /// @author  Piotr Woznica
      18             : /// @author  Daniel Krajzewicz
      19             : /// @author  Walter Bamberger
      20             : /// @author  Jakob Erdmann
      21             : /// @author  Michael Behrisch
      22             : /// @date    July 2010
      23             : ///
      24             : // Class containing all information of a given trip (car, bus)
      25             : /****************************************************************************/
      26             : #pragma once
      27             : #include <config.h>
      28             : 
      29             : #include <list>
      30             : #include <activitygen/city/AGPosition.h>
      31             : #include <activitygen/city/AGCar.h>
      32             : #include <activitygen/city/AGBus.h>
      33             : 
      34             : 
      35             : // ===========================================================================
      36             : // class definitions
      37             : // ===========================================================================
      38             : class AGTrip {
      39             : public:
      40         108 :     AGTrip(AGPosition from, AGPosition to, int at) : //vehicle not specified
      41         108 :         myFrom(from),
      42         108 :         myTo(to),
      43         108 :         myDepTime(at),
      44         108 :         myType("default"),
      45         108 :         myDay(0) {};
      46         577 :     AGTrip(AGPosition from, AGPosition to, AGCar c, int at) :
      47         577 :         myFrom(from),
      48         577 :         myTo(to),
      49         577 :         myDepTime(at),
      50         577 :         myVehicle(c.getName()),
      51         577 :         myType("default"),
      52         577 :         myDay(0) {};
      53        1010 :     AGTrip(AGPosition from, AGPosition to, AGBus b, int at) :
      54        1010 :         myFrom(from),
      55        1010 :         myTo(to),
      56        1010 :         myDepTime(at),
      57        1010 :         myVehicle(b.getName()),
      58        1010 :         myType("bus"),
      59        1010 :         myDay(0) {};
      60        1377 :     AGTrip(AGPosition from, AGPosition to, std::string v, int at) :
      61        1377 :         myFrom(from),
      62        1377 :         myTo(to),
      63        1377 :         myDepTime(at),
      64        1377 :         myVehicle(v),
      65        1377 :         myType("default"),
      66        1377 :         myDay(0) {};
      67        9842 :     AGTrip(AGPosition from, AGPosition to, std::string v, int at, int day) :
      68        9842 :         myFrom(from),
      69        9842 :         myTo(to),
      70        9842 :         myDepTime(at),
      71        9842 :         myVehicle(v),
      72        9842 :         myType("default"),
      73        9842 :         myDay(day) {};
      74             :     void print() const;
      75             :     bool operator<(const AGTrip& trip) const;
      76             : 
      77             :     void addLayOver(AGPosition by);
      78             :     void addLayOver(AGTrip& trip);
      79             :     void addLayOverWithoutDestination(AGTrip& trip);
      80             : 
      81             :     AGPosition getDep() const;
      82             :     AGPosition getArr() const;
      83             :     int getTime() const;
      84             :     void setDepTime(int time);
      85             :     const std::string& getVehicleName() const;
      86             :     void setVehicleName(std::string name);
      87             :     void setArr(AGPosition arrival);
      88             :     void setDep(AGPosition departure);
      89             :     int getDay() const;
      90             :     void setDay(int day);
      91             :     const std::string& getType() const;
      92             :     void setType(std::string type);
      93             :     const std::list<AGPosition>* getPassed() const;
      94             : 
      95             :     /**
      96             :      * returns the time regarding the departure time
      97             :      * going through the different points and coming back to the initial position
      98             :      * given the time to make one kilometer
      99             :      */
     100             :     int getRideBackArrTime(double secPerKm) const;
     101             :     /**
     102             :      * returns the estimated arrival time
     103             :      * given the time to make one kilometer
     104             :      */
     105             :     int getArrTime(double secPerKm) const;
     106             :     /**
     107             :      * gives the time in seconds for the trip
     108             :      * given a speed in seconds per kilometer (in city, not car speed
     109             :      * but time needed to make a distance in the city)
     110             :      */
     111             :     int getTimeTrip(double secPerKm) const;
     112             :     /**
     113             :      * estimate the departure time needed for a given arrival time
     114             :      * and a speed in seconds per kilometer
     115             :      */
     116             :     int estimateDepTime(int arrTime, double secPerKm) const;
     117             :     /**
     118             :      * returns whether this is a daily trip or a one day trip
     119             :      */
     120             :     bool isDaily() const;
     121             : 
     122             : private:
     123             :     AGPosition myFrom;
     124             :     AGPosition myTo;
     125             :     int myDepTime;
     126             :     std::string myVehicle;
     127             :     /**
     128             :      * indicates if it is a bus or a car (or any type)
     129             :      * "bus", "default" or "random" (which is a kind of default)
     130             :      */
     131             :     std::string myType;
     132             :     /**
     133             :      * if everyday : 0
     134             :      * else        : number of the day ( != 0 )
     135             :      */
     136             :     int myDay;
     137             :     std::list<AGPosition> myPassBy;
     138             : };

Generated by: LCOV version 1.14