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 /****************************************************************************/
17 // A mover of vehicles that got stucked due to grid locks
18 // This class also serves as container for parking vehicles
19 /****************************************************************************/
20 #ifndef MSVehicleTransfer_h
21 #define MSVehicleTransfer_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <string>
30 #include <vector>
31 #include <map>
32 #include <set>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class MSEdge;
40 class MSLane;
41 class MSVehicle;
42 class MSVehicleControl;
43 class SUMOSAXAttributes;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
65 public:
67  virtual ~MSVehicleTransfer();
68 
69 
78  void add(const SUMOTime t, MSVehicle* veh);
79 
80 
88  void remove(MSVehicle* veh);
89 
90 
99  void checkInsertions(SUMOTime time);
100 
101 
103  void saveState(OutputDevice& out);
104 
106  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset, MSVehicleControl& vc);
107 
111  static MSVehicleTransfer* getInstance();
112 
114  static const double TeleportMinSpeed;
115 
116 private:
119 
120 
121 protected:
134  bool myParking;
135 
141  VehicleInformation(SUMOTime t, MSVehicle* veh, SUMOTime proceedTime, bool parking)
142  : myTransferTime(t), myVeh(veh), myProceedTime(proceedTime), myParking(parking) { }
143 
145  bool operator<(const VehicleInformation& v2) const;
146  };
147 
148 
151 
154 
155 };
156 
157 
158 #endif
159 
160 /****************************************************************************/
161 
VehicleInformation(SUMOTime t, MSVehicle *veh, SUMOTime proceedTime, bool parking)
Constructor.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
long long int SUMOTime
Definition: SUMOTime.h:35
static MSVehicleTransfer * myInstance
The static singleton-instance.
Holds the information needed to move the vehicle over the network.
MSVehicleTransfer()
Constructor.
bool operator<(const VehicleInformation &v2) const
sort by vehicle ID for repeatable parallel simulation
virtual ~MSVehicleTransfer()
Destructor.
FXSynchQue< VehicleInformation, std::vector< VehicleInformation > > myVehicles
The information about stored vehicles to move virtually.
bool myParking
whether the vehicle is or was parking
A road/street connecting two junctions.
Definition: MSEdge.h:76
void saveState(OutputDevice &out)
Saves the current state into the given stream.
void checkInsertions(SUMOTime time)
Checks "movement" of stored vehicles.
Encapsulated SAX-Attributes.
void add(const SUMOTime t, MSVehicle *veh)
Adds a vehicle to this transfer object.
SUMOTime myProceedTime
The time at which the vehicle should be moved virtually one edge further.
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset, MSVehicleControl &vc)
Loads one transfer vehicle state from the given descriptionn.
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
MSVehicle * myVeh
The vehicle itself.
SUMOTime myTransferTime
the time at which this vehicle was removed from the network
The class responsible for building and deletion of vehicles.
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
static const double TeleportMinSpeed
The minimum speed while teleporting.