SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSE3Collector.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A detector of vehicles passing an area between entry/exit points
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef MSE3Collector_h
23 #define MSE3Collector_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <vector>
37 #include <limits>
40 #include <utils/common/Named.h>
43 
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class SUMOVehicle;
49 class OutputDevice;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
65 public:
71  public:
77  MSE3EntryReminder(const MSCrossSection& crossSection, MSE3Collector& collector);
78 
79 
82 
98  bool notifyMove(SUMOVehicle& veh, SUMOReal , SUMOReal newPos, SUMOReal);
99 
100 
111  bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason);
113 
114 
115  private:
118 
121 
122  private:
125 
128 
129  };
130 
131 
132 
138  public:
144  MSE3LeaveReminder(const MSCrossSection& crossSection, MSE3Collector& collector);
145 
146 
148 
149 
165  bool notifyMove(SUMOVehicle& veh, SUMOReal , SUMOReal newPos, SUMOReal);
167 
168 
169  private:
172 
175 
176  private:
179 
182 
183  };
184 
185 
196  MSE3Collector(const std::string& id,
197  const CrossSectionVector& entries, const CrossSectionVector& exits,
198  SUMOReal haltingSpeedThreshold,
199  SUMOTime haltingTimeThreshold);
200 
201 
203  virtual ~MSE3Collector();
204 
205 
208  void reset();
209 
210 
218  void enter(SUMOVehicle& veh, SUMOReal entryTimestep);
219 
220 
228  void leave(SUMOVehicle& veh, SUMOReal leaveTimestep);
229 
230 
233 
241 
242 
250 
251 
255  SUMOReal getVehiclesWithin() const;
256 
257 
262  std::vector<std::string> getCurrentVehicleIDs() const;
264 
265 
268 
277  void writeXMLOutput(OutputDevice& dev, SUMOTime startTime, SUMOTime stopTime);
278 
279 
288  void writeXMLDetectorProlog(OutputDevice& dev) const;
290 
291 
292 
301  void detectorUpdate(const SUMOTime step);
302 
303 
304 protected:
307 
310 
312  std::vector<MSE3EntryReminder*> myEntryReminders;
313 
315  std::vector<MSE3LeaveReminder*> myLeaveReminders;
316 
317 
318  // @brief Time-threshold to determine if a vehicle is halting.
320 
323 
332  struct E3Values {
340  unsigned haltings;
348  bool hadUpdate;
349  };
350 
352  std::map<SUMOVehicle*, E3Values> myEnteredContainer;
353 
355  std::map<SUMOVehicle*, E3Values> myLeftContainer;
356 
357 
360 
363 
366 
374 
375 
378 
379 
380 private:
383 
386 
387 
388 };
389 
390 
391 #endif
392 
393 /****************************************************************************/
394