SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RORDGenerator_ODAmounts.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Class for loading trip amount definitions and route generation
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 RORDGenerator_ODAmounts_h
23 #define RORDGenerator_ODAmounts_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 <set>
40 #include "RORDLoader_TripDefs.h"
41 #include "RONet.h"
42 #include <utils/common/SUMOTime.h>
43 
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class RORouteDef_OrigDest;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
61 public:
64  SUMOTime begin, SUMOTime end, bool emptyDestinationsAllowed,
65  bool randomize, const std::string& file = "");
66 
69 
70 
78  bool readRoutesAtLeastUntil(SUMOTime until);
79 
80 
81 protected:
83 
84 
92  void myStartElement(int element,
93  const SUMOSAXAttributes& attrs);
94 
95 
102  void myEndElement(int element);
104 
106  void parseFlowAmountDef(const SUMOSAXAttributes& attrs);
107 
109  void myEndFlowAmountDef();
110 
115  class FlowDef {
116  public:
118  FlowDef(ROVehicle* vehicle, SUMOVTypeParameter* type, RORouteDef* route,
119  SUMOTime intBegin, SUMOTime intEnd,
120  unsigned int vehicles2insert, bool randomize);
121 
123  ~FlowDef();
124 
126  bool applicableForTime(SUMOTime time) const;
127 
129  void addRoutes(RONet& net, SUMOTime time);
130 
132  void addSingleRoute(RONet& net, SUMOTime time);
133 
135  SUMOTime getIntervalEnd() const;
136 
137  private:
139  const ROVehicle* const myVehicle;
140 
143 
145  const RORouteDef* const myRoute;
146 
149 
152 
154  const unsigned int myVehicle2InsertNumber;
155 
157  unsigned int myInserted;
158 
160  std::vector<SUMOTime> myDepartures;
161 
163  bool myRandom;
164 
165  private:
167  FlowDef& operator=(const FlowDef& s);
168 
169  };
170 
171 private:
173  void buildForTimeStep(SUMOTime time);
174 
175 private:
178 
181 
184 
187 
190 
193 
195  typedef std::vector<FlowDef*> FlowDefV;
196 
199 
201  std::set<std::string> myKnownIDs;
202 
204  bool myRandom;
205 
206 
207 private:
210 
213 
214 };
215 
216 
217 #endif
218 
219 /****************************************************************************/
220