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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // A mover of vehicles that got stucked due to grid locks
20 // This class also serves as container for parking vehicles
21 /****************************************************************************/
22 #ifndef MSVehicleTransfer_h
23 #define MSVehicleTransfer_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <vector>
37 #include <map>
38 #include <set>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MSEdge;
45 class MSLane;
46 class MSVehicle;
47 class MSVehicleControl;
48 class SUMOSAXAttributes;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
70 public:
72  virtual ~MSVehicleTransfer();
73 
74 
83  void add(const SUMOTime t, MSVehicle* veh);
84 
85 
93  void remove(MSVehicle* veh);
94 
95 
104  void checkInsertions(SUMOTime time);
105 
106 
111  bool hasPending() const;
112 
114  void saveState(OutputDevice& out) const;
115 
117  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset, MSVehicleControl& vc);
118 
122  static MSVehicleTransfer* getInstance();
123 
125  static const double TeleportMinSpeed;
126 
127 private:
130 
131 
132 protected:
145  bool myParking;
146 
152  VehicleInformation(SUMOTime t, MSVehicle* veh, SUMOTime proceedTime, bool parking)
153  : myTransferTime(t), myVeh(veh), myProceedTime(proceedTime), myParking(parking) { }
154 
155  };
156 
157 
159  typedef std::vector<VehicleInformation> VehicleInfVector;
160 
162  VehicleInfVector myVehicles;
163 
166 
168  static const std::set<const MSVehicle*> myEmptyVehicleSet;
169 
170 };
171 
172 
173 #endif
174 
175 /****************************************************************************/
176 
VehicleInformation(SUMOTime t, MSVehicle *veh, SUMOTime proceedTime, bool parking)
Constructor.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
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:80
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:70
long long int SUMOTime
Definition: TraCIDefs.h:51
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:77
static const double TeleportMinSpeed
The minimum speed while teleporting.