SUMO - Simulation of Urban MObility
MSMoveReminder.h
Go to the documentation of this file.
1 /****************************************************************************/
11 // Something on a lane to be noticed about vehicle movement
12 /****************************************************************************/
13 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
14 // Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 /****************************************************************************/
24 #ifndef MSMoveReminder_h
25 #define MSMoveReminder_h
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <iostream>
38 #include <map>
39 #include <utils/common/SUMOTime.h>
40 #include <utils/common/StdDefs.h>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class SUMOVehicle;
47 class MSLane;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
72 public:
78  MSMoveReminder(const std::string& description, MSLane* const lane = 0, const bool doAdd = true);
79 
80 
83  virtual ~MSMoveReminder() {}
84 
85 
90  const MSLane* getLane() const {
91  return myLane;
92  }
93 
94 
96  enum Notification {
105  /* All notifications below must result in the vehicle not being on the net
106  * (onLeaveLane sets amOnNet=false if reason>=NOTIFICATION_TELEPORT) */
112  NOTIFICATION_ARRIVED, // arrived and everything after is treated as permanent deletion from the net
119  };
120 
121 
124 
135  virtual bool notifyEnter(SUMOVehicle& veh, Notification reason, const MSLane* enteredLane) {
136  UNUSED_PARAMETER(reason);
137  UNUSED_PARAMETER(&veh);
138  UNUSED_PARAMETER(&enteredLane);
139  return true;
140  }
141 
142 
156  virtual bool notifyMove(SUMOVehicle& veh,
157  double oldPos,
158  double newPos,
159  double newSpeed) {
160  UNUSED_PARAMETER(oldPos);
161  UNUSED_PARAMETER(newPos);
162  UNUSED_PARAMETER(newSpeed);
163  UNUSED_PARAMETER(&veh);
164  return true;
165  }
166 
167 
181  virtual bool notifyLeave(SUMOVehicle& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0) {
182  UNUSED_PARAMETER(&veh);
183  UNUSED_PARAMETER(lastPos);
184  UNUSED_PARAMETER(reason);
185  UNUSED_PARAMETER(enteredLane);
186  return true;
187  }
188 
189 
190  // TODO: Documentation
191  void updateDetector(SUMOVehicle& veh, double entryPos, double leavePos,
192  SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime,
193  bool cleanUp);
194 
196 
211  virtual void notifyMoveInternal(const SUMOVehicle& veh,
212  const double frontOnLane,
213  const double timeOnLane,
214  const double meanSpeedFrontOnLane,
215  const double meanSpeedVehicleOnLane,
216  const double travelledDistanceFrontOnLane,
217  const double travelledDistanceVehicleOnLane) {
218  UNUSED_PARAMETER(travelledDistanceFrontOnLane);
219  UNUSED_PARAMETER(travelledDistanceVehicleOnLane);
220  UNUSED_PARAMETER(meanSpeedVehicleOnLane);
221  UNUSED_PARAMETER(meanSpeedFrontOnLane);
222  UNUSED_PARAMETER(frontOnLane);
223  UNUSED_PARAMETER(timeOnLane);
224  UNUSED_PARAMETER(&veh);
225  }
226 
227  void setDescription(const std::string& description) {
228  myDescription = description;
229  }
230 
231  const std::string& getDescription() const {
232  return myDescription;
233  }
234 
235 protected:
237 
238 protected:
239 
241  MSLane* const myLane;
243  std::string myDescription;
244 
245 private:
246  std::map<SUMOVehicle*, std::pair<SUMOTime, double> > myLastVehicleUpdateValues;
247 
248 
249 private:
250  MSMoveReminder& operator=(const MSMoveReminder&); // just to avoid a compiler warning
251 
252 };
253 
254 
255 #endif
256 
257 /****************************************************************************/
258 
const MSLane * getLane() const
Returns the lane the reminder works on.
void updateDetector(SUMOVehicle &veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp)
virtual ~MSMoveReminder()
Destructor.
virtual bool notifyLeave(SUMOVehicle &veh, double lastPos, Notification reason, const MSLane *enteredLane=0)
Called if the vehicle leaves the reminder&#39;s lane.
std::string myDescription
a description of this moveReminder
virtual void notifyMoveInternal(const SUMOVehicle &veh, const double frontOnLane, const double timeOnLane, const double meanSpeedFrontOnLane, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane)
Internal notification about the vehicle moves.
The vehicle arrived at a junction.
MSLane *const myLane
Lane on which the reminder works.
void removeFromVehicleUpdateValues(SUMOVehicle &veh)
Notification
Definition of a vehicle state.
The vehicle got vaporized.
MSMoveReminder(const std::string &description, MSLane *const lane=0, const bool doAdd=true)
Constructor.
The vehicle changes the segment (meso only)
virtual bool notifyEnter(SUMOVehicle &veh, Notification reason, const MSLane *enteredLane)
Checks whether the reminder is activated by a vehicle entering the lane.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:38
The vehicle changes lanes (micro only)
Representation of a vehicle.
Definition: SUMOVehicle.h:67
The vehicle arrived at its destination (is deleted)
virtual bool notifyMove(SUMOVehicle &veh, double oldPos, double newPos, double newSpeed)
Checks whether the reminder still has to be notified about the vehicle moves.
Something on a lane to be noticed about vehicle movement.
void setDescription(const std::string &description)
The vehicle starts or ends parking.
The vehicle has departed (was inserted into the network)
const std::string & getDescription() const
MSMoveReminder & operator=(const MSMoveReminder &)
std::map< SUMOVehicle *, std::pair< SUMOTime, double > > myLastVehicleUpdateValues
The vehicle needs another parking area.
long long int SUMOTime
Definition: TraCIDefs.h:52
The vehicle was teleported out of the net.
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
The vehicle is being teleported.