Eclipse SUMO - Simulation of Urban MObility
IntermodalTrip.h
Go to the documentation of this file.
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 /****************************************************************************/
20 // The "vehicle" definition for the Intermodal Router
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <string>
26 #include <vector>
27 
28 #include "EffortCalculator.h"
29 
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
35 template<class E, class N, class V>
37 public:
38  IntermodalTrip(const E* _from, const E* _to, double _departPos, double _arrivalPos,
39  double _speed, SUMOTime _departTime, const N* _node,
40  const V* _vehicle = 0, const SVCPermissions _modeSet = SVC_PEDESTRIAN,
41  const EffortCalculator* const _calc = nullptr, const double _externalFactor = 0.) :
42  from(_from),
43  to(_to),
44  departPos(_departPos < 0 ? _from->getLength() + _departPos : _departPos),
45  arrivalPos(_arrivalPos < 0 ? _to->getLength() + _arrivalPos : _arrivalPos),
46  speed(_speed),
47  departTime(_departTime),
48  node(_node),
49  vehicle(_vehicle),
50  modeSet(_modeSet),
51  calc(_calc),
52  externalFactor(_externalFactor) {
53  }
54 
55  // exists just for debugging purposes
56  std::string getID() const {
57  return from->getID() + ":" + to->getID() + ":" + time2string(departTime);
58  }
59 
60 
61  inline SUMOVehicleClass getVClass() const {
62  return vehicle != 0 ? vehicle->getVClass() : SVC_PEDESTRIAN;
63  }
64 
69  return vehicle != 0 ? vehicle->ignoreTransientPermissions() : false;
70  };
71 
72  inline double getLength() const {
73  // person length is arbitrary (only used in the context of rail-reversal validity
74  return vehicle != 0 ? vehicle->getVehicleType().getLength() : 1;
75  }
76 
77  // only used by AStar
78  inline double getMaxSpeed() const {
79  return vehicle != nullptr ? vehicle->getMaxSpeed() : speed;
80  }
81 
82  // only used by AStar
83  inline double getChosenSpeedFactor() const {
84  return vehicle != nullptr ? vehicle->getChosenSpeedFactor() : 1.0;
85  }
86 
87  const E* const from;
88  const E* const to;
89  const double departPos;
90  const double arrivalPos;
91  const double speed;
93  const N* const node; // indicates whether only routing across this node shall be performed
94  const V* const vehicle; // indicates which vehicle may be used
96  const EffortCalculator* const calc;
97  const double externalFactor;
98 
99 private:
102 };
long long int SUMOTime
Definition: GUI.h:35
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition: SUMOTime.cpp:69
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
the effort calculator interface
the "vehicle" type that is given to the internal router (SUMOAbstractRouter)
std::string getID() const
bool ignoreTransientPermissions() const
Returns whether this object is ignoring transient permission changes (during routing)
IntermodalTrip(const E *_from, const E *_to, double _departPos, double _arrivalPos, double _speed, SUMOTime _departTime, const N *_node, const V *_vehicle=0, const SVCPermissions _modeSet=SVC_PEDESTRIAN, const EffortCalculator *const _calc=nullptr, const double _externalFactor=0.)
const E *const to
const SVCPermissions modeSet
const EffortCalculator *const calc
double getLength() const
const double departPos
const E *const from
SUMOVehicleClass getVClass() const
const double arrivalPos
const double externalFactor
const V *const vehicle
const SUMOTime departTime
double getChosenSpeedFactor() const
double getMaxSpeed() const
IntermodalTrip & operator=(const IntermodalTrip &)
Invalidated assignment operator.
const double speed
const N *const node