SUMO - Simulation of Urban MObility
RORDGenerator_ODAmounts.h
Go to the documentation of this file.
00001 /****************************************************************************/
00009 // Class for loading trip amount definitions and route generation
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 #ifndef RORDGenerator_ODAmounts_h
00023 #define RORDGenerator_ODAmounts_h
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 #include <string>
00036 #include <set>
00037 #include <utils/options/OptionsCont.h>
00038 #include <utils/common/IDSupplier.h>
00039 #include <utils/xml/SUMOXMLDefinitions.h>
00040 #include "RORDLoader_TripDefs.h"
00041 #include "RONet.h"
00042 #include <utils/common/SUMOTime.h>
00043 
00044 
00045 // ===========================================================================
00046 // class definitions
00047 // ===========================================================================
00054 class RORDGenerator_ODAmounts : public RORDLoader_TripDefs {
00055 public:
00057     RORDGenerator_ODAmounts(RONet& net,
00058                             SUMOTime begin, SUMOTime end, bool emptyDestinationsAllowed,
00059                             bool randomize, const std::string& file = "") ;
00060 
00062     ~RORDGenerator_ODAmounts() ;
00063 
00064 
00072     bool readRoutesAtLeastUntil(SUMOTime until);
00073 
00074 
00075 protected:
00077 
00078 
00086     void myStartElement(int element,
00087                         const SUMOSAXAttributes& attrs) ;
00088 
00089 
00096     void myEndElement(int element) ;
00098 
00100     void parseFlowAmountDef(const SUMOSAXAttributes& attrs) ;
00101 
00103     void myEndFlowAmountDef();
00104 
00109     class FlowDef {
00110     public:
00112         FlowDef(ROVehicle* vehicle, SUMOVTypeParameter* type, RORouteDef* route,
00113                 SUMOTime intBegin, SUMOTime intEnd,
00114                 unsigned int vehicles2insert, bool randomize);
00115 
00117         ~FlowDef();
00118 
00120         bool applicableForTime(SUMOTime time) const;
00121 
00123         void addRoutes(RONet& net, SUMOTime time);
00124 
00126         void addSingleRoute(RONet& net, SUMOTime time);
00127 
00129         SUMOTime getIntervalEnd() const;
00130 
00131     private:
00133         ROVehicle* myVehicle;
00134 
00136         SUMOVTypeParameter* myVehicleType;
00137 
00139         RORouteDef* myRoute;
00140 
00142         SUMOTime myIntervalBegin;
00143 
00145         SUMOTime myIntervalEnd;
00146 
00148         unsigned int myVehicle2InsertNumber;
00149 
00151         unsigned int myInserted;
00152 
00154         std::vector<SUMOTime> myDepartures;
00155 
00157         bool myRandom;
00158 
00159     };
00160 
00161 private:
00163     void buildForTimeStep(SUMOTime time) ;
00164 
00165 private:
00167     SUMOTime myIntervalBegin;
00168 
00170     SUMOTime myIntervalEnd;
00171 
00173     SUMOTime myUpperIntervalBegin;
00174 
00176     SUMOTime myUpperIntervalEnd;
00177 
00179     unsigned int myVehicle2InsertNumber;
00180 
00182     SUMOTime myCurrentTimeStep;
00183 
00185     typedef std::vector<FlowDef*> FlowDefV;
00186 
00188     FlowDefV myFlows;
00189 
00191     std::set<std::string> myKnownIDs;
00192 
00194     bool myRandom;
00195 
00196 
00197     bool myHaveWarnedAboutDeprecatedNumber;
00198 
00199 private:
00201     RORDGenerator_ODAmounts(const RORDGenerator_ODAmounts& src);
00202 
00204     RORDGenerator_ODAmounts& operator=(const RORDGenerator_ODAmounts& src);
00205 
00206 };
00207 
00208 
00209 #endif
00210 
00211 /****************************************************************************/
00212 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines