SUMO - Simulation of Urban MObility

ROLoader.h

Go to the documentation of this file.
00001 /****************************************************************************/
00009 // Loader for networks and route imports
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 ROLoader_h
00023 #define ROLoader_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 <xercesc/sax2/SAX2XMLReader.hpp>
00037 #include <utils/common/SUMOTime.h>
00038 #include <utils/common/SUMOAbstractRouter.h>
00039 #include <utils/common/ValueTimeLine.h>
00040 #include <utils/xml/SAXWeightsHandler.h>
00041 
00042 
00043 // ===========================================================================
00044 // class declarations
00045 // ===========================================================================
00046 class OptionsCont;
00047 class RONet;
00048 class ROAbstractRouteDefLoader;
00049 class ROAbstractEdgeBuilder;
00050 class GUIRouterRunThread;
00051 class ROVehicle;
00052 
00053 
00054 // ===========================================================================
00055 // class definitions
00056 // ===========================================================================
00065 class ROLoader {
00066 public:
00073     ROLoader(OptionsCont& oc, bool emptyDestinationsAllowed) ;
00074 
00075 
00077     virtual ~ROLoader();
00078 
00080     virtual void loadNet(RONet& toFill, ROAbstractEdgeBuilder& eb);
00081 
00083     bool loadWeights(RONet& net, const std::string& optionName,
00084                      const std::string& measure, bool useLanes);
00085 
00088     unsigned int openRoutes(RONet& net);
00089 
00092     virtual void processRoutesStepWise(SUMOTime start, SUMOTime end,
00093                                        RONet& net, SUMOAbstractRouter<ROEdge, ROVehicle> &router);
00094 
00097     virtual void processAllRoutes(SUMOTime start, SUMOTime end,
00098                                   RONet& net, SUMOAbstractRouter<ROEdge, ROVehicle> &router);
00099 
00100     bool makeSingleStep(SUMOTime end, RONet& net, SUMOAbstractRouter<ROEdge, ROVehicle> &router);
00101 
00102 protected:
00124     bool openTypedRoutes(const std::string& optionName, RONet& net) ;
00125 
00126 
00136     SUMOTime getMinTimeStep() const ;
00137 
00138 
00139 
00145     class EdgeFloatTimeLineRetriever_EdgeWeight : public SAXWeightsHandler::EdgeFloatTimeLineRetriever {
00146     public:
00148         EdgeFloatTimeLineRetriever_EdgeWeight(RONet& net) : myNet(net) {}
00149 
00151         ~EdgeFloatTimeLineRetriever_EdgeWeight() { }
00152 
00161         void addEdgeWeight(const std::string& id,
00162                            SUMOReal val, SUMOReal beg, SUMOReal end) const ;
00163 
00164     private:
00166         RONet& myNet;
00167 
00168     };
00169 
00170 
00176     class EdgeFloatTimeLineRetriever_EdgeTravelTime : public SAXWeightsHandler::EdgeFloatTimeLineRetriever {
00177     public:
00179         EdgeFloatTimeLineRetriever_EdgeTravelTime(RONet& net) : myNet(net) {}
00180 
00182         ~EdgeFloatTimeLineRetriever_EdgeTravelTime() {}
00183 
00192         void addEdgeWeight(const std::string& id,
00193                            SUMOReal val, SUMOReal beg, SUMOReal end) const ;
00194 
00195     private:
00197         RONet& myNet;
00198 
00199     };
00200 
00201 
00202 
00203 protected:
00204     ROAbstractRouteDefLoader* buildNamedHandler(const std::string& optionName,
00205             const std::string& file, RONet& net) ;
00206 
00207 
00208     void writeStats(SUMOTime time, SUMOTime start, int absNo) ;
00209 
00210 
00212     void destroyHandlers() ;
00213 
00214 
00215 protected:
00217     OptionsCont& myOptions;
00218 
00220     typedef std::vector<ROAbstractRouteDefLoader*> RouteLoaderCont;
00221 
00223     RouteLoaderCont myHandler;
00224 
00226     bool myEmptyDestinationsAllowed;
00227 
00228 
00229 private:
00231     ROLoader(const ROLoader& src);
00232 
00234     ROLoader& operator=(const ROLoader& src);
00235 
00236 };
00237 
00238 
00239 #endif
00240 
00241 /****************************************************************************/
00242 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines