SUMO - Simulation of Urban MObility
MSVehicleTransfer.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A mover of vehicles that got stucked due to grid locks
10 // This class also serves as container for parking vehicles
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef MSVehicleTransfer_h
24 #define MSVehicleTransfer_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
37 #include <vector>
38 #include <map>
39 #include <set>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class MSEdge;
46 class MSLane;
47 class MSVehicle;
48 class MSVehicleControl;
49 class SUMOSAXAttributes;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
71 public:
73  virtual ~MSVehicleTransfer();
74 
75 
84  void add(const SUMOTime t, MSVehicle* veh);
85 
86 
94  void remove(MSVehicle* veh);
95 
96 
105  void checkInsertions(SUMOTime time);
106 
107 
112  bool hasPending() const;
113 
115  const std::set<const MSVehicle*>& getParkingVehicles(const MSLane* lane) const;
116 
118  void saveState(OutputDevice& out) const;
119 
121  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset, MSVehicleControl& vc);
122 
126  static MSVehicleTransfer* getInstance();
127 
129  static const double TeleportMinSpeed;
130 
131 private:
134 
135 
136 protected:
147  bool myParking;
148 
154  VehicleInformation(MSVehicle* veh, SUMOTime proceedTime, bool parking)
155  : myVeh(veh), myProceedTime(proceedTime), myParking(parking) { }
156 
157  };
158 
159 
161  typedef std::vector<VehicleInformation> VehicleInfVector;
162 
164  VehicleInfVector myVehicles;
165 
167  typedef std::map<const MSLane*, std::set<const MSVehicle*> > ParkingVehicles;
168  ParkingVehicles myParkingVehicles;
169 
172 
174  static const std::set<const MSVehicle*> myEmptyVehicleSet;
175 
176 };
177 
178 
179 #endif
180 
181 /****************************************************************************/
182 
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.
std::map< const MSLane *, std::set< const MSVehicle * > > ParkingVehicles
The map from lanes to parking vehicles.
bool myParking
whether the vehicle is or was parking
const std::set< const MSVehicle * > & getParkingVehicles(const MSLane *lane) const
return parking vehicles on the given lane
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.
ParkingVehicles myParkingVehicles
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
std::vector< VehicleInformation > VehicleInfVector
Definition of a container for vehicle information.
VehicleInformation(MSVehicle *veh, SUMOTime proceedTime, bool parking)
Constructor.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
long long int SUMOTime
Definition: TraCIDefs.h:52
MSVehicle * myVeh
The vehicle itself.
The class responsible for building and deletion of vehicles.
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
static const double TeleportMinSpeed
The minimum speed while teleporting.