SUMO - Simulation of Urban MObility
MSMoveReminder.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 /****************************************************************************/
21 // Something on a lane to be noticed about vehicle movement
22 /****************************************************************************/
23 #ifndef MSMoveReminder_h
24 #define MSMoveReminder_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 <iostream>
37 #include <map>
38 #include <utils/common/SUMOTime.h>
39 #include <utils/common/StdDefs.h>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class SUMOVehicle;
46 class MSLane;
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
71 public:
77  MSMoveReminder(const std::string& description, MSLane* const lane = 0, const bool doAdd = true);
78 
79 
82  virtual ~MSMoveReminder() {}
83 
84 
89  const MSLane* getLane() const {
90  return myLane;
91  }
92 
93 
95  enum Notification {
104  /* All notifications below must result in the vehicle not being on the net
105  * (onLeaveLane sets amOnNet=false if reason>=NOTIFICATION_TELEPORT) */
111  NOTIFICATION_ARRIVED, // arrived and everything after is treated as permanent deletion from the net
118  };
119 
120 
123 
134  virtual bool notifyEnter(SUMOVehicle& veh, Notification reason, const MSLane* enteredLane) {
135  UNUSED_PARAMETER(reason);
136  UNUSED_PARAMETER(&veh);
137  UNUSED_PARAMETER(&enteredLane);
138  return true;
139  }
140 
141 
155  virtual bool notifyMove(SUMOVehicle& veh,
156  double oldPos,
157  double newPos,
158  double newSpeed) {
159  UNUSED_PARAMETER(oldPos);
160  UNUSED_PARAMETER(newPos);
161  UNUSED_PARAMETER(newSpeed);
162  UNUSED_PARAMETER(&veh);
163  return true;
164  }
165 
166 
180  virtual bool notifyLeave(SUMOVehicle& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0) {
181  UNUSED_PARAMETER(&veh);
182  UNUSED_PARAMETER(lastPos);
183  UNUSED_PARAMETER(reason);
184  UNUSED_PARAMETER(enteredLane);
185  return true;
186  }
187 
188 
189  // TODO: Documentation
190  void updateDetector(SUMOVehicle& veh, double entryPos, double leavePos,
191  SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime,
192  bool cleanUp);
193 
195 
212  virtual void notifyMoveInternal(const SUMOVehicle& veh,
213  const double frontOnLane,
214  const double timeOnLane,
215  const double meanSpeedFrontOnLane,
216  const double meanSpeedVehicleOnLane,
217  const double travelledDistanceFrontOnLane,
218  const double travelledDistanceVehicleOnLane,
219  const double meanLengthOnLane) {
220  UNUSED_PARAMETER(meanLengthOnLane);
221  UNUSED_PARAMETER(travelledDistanceFrontOnLane);
222  UNUSED_PARAMETER(travelledDistanceVehicleOnLane);
223  UNUSED_PARAMETER(meanSpeedVehicleOnLane);
224  UNUSED_PARAMETER(meanSpeedFrontOnLane);
225  UNUSED_PARAMETER(frontOnLane);
226  UNUSED_PARAMETER(timeOnLane);
227  UNUSED_PARAMETER(&veh);
228  }
229 
230  void setDescription(const std::string& description) {
231  myDescription = description;
232  }
233 
234  const std::string& getDescription() const {
235  return myDescription;
236  }
237 
238 protected:
240 
241 protected:
242 
244  MSLane* const myLane;
246  std::string myDescription;
247 
248 private:
249  std::map<SUMOVehicle*, std::pair<SUMOTime, double> > myLastVehicleUpdateValues;
250 
251 
252 private:
253  MSMoveReminder& operator=(const MSMoveReminder&); // just to avoid a compiler warning
254 
255 };
256 
257 
258 #endif
259 
260 /****************************************************************************/
261 
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
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 void notifyMoveInternal(const SUMOVehicle &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.
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:39
The vehicle changes lanes (micro only)
Representation of a vehicle.
Definition: SUMOVehicle.h:66
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:51
The vehicle was teleported out of the net.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
The vehicle is being teleported.