RORDGenerator_ODAmounts.h
Go to the documentation of this file.00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef RORDGenerator_ODAmounts_h
00020 #define RORDGenerator_ODAmounts_h
00021
00022
00023
00024
00025
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031
00032 #include <string>
00033 #include <set>
00034 #include <utils/options/OptionsCont.h>
00035 #include <utils/common/IDSupplier.h>
00036 #include <utils/xml/SUMOXMLDefinitions.h>
00037 #include "RORDLoader_TripDefs.h"
00038 #include "RONet.h"
00039 #include <utils/common/SUMOTime.h>
00040
00041
00042
00043
00044
00051 class RORDGenerator_ODAmounts : public RORDLoader_TripDefs {
00052 public:
00054 RORDGenerator_ODAmounts(RONet &net,
00055 SUMOTime begin, SUMOTime end, bool emptyDestinationsAllowed,
00056 bool randomize, const std::string &file="") throw(ProcessError);
00057
00059 ~RORDGenerator_ODAmounts() throw();
00060
00061
00063
00064
00073 bool readRoutesAtLeastUntil(SUMOTime until, bool skipping) throw(ProcessError);
00075
00076
00077 protected:
00079
00080
00088 void myStartElement(SumoXMLTag element,
00089 const SUMOSAXAttributes &attrs) throw(ProcessError);
00090
00091
00098 void myEndElement(SumoXMLTag element) throw(ProcessError);
00100
00102 void parseInterval(const SUMOSAXAttributes &attrs);
00103
00105 void parseFlowAmountDef(const SUMOSAXAttributes &attrs) throw(ProcessError);
00106
00108 void myEndInterval();
00109
00111 void myEndFlowAmountDef();
00112
00117 class FlowDef {
00118 public:
00120 FlowDef(ROVehicle *vehicle, SUMOVTypeParameter *type, RORouteDef *route,
00121 SUMOTime intBegin, SUMOTime intEnd,
00122 unsigned int vehicles2Emit, bool randomize);
00123
00125 ~FlowDef();
00126
00128 bool applicableForTime(SUMOTime time) const;
00129
00131 void addRoutes(RONet &net, SUMOTime time);
00132
00134 void addSingleRoute(RONet &net, SUMOTime time);
00135
00137 SUMOTime getIntervalEnd() const;
00138
00139 private:
00141 ROVehicle *myVehicle;
00142
00144 SUMOVTypeParameter *myVehicleType;
00145
00147 RORouteDef *myRoute;
00148
00150 SUMOTime myIntervalBegin;
00151
00153 SUMOTime myIntervalEnd;
00154
00156 unsigned int myVehicle2EmitNumber;
00157
00159 unsigned int myEmitted;
00160
00162 std::vector<SUMOTime> myDepartures;
00163
00165 bool myRandom;
00166
00167 };
00168
00169 private:
00171 void buildRoutes(SUMOTime until) throw();
00172
00174 void buildForTimeStep(SUMOTime time) throw();
00175
00176 private:
00178 SUMOTime myIntervalBegin;
00179
00181 SUMOTime myIntervalEnd;
00182
00184 SUMOTime myUpperIntervalBegin;
00185
00187 SUMOTime myUpperIntervalEnd;
00188
00190 unsigned int myVehicle2EmitNumber;
00191
00193 SUMOTime myCurrentTimeStep;
00194
00196 typedef std::vector<FlowDef*> FlowDefV;
00197
00199 FlowDefV myFlows;
00200
00202 std::set<std::string> myKnownIDs;
00203
00205 bool myRandom;
00206
00207
00208 private:
00210 RORDGenerator_ODAmounts(const RORDGenerator_ODAmounts &src);
00211
00213 RORDGenerator_ODAmounts &operator=(const RORDGenerator_ODAmounts &src);
00214
00215 };
00216
00217
00218 #endif
00219
00220
00221