Eclipse SUMO - Simulation of Urban MObility
MSVehicleTransfer.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2003-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 /****************************************************************************/
16 // A mover of vehicles that got stucked due to grid locks
17 // This class also serves as container for parking vehicles
18 /****************************************************************************/
19 #ifndef MSVehicleTransfer_h
20 #define MSVehicleTransfer_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <vector>
30 #include <map>
31 #include <set>
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class MSEdge;
39 class MSLane;
40 class MSVehicle;
41 class MSVehicleControl;
42 class SUMOSAXAttributes;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
64 public:
66  virtual ~MSVehicleTransfer();
67 
68 
77  void add(const SUMOTime t, MSVehicle* veh);
78 
79 
87  void remove(MSVehicle* veh);
88 
89 
98  void checkInsertions(SUMOTime time);
99 
100 
102  void saveState(OutputDevice& out);
103 
105  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset, MSVehicleControl& vc);
106 
110  static MSVehicleTransfer* getInstance();
111 
113  static const double TeleportMinSpeed;
114 
115 private:
118 
119 
120 protected:
133  bool myParking;
134 
140  VehicleInformation(SUMOTime t, MSVehicle* veh, SUMOTime proceedTime, bool parking)
141  : myTransferTime(t), myVeh(veh), myProceedTime(proceedTime), myParking(parking) { }
142 
144  bool operator<(const VehicleInformation& v2) const;
145  };
146 
147 
150 
153 
154 };
155 
156 
157 #endif
158 
159 /****************************************************************************/
160 
MSVehicleTransfer::VehicleInformation::myTransferTime
SUMOTime myTransferTime
the time at which this vehicle was removed from the network
Definition: MSVehicleTransfer.h:127
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSVehicleTransfer::remove
void remove(MSVehicle *veh)
Remove a vehicle from this transfer object.
Definition: MSVehicleTransfer.cpp:78
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
MSVehicleTransfer::MSVehicleTransfer
MSVehicleTransfer()
Constructor.
Definition: MSVehicleTransfer.cpp:193
MSVehicleTransfer::myVehicles
FXSynchQue< VehicleInformation, std::vector< VehicleInformation > > myVehicles
The information about stored vehicles to move virtually.
Definition: MSVehicleTransfer.h:149
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
MSVehicleTransfer::VehicleInformation::myProceedTime
SUMOTime myProceedTime
The time at which the vehicle should be moved virtually one edge further.
Definition: MSVehicleTransfer.h:131
MSVehicleTransfer
Definition: MSVehicleTransfer.h:63
FXSynchQue.h
MSVehicleTransfer::getInstance
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
Definition: MSVehicleTransfer.cpp:185
MSVehicleTransfer::VehicleInformation::operator<
bool operator<(const VehicleInformation &v2) const
sort by vehicle ID for repeatable parallel simulation
Definition: MSVehicleTransfer.cpp:50
MSVehicleTransfer::TeleportMinSpeed
static const double TeleportMinSpeed
The minimum speed while teleporting.
Definition: MSVehicleTransfer.h:113
MSVehicleTransfer::VehicleInformation::myParking
bool myParking
whether the vehicle is or was parking
Definition: MSVehicleTransfer.h:133
MSVehicleTransfer::myInstance
static MSVehicleTransfer * myInstance
The static singleton-instance.
Definition: MSVehicleTransfer.h:152
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
MSVehicleTransfer::checkInsertions
void checkInsertions(SUMOTime time)
Checks "movement" of stored vehicles.
Definition: MSVehicleTransfer.cpp:94
FXSynchQue
Definition: FXSynchQue.h:41
MSVehicleTransfer::VehicleInformation
Holds the information needed to move the vehicle over the network.
Definition: MSVehicleTransfer.h:125
MSVehicleTransfer::~MSVehicleTransfer
virtual ~MSVehicleTransfer()
Destructor.
Definition: MSVehicleTransfer.cpp:196
MSVehicleTransfer::add
void add(const SUMOTime t, MSVehicle *veh)
Adds a vehicle to this transfer object.
Definition: MSVehicleTransfer.cpp:56
config.h
MSVehicleControl
The class responsible for building and deletion of vehicles.
Definition: MSVehicleControl.h:71
MSVehicleTransfer::loadState
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset, MSVehicleControl &vc)
Loads one transfer vehicle state from the given descriptionn.
Definition: MSVehicleTransfer.cpp:217
MSVehicleTransfer::saveState
void saveState(OutputDevice &out)
Saves the current state into the given stream.
Definition: MSVehicleTransfer.cpp:202
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
MSVehicleTransfer::VehicleInformation::myVeh
MSVehicle * myVeh
The vehicle itself.
Definition: MSVehicleTransfer.h:129
MSVehicleTransfer::VehicleInformation::VehicleInformation
VehicleInformation(SUMOTime t, MSVehicle *veh, SUMOTime proceedTime, bool parking)
Constructor.
Definition: MSVehicleTransfer.h:140
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79