Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSVehicleTransfer.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2003-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// A mover of vehicles that got stucked due to grid locks
21// This class also serves as container for parking vehicles
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <string>
27#include <vector>
28#include <map>
29#include <set>
31
32
33// ===========================================================================
34// class declarations
35// ===========================================================================
36class MSEdge;
37class MSLane;
38class MSVehicle;
41
42
43// ===========================================================================
44// class definitions
45// ===========================================================================
62public:
64 virtual ~MSVehicleTransfer();
65
66
75 void add(const SUMOTime t, MSVehicle* veh);
76
77
85 void remove(MSVehicle* veh);
86
87
96 void checkInsertions(SUMOTime time);
97
98
100 void saveState(OutputDevice& out);
101
103 void clearState();
104
106 void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset, MSVehicleControl& vc);
107
112
114 static const double TeleportMinSpeed;
115
116private:
119
120
121protected:
137
143 VehicleInformation(SUMOTime t, MSVehicle* veh, SUMOTime proceedTime, bool parking, bool jumping)
144 : myTransferTime(t), myVeh(veh), myProceedTime(proceedTime), myParking(parking), myJumping(jumping) { }
145
147 bool operator<(const VehicleInformation& v2) const;
148 };
149
150
153
156
157};
long long int SUMOTime
Definition GUI.h:36
A road/street connecting two junctions.
Definition MSEdge.h:77
Representation of a lane in the micro simulation.
Definition MSLane.h:84
The class responsible for building and deletion of vehicles.
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
void remove(MSVehicle *veh)
Remove a vehicle from this transfer object.
virtual ~MSVehicleTransfer()
Destructor.
void add(const SUMOTime t, MSVehicle *veh)
Adds a vehicle to this transfer object.
void saveState(OutputDevice &out)
Saves the current state into the given stream.
void checkInsertions(SUMOTime time)
Checks "movement" of stored vehicles.
MFXSynchQue< VehicleInformation, std::vector< VehicleInformation > > myVehicles
The information about stored vehicles to move virtually.
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset, MSVehicleControl &vc)
Loads one transfer vehicle state from the given descriptionn.
MSVehicleTransfer()
Constructor.
static MSVehicleTransfer * myInstance
The static singleton-instance.
void clearState()
Remove all vehicles before quick-loading state.
static const double TeleportMinSpeed
The minimum speed while teleporting.
Static storage of an output device and its base (abstract) implementation.
Encapsulated SAX-Attributes.
Holds the information needed to move the vehicle over the network.
bool myParking
whether the vehicle is or was parking
bool myJumping
whether the vehicle is or was jumping
SUMOTime myTransferTime
the time at which this vehicle was removed from the network
MSVehicle * myVeh
The vehicle itself.
SUMOTime myProceedTime
The time at which the vehicle should be moved virtually one edge further.
VehicleInformation(SUMOTime t, MSVehicle *veh, SUMOTime proceedTime, bool parking, bool jumping)
Constructor.
bool operator<(const VehicleInformation &v2) const
sort by vehicle ID for repeatable parallel simulation