Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // Something on a lane to be noticed about vehicle movement
20 /****************************************************************************/
21 #ifndef MSMoveReminder_h
22 #define MSMoveReminder_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #include <config.h>
29 
30 #include <iostream>
31 #include <map>
32 #include <utils/common/SUMOTime.h>
33 #include <utils/common/StdDefs.h>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class SUMOTrafficObject;
40 class MSLane;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
65 public:
71  MSMoveReminder(const std::string& description, MSLane* const lane = 0, const bool doAdd = true);
72 
73 
76  virtual ~MSMoveReminder() {}
77 
78 
83  const MSLane* getLane() const {
84  return myLane;
85  }
86 
87 
89  enum Notification {
98  /* All notifications below must result in the vehicle not being on the net
99  * (onLeaveLane sets amOnNet=false if reason>=NOTIFICATION_TELEPORT) */
105  NOTIFICATION_ARRIVED, // arrived and everything after is treated as permanent deletion from the net
112  };
113 
114 
117 
128  virtual bool notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLane* enteredLane) {
129  UNUSED_PARAMETER(reason);
130  UNUSED_PARAMETER(&veh);
131  UNUSED_PARAMETER(&enteredLane);
132  return true;
133  }
134 
135 
149  virtual bool notifyMove(SUMOTrafficObject& veh,
150  double oldPos,
151  double newPos,
152  double newSpeed) {
153  UNUSED_PARAMETER(oldPos);
154  UNUSED_PARAMETER(newPos);
155  UNUSED_PARAMETER(newSpeed);
156  UNUSED_PARAMETER(&veh);
157  return true;
158  }
159 
160 
174  virtual bool notifyLeave(SUMOTrafficObject& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0) {
175  UNUSED_PARAMETER(&veh);
176  UNUSED_PARAMETER(lastPos);
177  UNUSED_PARAMETER(reason);
178  UNUSED_PARAMETER(enteredLane);
179  return true;
180  }
181 
182 
183  // TODO: Documentation
184  void updateDetector(SUMOTrafficObject& veh, double entryPos, double leavePos,
185  SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime,
186  bool cleanUp);
187 
189 
206  virtual void notifyMoveInternal(const SUMOTrafficObject& veh,
207  const double frontOnLane,
208  const double timeOnLane,
209  const double meanSpeedFrontOnLane,
210  const double meanSpeedVehicleOnLane,
211  const double travelledDistanceFrontOnLane,
212  const double travelledDistanceVehicleOnLane,
213  const double meanLengthOnLane) {
214  UNUSED_PARAMETER(meanLengthOnLane);
215  UNUSED_PARAMETER(travelledDistanceFrontOnLane);
216  UNUSED_PARAMETER(travelledDistanceVehicleOnLane);
217  UNUSED_PARAMETER(meanSpeedVehicleOnLane);
218  UNUSED_PARAMETER(meanSpeedFrontOnLane);
219  UNUSED_PARAMETER(frontOnLane);
220  UNUSED_PARAMETER(timeOnLane);
221  UNUSED_PARAMETER(&veh);
222  }
223 
224  void setDescription(const std::string& description) {
225  myDescription = description;
226  }
227 
228  const std::string& getDescription() const {
229  return myDescription;
230  }
231 
232 protected:
234 
235 protected:
236 
238  MSLane* const myLane;
240  std::string myDescription;
241 
242 private:
243  std::map<SUMOTrafficObject*, std::pair<SUMOTime, double> > myLastVehicleUpdateValues;
244 
245 
246 private:
247  MSMoveReminder& operator=(const MSMoveReminder&); // just to avoid a compiler warning
248 
249 };
250 
251 
252 #endif
253 
254 /****************************************************************************/
255 
const MSLane * getLane() const
Returns the lane the reminder works on.
virtual ~MSMoveReminder()
Destructor.
long long int SUMOTime
Definition: SUMOTime.h:35
std::string myDescription
a description of this moveReminder
The vehicle arrived at a junction.
MSLane *const myLane
Lane on which the reminder works.
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)
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
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.
virtual bool notifyEnter(SUMOTrafficObject &veh, Notification reason, const MSLane *enteredLane)
Checks whether the reminder is activated by a vehicle entering the lane.
std::map< SUMOTrafficObject *, std::pair< SUMOTime, double > > myLastVehicleUpdateValues
virtual bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks whether the reminder still has to be notified about the vehicle moves.
The vehicle changes lanes (micro only)
The vehicle arrived at its destination (is deleted)
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=0)
Called if the vehicle leaves the reminder&#39;s lane.
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)
Representation of a vehicle or person.
const std::string & getDescription() const
void removeFromVehicleUpdateValues(SUMOTrafficObject &veh)
MSMoveReminder & operator=(const MSMoveReminder &)
The vehicle needs another parking area.
The vehicle was teleported out of the net.
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
The vehicle is being teleported.