|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // The main interface for loading a microsim 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 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 NLBuilder_h 00020 #define NLBuilder_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 <map> 00034 #include <vector> 00035 #include <utils/xml/SAXWeightsHandler.h> 00036 #include <microsim/MSNet.h> 00037 00038 00039 // =========================================================================== 00040 // class declarations 00041 // =========================================================================== 00042 class MSNet; 00043 class NLContainer; 00044 class MSJunctionLogic; 00045 class MSDetectorControl; 00046 class OptionsCont; 00047 class NLHandler; 00048 class NLEdgeControlBuilder; 00049 class NLJunctionControlBuilder; 00050 class NLDetectorBuilder; 00051 class NLTriggerBuilder; 00052 class MSRouteLoader; 00053 00054 00055 // =========================================================================== 00056 // class definitions 00057 // =========================================================================== 00066 class NLBuilder { 00067 public: 00078 NLBuilder(OptionsCont& oc, MSNet& net, 00079 NLEdgeControlBuilder& eb, NLJunctionControlBuilder& jb, 00080 NLDetectorBuilder& db, 00081 NLHandler& xmlHandler) throw(); 00082 00083 00085 virtual ~NLBuilder() throw(); 00086 00087 00099 virtual bool build() throw(ProcessError); 00100 00101 00102 protected: 00110 bool load(const std::string& mmlWhat); 00111 00112 00121 void buildNet() throw(ProcessError); 00122 00123 00132 MSRouteLoaderControl* buildRouteLoaderControl(const OptionsCont& oc) throw(ProcessError); 00133 00134 00135 00136 00142 class EdgeFloatTimeLineRetriever_EdgeEffort : public SAXWeightsHandler::EdgeFloatTimeLineRetriever { 00143 public: 00145 EdgeFloatTimeLineRetriever_EdgeEffort(MSNet& net) throw() : myNet(net) {} 00146 00148 ~EdgeFloatTimeLineRetriever_EdgeEffort() throw() { } 00149 00158 void addEdgeWeight(const std::string& id, 00159 SUMOReal val, SUMOReal beg, SUMOReal end) const throw(); 00160 00161 private: 00163 MSNet& myNet; 00164 00165 }; 00166 00167 00173 class EdgeFloatTimeLineRetriever_EdgeTravelTime : public SAXWeightsHandler::EdgeFloatTimeLineRetriever { 00174 public: 00176 EdgeFloatTimeLineRetriever_EdgeTravelTime(MSNet& 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 MSNet& myNet; 00195 00196 }; 00197 00198 00199 protected: 00201 OptionsCont& myOptions; 00202 00204 NLEdgeControlBuilder& myEdgeBuilder; 00205 00207 NLJunctionControlBuilder& myJunctionBuilder; 00208 00210 NLDetectorBuilder& myDetectorBuilder; 00211 00213 MSNet& myNet; 00214 00216 NLHandler& myXMLHandler; 00217 00218 00219 private: 00221 NLBuilder(const NLBuilder& s); 00222 00224 NLBuilder& operator=(const NLBuilder& s); 00225 00226 }; 00227 00228 00229 #endif 00230 00231 /****************************************************************************/ 00232