SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSTriggeredRerouter.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Reroutes vehicles passing an edge
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 MSTriggeredRerouter_h
23 #define MSTriggeredRerouter_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 <utils/common/Command.h>
39 #include "MSTrigger.h"
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class MSNet;
48 class MSLane;
49 class MSRoute;
50 class SUMOVehicle;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
68  public MSTrigger, public MSMoveReminder,
69  public SUMOSAXHandler {
70 public:
78  MSTriggeredRerouter(const std::string& id,
79  const std::vector<MSEdge*> &edges,
80  SUMOReal prob, const std::string& file, bool off);
81 
82 
84  virtual ~MSTriggeredRerouter() ;
85 
86 
91  struct RerouteInterval {
97  std::vector<MSEdge*> closed;
102  };
103 
119 
121  bool hasCurrentReroute(SUMOTime time, SUMOVehicle& veh) const;
122 
124  const RerouteInterval& getCurrentReroute(SUMOTime time, SUMOVehicle& veh) const;
125 
127  bool hasCurrentReroute(SUMOTime time) const;
128 
130  const RerouteInterval& getCurrentReroute(SUMOTime time) const;
131 
133  void setUserMode(bool val);
134 
137 
139  bool inUserMode() const;
140 
142  SUMOReal getProbability() const;
143 
146 
147 protected:
149 
150 
158  virtual void myStartElement(int element,
159  const SUMOSAXAttributes& attrs) ;
160 
161 
168  void myEndElement(int element) ;
170 
171 protected:
173  std::vector<RerouteInterval> myIntervals;
174 
177 
180 
182 
183 
187  std::vector<MSEdge*> myCurrentClosed;
193 
197 
198 private:
201 
204 
205 
206 };
207 
208 
209 #endif
210 
211 /****************************************************************************/
212