Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSMoveReminder.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-2026 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/****************************************************************************/
22// Something on a lane to be noticed about vehicle movement
23/****************************************************************************/
24#pragma once
25#include <config.h>
26
27#include <iostream>
28#include <map>
32#ifdef HAVE_FOX
34#endif
35
36
37// ===========================================================================
38// class declarations
39// ===========================================================================
41class OutputDevice;
42class MSLane;
43
44
45// ===========================================================================
46// class definitions
47// ===========================================================================
67public:
73 MSMoveReminder(const std::string& description, MSLane* const lane = nullptr, const bool doAdd = true);
74
75
78 virtual ~MSMoveReminder() {}
79
80
85 const MSLane* getLane() const {
86 return myLane;
87 }
88
89
135
136
139
150 virtual bool notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLane* enteredLane) {
151 UNUSED_PARAMETER(reason);
152 UNUSED_PARAMETER(&veh);
153 UNUSED_PARAMETER(&enteredLane);
154 return true;
155 }
156
157
171 virtual bool notifyMove(SUMOTrafficObject& veh,
172 double oldPos,
173 double newPos,
174 double newSpeed) {
175 UNUSED_PARAMETER(oldPos);
176 UNUSED_PARAMETER(newPos);
177 UNUSED_PARAMETER(newSpeed);
178 UNUSED_PARAMETER(&veh);
179 return true;
180 }
181
191 virtual bool notifyIdle(SUMOTrafficObject& veh) {
192 UNUSED_PARAMETER(&veh);
193 return true;
194 }
195
197 virtual void notifyParking() {}
198
200 virtual void notifyStopEnded() {}
201
215 virtual bool notifyLeave(SUMOTrafficObject& veh, double lastPos, Notification reason, const MSLane* enteredLane = nullptr) {
216 UNUSED_PARAMETER(&veh);
217 UNUSED_PARAMETER(lastPos);
218 UNUSED_PARAMETER(reason);
219 UNUSED_PARAMETER(enteredLane);
220 return true;
221 }
222
236 virtual bool notifyLeaveBack(SUMOTrafficObject& veh, Notification reason, const MSLane* leftLane) {
237 UNUSED_PARAMETER(&veh);
238 UNUSED_PARAMETER(reason);
239 UNUSED_PARAMETER(leftLane);
240 return true;
241 }
242
247 virtual bool notifyReroute(SUMOTrafficObject& veh) {
248 UNUSED_PARAMETER(&veh);
249 return true;
250 }
251
252 // TODO: Documentation
253 void updateDetector(SUMOTrafficObject& veh, double entryPos, double leavePos,
254 SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime,
255 bool cleanUp);
256
258
275 virtual void notifyMoveInternal(const SUMOTrafficObject& veh,
276 const double frontOnLane,
277 const double timeOnLane,
278 const double meanSpeedFrontOnLane,
279 const double meanSpeedVehicleOnLane,
280 const double travelledDistanceFrontOnLane,
281 const double travelledDistanceVehicleOnLane,
282 const double meanLengthOnLane) {
283 UNUSED_PARAMETER(&veh);
284 UNUSED_PARAMETER(frontOnLane);
285 UNUSED_PARAMETER(timeOnLane);
286 UNUSED_PARAMETER(meanSpeedFrontOnLane);
287 UNUSED_PARAMETER(meanSpeedVehicleOnLane);
288 UNUSED_PARAMETER(travelledDistanceFrontOnLane);
289 UNUSED_PARAMETER(travelledDistanceVehicleOnLane);
290 UNUSED_PARAMETER(meanLengthOnLane);
291 }
292
293 void setDescription(const std::string& description) {
294 myDescription = description;
295 }
296
297 const std::string& getDescription() const {
298 return myDescription;
299 }
300
301 // @brief return whether this moveReminder triggers parking reroute
302 virtual bool isParkingRerouter() const {
303 return false;
304 }
305
307 void saveReminderState(OutputDevice& out, const SUMOTrafficObject& veh);
308
309 void loadReminderState(long long int numID, SUMOTime time, double pos);
310
312
313protected:
315
316protected:
317
321 std::string myDescription;
322
323#ifdef HAVE_FOX
325 mutable FXMutex myNotificationMutex;
326#endif
327
328private:
329 std::map<long long int, std::pair<SUMOTime, double> > myLastVehicleUpdateValues;
331
332
333private:
334 MSMoveReminder& operator=(const MSMoveReminder&); // just to avoid a compiler warning
335
336};
long long int SUMOTime
Definition GUI.h:36
Representation of a lane in the micro simulation.
Definition MSLane.h:84
Something on a lane to be noticed about vehicle movement.
virtual bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks whether the reminder still has to be notified about the vehicle moves.
virtual bool notifyReroute(SUMOTrafficObject &veh)
Called if the vehicle change it's route.
virtual void notifyMoveInternal(const SUMOTrafficObject &veh, const double frontOnLane, const double timeOnLane, const double meanSpeedFrontOnLane, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double meanLengthOnLane)
Internal notification about the vehicle moves.
std::map< long long int, std::pair< SUMOTime, double > > myLastVehicleUpdateValues
void setDescription(const std::string &description)
virtual bool notifyEnter(SUMOTrafficObject &veh, Notification reason, const MSLane *enteredLane)
Checks whether the reminder is activated by a vehicle entering the lane.
const std::string & getDescription() const
void loadReminderState(long long int numID, SUMOTime time, double pos)
static StringBijection< Notification >::Entry NotificationValues[]
void saveReminderState(OutputDevice &out, const SUMOTrafficObject &veh)
Saves the current state into the given stream.
virtual void notifyStopEnded()
called to update state for stopped vehicles
Notification
Definition of a vehicle state.
@ NOTIFICATION_VAPORIZED_TRACI
The vehicle got removed via TraCI.
@ NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
@ NOTIFICATION_TELEPORT_ARRIVED
The vehicle was teleported out of the net.
@ NOTIFICATION_PARKING_REROUTE
The vehicle needs another parking area.
@ NOTIFICATION_VAPORIZED_CALIBRATOR
The vehicle got removed by a calibrator.
@ NOTIFICATION_VAPORIZED_GUI
The vehicle got removed via the GUI.
@ NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
@ NOTIFICATION_REROUTE
The vehicle changed it's route.
@ NOTIFICATION_SEGMENT
The vehicle changes the segment (meso only)
@ NOTIFICATION_LANE_CHANGE
The vehicle changes lanes (micro only)
@ NOTIFICATION_VAPORIZED_VAPORIZER
The vehicle got vaporized with a vaporizer.
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
@ NOTIFICATION_VAPORIZED_BREAKDOWN
The vehicle got removed via stationfinder device.
@ NOTIFICATION_PARKING
The vehicle starts or ends parking.
@ NOTIFICATION_VAPORIZED_COLLISION
The vehicle got removed by a collision.
@ NOTIFICATION_LOAD_STATE
The vehicle has been loaded from a state file.
@ NOTIFICATION_TELEPORT_CONTINUATION_ARRIVED
The vehicle entered this edge during teleport and was teleported out of the net.
@ NOTIFICATION_TELEPORT
The vehicle is being teleported.
@ NOTIFICATION_NONE
must be the last one
@ NOTIFICATION_TELEPORT_CONTINUATION
The vehicle continues being teleported past an edge.
MSMoveReminder & operator=(const MSMoveReminder &)
virtual ~MSMoveReminder()
Destructor.
virtual bool isParkingRerouter() const
static StringBijection< Notification > Notifications
std::string myDescription
a description of this moveReminder
virtual void notifyParking()
called to update state for parking vehicles
MSLane * myLane
Lane on which the reminder works.
void removeFromVehicleUpdateValues(SUMOTrafficObject &veh)
const MSLane * getLane() const
Returns the lane the reminder works on.
virtual bool notifyLeaveBack(SUMOTrafficObject &veh, Notification reason, const MSLane *leftLane)
Called if the vehicle's back leaves the reminder's lane.
virtual bool notifyIdle(SUMOTrafficObject &veh)
Computes idling emission values and adds them to the emission sums.
void updateDetector(SUMOTrafficObject &veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp)
virtual bool notifyLeave(SUMOTrafficObject &veh, double lastPos, Notification reason, const MSLane *enteredLane=nullptr)
Called if the vehicle leaves the reminder's lane.
Static storage of an output device and its base (abstract) implementation.
Representation of a vehicle, person, or container.
#define UNUSED_PARAMETER(x)
bijection entry