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 
MSVehicleTransfer::VehicleInformation::myTransferTime
SUMOTime myTransferTime
the time at which this vehicle was removed from the network
Definition: MSVehicleTransfer.h:128
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSVehicleTransfer::remove
void remove(MSVehicle *veh)
Remove a vehicle from this transfer object.
Definition: MSVehicleTransfer.cpp:79
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
MSVehicleTransfer::MSVehicleTransfer
MSVehicleTransfer()
Constructor.
Definition: MSVehicleTransfer.cpp:190
MSVehicleTransfer::myVehicles
FXSynchQue< VehicleInformation, std::vector< VehicleInformation > > myVehicles
The information about stored vehicles to move virtually.
Definition: MSVehicleTransfer.h:150
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSVehicleTransfer::VehicleInformation::myProceedTime
SUMOTime myProceedTime
The time at which the vehicle should be moved virtually one edge further.
Definition: MSVehicleTransfer.h:132
MSVehicleTransfer
Definition: MSVehicleTransfer.h:64
FXSynchQue.h
MSVehicleTransfer::getInstance
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
Definition: MSVehicleTransfer.cpp:182
MSVehicleTransfer::VehicleInformation::operator<
bool operator<(const VehicleInformation &v2) const
sort by vehicle ID for repeatable parallel simulation
Definition: MSVehicleTransfer.cpp:51
MSVehicleTransfer::TeleportMinSpeed
static const double TeleportMinSpeed
The minimum speed while teleporting.
Definition: MSVehicleTransfer.h:114
MSVehicleTransfer::VehicleInformation::myParking
bool myParking
whether the vehicle is or was parking
Definition: MSVehicleTransfer.h:134
MSVehicleTransfer::myInstance
static MSVehicleTransfer * myInstance
The static singleton-instance.
Definition: MSVehicleTransfer.h:153
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
MSVehicleTransfer::checkInsertions
void checkInsertions(SUMOTime time)
Checks "movement" of stored vehicles.
Definition: MSVehicleTransfer.cpp:95
FXSynchQue
Definition: FXSynchQue.h:34
MSVehicleTransfer::VehicleInformation
Holds the information needed to move the vehicle over the network.
Definition: MSVehicleTransfer.h:126
MSVehicleTransfer::~MSVehicleTransfer
virtual ~MSVehicleTransfer()
Destructor.
Definition: MSVehicleTransfer.cpp:193
MSVehicleTransfer::add
void add(const SUMOTime t, MSVehicle *veh)
Adds a vehicle to this transfer object.
Definition: MSVehicleTransfer.cpp:57
config.h
MSVehicleControl
The class responsible for building and deletion of vehicles.
Definition: MSVehicleControl.h:72
MSVehicleTransfer::loadState
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset, MSVehicleControl &vc)
Loads one transfer vehicle state from the given descriptionn.
Definition: MSVehicleTransfer.cpp:214
MSVehicleTransfer::saveState
void saveState(OutputDevice &out)
Saves the current state into the given stream.
Definition: MSVehicleTransfer.cpp:199
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:57
MSVehicleTransfer::VehicleInformation::myVeh
MSVehicle * myVeh
The vehicle itself.
Definition: MSVehicleTransfer.h:130
MSVehicleTransfer::VehicleInformation::VehicleInformation
VehicleInformation(SUMOTime t, MSVehicle *veh, SUMOTime proceedTime, bool parking)
Constructor.
Definition: MSVehicleTransfer.h:141
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80