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.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // The "vehicle" definition for the Intermodal Router
18 /****************************************************************************/
19 #ifndef IntermodalTrip_h
20 #define IntermodalTrip_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <vector>
30 
31 #include "EffortCalculator.h"
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
38 template<class E, class N, class V>
40 public:
41  IntermodalTrip(const E* _from, const E* _to, double _departPos, double _arrivalPos,
42  double _speed, SUMOTime _departTime, const N* _node,
43  const V* _vehicle = 0, const SVCPermissions _modeSet = SVC_PEDESTRIAN,
44  const EffortCalculator* const _calc = nullptr, const double _externalFactor = 0.) :
45  from(_from),
46  to(_to),
47  departPos(_departPos < 0 ? _from->getLength() + _departPos : _departPos),
48  arrivalPos(_arrivalPos < 0 ? _to->getLength() + _arrivalPos : _arrivalPos),
49  speed(_speed),
50  departTime(_departTime),
51  node(_node),
52  vehicle(_vehicle),
53  modeSet(_modeSet),
54  calc(_calc),
55  externalFactor(_externalFactor) {
56  }
57 
58  // exists just for debugging purposes
59  std::string getID() const {
60  return from->getID() + ":" + to->getID() + ":" + time2string(departTime);
61  }
62 
63 
64  inline SUMOVehicleClass getVClass() const {
65  return vehicle != 0 ? vehicle->getVClass() : SVC_PEDESTRIAN;
66  }
67 
68  // only used by AStar
69  inline double getMaxSpeed() const {
70  return vehicle != nullptr ? vehicle->getMaxSpeed() : speed;
71  }
72 
73  // only used by AStar
74  inline double getChosenSpeedFactor() const {
75  return vehicle != nullptr ? vehicle->getChosenSpeedFactor() : 1.0;
76  }
77 
78  const E* const from;
79  const E* const to;
80  const double departPos;
81  const double arrivalPos;
82  const double speed;
84  const N* const node; // indicates whether only routing across this node shall be performed
85  const V* const vehicle; // indicates which vehicle may be used
87  const EffortCalculator* const calc;
88  const double externalFactor;
89 
90 private:
93 };
94 
95 
96 #endif
97 
98 /****************************************************************************/
SUMOVehicleClass getVClass() const
long long int SUMOTime
Definition: SUMOTime.h:35
const V *const vehicle
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:65
std::string getID() const
double getMaxSpeed() const
const N *const node
const EffortCalculator *const calc
const E *const to
the effort calculator interface
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.)
double getChosenSpeedFactor() const
const double departPos
const double speed
const SUMOTime departTime
const double arrivalPos
const SVCPermissions modeSet
const double externalFactor
IntermodalTrip & operator=(const IntermodalTrip &)
Invalidated assignment operator.
the "vehicle" type that is given to the internal router (SUMOAbstractRouter)
const E *const from