SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSDevice_Vehroutes.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A device which collects info on the vehicle trip
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef MSDevice_Vehroutes_h
22 #define MSDevice_Vehroutes_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include "MSDevice.h"
35 #include <microsim/MSNet.h>
36 #include <utils/common/SUMOTime.h>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class MSEdge;
43 class MSRoute;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
57 class MSDevice_Vehroutes : public MSDevice {
58 public:
61  static void init();
62 
63 
74  static MSDevice_Vehroutes* buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into, unsigned int maxRoutes = INT_MAX);
75 
77  static void generateOutputForUnfinished();
78 
79 public:
82 
92 
93 
105  bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, Notification reason);
107 
108 
115  void generateOutput() const;
116 
117 
123  const MSRoute* getRoute(int index) const;
124 
125 
128 
129 
130 private:
136  MSDevice_Vehroutes(SUMOVehicle& holder, const std::string& id, unsigned int maxRoutes);
137 
138 
144  void writeXMLRoute(OutputDevice& os, int index = -1) const;
145 
146 
149  void addRoute();
150 
151 
152 private:
154  static bool mySaveExits;
155 
157  static bool myLastRouteOnly;
158 
160  static bool mySorted;
161 
163  static bool myWithTaz;
164 
166  public:
169 
174  void vehicleStateChanged(const SUMOVehicle* const vehicle, MSNet::VehicleState to);
175 
177  std::map<const SUMOVehicle*, MSDevice_Vehroutes*> myDevices;
178  };
179 
181 
182  static std::map<const SUMOTime, int> myDepartureCounts;
183 
184  static std::map<const SUMOTime, std::string> myRouteInfos;
185 
196  public:
198  RouteReplaceInfo(const MSEdge* const edge_, const SUMOTime time_, const MSRoute* const route_)
199  : edge(edge_), time(time_), route(route_) {}
200 
203 
205  const MSEdge* edge;
206 
209 
211  const MSRoute* route;
212 
213  };
214 
216  std::vector<RouteReplaceInfo> myReplacedRoutes;
217  std::vector<SUMOTime> myExits;
218  const unsigned int myMaxRoutes;
220 
221 private:
224 
227 
228 
229 };
230 
231 
232 #endif
233 
234 /****************************************************************************/
235