ROLoader.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Loader for networks and route imports
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef ROLoader_h
00020 #define ROLoader_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <string>
00033 #include <xercesc/sax2/SAX2XMLReader.hpp>
00034 #include <utils/common/SUMOTime.h>
00035 #include <utils/common/SUMOAbstractRouter.h>
00036 #include <utils/common/ValueTimeLine.h>
00037 #include <utils/xml/SAXWeightsHandler.h>
00038 
00039 
00040 // ===========================================================================
00041 // class declarations
00042 // ===========================================================================
00043 class OptionsCont;
00044 class RONet;
00045 class ROAbstractRouteDefLoader;
00046 class ROAbstractEdgeBuilder;
00047 class GUIRouterRunThread;
00048 class ROVehicle;
00049 
00050 
00051 // ===========================================================================
00052 // class definitions
00053 // ===========================================================================
00062 class ROLoader {
00063 public:
00070     ROLoader(OptionsCont &oc, bool emptyDestinationsAllowed) throw();
00071 
00072 
00074     virtual ~ROLoader();
00075 
00077     virtual void loadNet(RONet &toFill, ROAbstractEdgeBuilder &eb);
00078 
00080     bool loadWeights(RONet &net, const std::string &optionName,
00081                      const std::string &measure, bool useLanes);
00082 
00085     unsigned int openRoutes(RONet &net);
00086 
00089     virtual void processRoutesStepWise(SUMOTime start, SUMOTime end,
00090                                        RONet &net, SUMOAbstractRouter<ROEdge,ROVehicle> &router);
00091 
00094     virtual void processAllRoutes(SUMOTime start, SUMOTime end,
00095                                   RONet &net, SUMOAbstractRouter<ROEdge,ROVehicle> &router);
00096 
00097     bool makeSingleStep(SUMOTime end, RONet &net, SUMOAbstractRouter<ROEdge,ROVehicle> &router);
00098 
00099 protected:
00121     bool openTypedRoutes(const std::string &optionName, RONet &net) throw();
00122 
00123 
00133     SUMOTime getMinTimeStep() const throw();
00134 
00135 
00136 
00142     class EdgeFloatTimeLineRetriever_EdgeWeight : public SAXWeightsHandler::EdgeFloatTimeLineRetriever {
00143     public:
00145         EdgeFloatTimeLineRetriever_EdgeWeight(RONet &net) throw() : myNet(net) {}
00146 
00148         ~EdgeFloatTimeLineRetriever_EdgeWeight() throw() { }
00149 
00158         void addEdgeWeight(const std::string &id,
00159                            SUMOReal val, SUMOReal beg, SUMOReal end) const throw();
00160 
00161     private:
00163         RONet &myNet;
00164 
00165     };
00166 
00167 
00173     class EdgeFloatTimeLineRetriever_EdgeTravelTime : public SAXWeightsHandler::EdgeFloatTimeLineRetriever {
00174     public:
00176         EdgeFloatTimeLineRetriever_EdgeTravelTime(RONet &net) throw() : myNet(net) {}
00177 
00179         ~EdgeFloatTimeLineRetriever_EdgeTravelTime() throw() {}
00180 
00189         void addEdgeWeight(const std::string &id,
00190                            SUMOReal val, SUMOReal beg, SUMOReal end) const throw();
00191 
00192     private:
00194         RONet &myNet;
00195 
00196     };
00197 
00198 
00199 
00200 protected:
00201     ROAbstractRouteDefLoader* buildNamedHandler(const std::string &optionName,
00202             const std::string &file, RONet &net) throw(ProcessError);
00203 
00204 
00205     void writeStats(SUMOTime time, SUMOTime start, int absNo) throw();
00206 
00207 
00209     void destroyHandlers() throw();
00210 
00211 
00212 protected:
00214     OptionsCont &myOptions;
00215 
00217     typedef std::vector<ROAbstractRouteDefLoader*> RouteLoaderCont;
00218 
00220     RouteLoaderCont myHandler;
00221 
00223     bool myEmptyDestinationsAllowed;
00224 
00225 
00226 private:
00228     ROLoader(const ROLoader &src);
00229 
00231     ROLoader &operator=(const ROLoader &src);
00232 
00233 };
00234 
00235 
00236 #endif
00237 
00238 /****************************************************************************/
00239 

Generated on Wed May 5 00:06:36 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6