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 
MSMoveReminder::NOTIFICATION_LANE_CHANGE
The vehicle changes lanes (micro only)
Definition: MSMoveReminder.h:97
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:48
MSMoveReminder::getDescription
const std::string & getDescription() const
Definition: MSMoveReminder.h:228
SUMOTime.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSMoveReminder::notifyMove
virtual bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks whether the reminder still has to be notified about the vehicle moves.
Definition: MSMoveReminder.h:149
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSMoveReminder::NOTIFICATION_TELEPORT_ARRIVED
The vehicle was teleported out of the net.
Definition: MSMoveReminder.h:109
MSMoveReminder
Something on a lane to be noticed about vehicle movement.
Definition: MSMoveReminder.h:64
MSMoveReminder::NOTIFICATION_VAPORIZED
The vehicle got vaporized.
Definition: MSMoveReminder.h:107
MSMoveReminder::NOTIFICATION_PARKING_REROUTE
The vehicle needs another parking area.
Definition: MSMoveReminder.h:111
MSMoveReminder::notifyLeave
virtual bool notifyLeave(SUMOTrafficObject &veh, double lastPos, Notification reason, const MSLane *enteredLane=0)
Called if the vehicle leaves the reminder's lane.
Definition: MSMoveReminder.h:174
MSMoveReminder::updateDetector
void updateDetector(SUMOTrafficObject &veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp)
Definition: MSMoveReminder.cpp:44
MSMoveReminder::operator=
MSMoveReminder & operator=(const MSMoveReminder &)
MSMoveReminder::removeFromVehicleUpdateValues
void removeFromVehicleUpdateValues(SUMOTrafficObject &veh)
Definition: MSMoveReminder.cpp:86
MSMoveReminder::MSMoveReminder
MSMoveReminder(const std::string &description, MSLane *const lane=0, const bool doAdd=true)
Constructor.
Definition: MSMoveReminder.cpp:33
MSMoveReminder::~MSMoveReminder
virtual ~MSMoveReminder()
Destructor.
Definition: MSMoveReminder.h:76
MSMoveReminder::myLastVehicleUpdateValues
std::map< SUMOTrafficObject *, std::pair< SUMOTime, double > > myLastVehicleUpdateValues
Definition: MSMoveReminder.h:243
MSMoveReminder::NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
Definition: MSMoveReminder.h:91
MSMoveReminder::NOTIFICATION_SEGMENT
The vehicle changes the segment (meso only)
Definition: MSMoveReminder.h:95
MSMoveReminder::getLane
const MSLane * getLane() const
Returns the lane the reminder works on.
Definition: MSMoveReminder.h:83
MSMoveReminder::myDescription
std::string myDescription
a description of this moveReminder
Definition: MSMoveReminder.h:240
MSMoveReminder::NOTIFICATION_PARKING
The vehicle starts or ends parking.
Definition: MSMoveReminder.h:103
MSMoveReminder::NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
Definition: MSMoveReminder.h:105
MSMoveReminder::setDescription
void setDescription(const std::string &description)
Definition: MSMoveReminder.h:224
MSMoveReminder::notifyEnter
virtual bool notifyEnter(SUMOTrafficObject &veh, Notification reason, const MSLane *enteredLane)
Checks whether the reminder is activated by a vehicle entering the lane.
Definition: MSMoveReminder.h:128
config.h
StdDefs.h
MSMoveReminder::notifyMoveInternal
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.
Definition: MSMoveReminder.h:206
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:89
MSMoveReminder::NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
Definition: MSMoveReminder.h:93
MSMoveReminder::NOTIFICATION_TELEPORT
The vehicle is being teleported.
Definition: MSMoveReminder.h:101
MSMoveReminder::myLane
MSLane *const myLane
Lane on which the reminder works.
Definition: MSMoveReminder.h:238