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-2018 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>
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 
105  bool hasPending() const;
106 
108  void saveState(OutputDevice& out) const;
109 
111  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset, MSVehicleControl& vc);
112 
116  static MSVehicleTransfer* getInstance();
117 
119  static const double TeleportMinSpeed;
120 
121 private:
124 
125 
126 protected:
139  bool myParking;
140 
146  VehicleInformation(SUMOTime t, MSVehicle* veh, SUMOTime proceedTime, bool parking)
147  : myTransferTime(t), myVeh(veh), myProceedTime(proceedTime), myParking(parking) { }
148 
149  };
150 
151 
153  typedef std::vector<VehicleInformation> VehicleInfVector;
154 
156  VehicleInfVector myVehicles;
157 
160 
162  static const std::set<const MSVehicle*> myEmptyVehicleSet;
163 
164 };
165 
166 
167 #endif
168 
169 /****************************************************************************/
170 
VehicleInformation(SUMOTime t, MSVehicle *veh, SUMOTime proceedTime, bool parking)
Constructor.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
long long int SUMOTime
Definition: SUMOTime.h:36
static MSVehicleTransfer * myInstance
The static singleton-instance.
Holds the information needed to move the vehicle over the network.
MSVehicleTransfer()
Constructor.
VehicleInfVector myVehicles
The information about stored vehicles to move virtually.
virtual ~MSVehicleTransfer()
Destructor.
bool myParking
whether the vehicle is or was parking
A road/street connecting two junctions.
Definition: MSEdge.h:75
void saveState(OutputDevice &out) const
Saves the current state into the given stream.
void checkInsertions(SUMOTime time)
Checks "movement" of stored vehicles.
Encapsulated SAX-Attributes.
bool hasPending() const
Checks whether stored vehicles are present.
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.
static const std::set< const MSVehicle * > myEmptyVehicleSet
an empty set for convenience
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.
std::vector< VehicleInformation > VehicleInfVector
Definition of a container for vehicle information.
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:78
static const double TeleportMinSpeed
The minimum speed while teleporting.