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 /****************************************************************************/ 10 /// @file IntermodalTrip.h 11 /// @author Jakob Erdmann 12 /// @author Michael Behrisch 13 /// @author Robert Hilbrich 14 /// @date Mon, 03 March 2014 15 /// @version $Id$ 16 /// 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 // =========================================================================== 37 /// @brief the "vehicle" type that is given to the internal router (SUMOAbstractRouter) 38 template<class E, class N, class V> 39 class IntermodalTrip { 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.) : from(_from)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 getID()59 std::string getID() const { 60 return from->getID() + ":" + to->getID() + ":" + time2string(departTime); 61 } 62 63 getVClass()64 inline SUMOVehicleClass getVClass() const { 65 return vehicle != 0 ? vehicle->getVClass() : SVC_PEDESTRIAN; 66 } 67 68 // only used by AStar getMaxSpeed()69 inline double getMaxSpeed() const { 70 return vehicle != nullptr ? vehicle->getMaxSpeed() : speed; 71 } 72 73 // only used by AStar getChosenSpeedFactor()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; 83 const SUMOTime departTime; 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 86 const SVCPermissions modeSet; 87 const EffortCalculator* const calc; 88 const double externalFactor; 89 90 private: 91 /// @brief Invalidated assignment operator. 92 IntermodalTrip& operator=(const IntermodalTrip&); 93 }; 94 95 96 #endif 97 98 /****************************************************************************/ 99