00001 /****************************************************************************/ 00007 // An XML-Handler for districts 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 ODDistrictHandler_h 00020 #define ODDistrictHandler_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 <utility> 00034 #include <utils/xml/SUMOSAXHandler.h> 00035 00036 00037 // =========================================================================== 00038 // class declarations 00039 // =========================================================================== 00040 class ODDistrict; 00041 class ODDistrictCont; 00042 00043 00044 // =========================================================================== 00045 // class definitions 00046 // =========================================================================== 00054 class ODDistrictHandler : public SUMOSAXHandler { 00055 public: 00062 ODDistrictHandler(ODDistrictCont &cont, const std::string &file) throw(); 00063 00064 00066 ~ODDistrictHandler() throw(); 00067 00068 00069 protected: 00071 00072 00083 void myStartElement(SumoXMLTag element, 00084 const SUMOSAXAttributes &attrs) throw(ProcessError); 00085 00086 00094 void myEndElement(SumoXMLTag element) throw(ProcessError); 00096 00097 00098 private: 00107 void openDistrict(const SUMOSAXAttributes &attrs) throw(); 00108 00109 00121 void addSource(const SUMOSAXAttributes &attrs) throw(); 00122 00123 00135 void addSink(const SUMOSAXAttributes &attrs) throw(); 00136 00137 00142 void closeDistrict() throw(); 00143 00144 00160 std::pair<std::string, SUMOReal> parseConnection(const SUMOSAXAttributes &attrs, 00161 const std::string &type) throw(); 00162 00163 private: 00165 ODDistrictCont &myContainer; 00166 00168 ODDistrict *myCurrentDistrict; 00169 00170 00171 private: 00173 ODDistrictHandler(const ODDistrictHandler &s); 00174 00176 ODDistrictHandler &operator=(const ODDistrictHandler &s); 00177 00178 00179 }; 00180 00181 00182 #endif 00183 00184 /****************************************************************************/ 00185
1.5.6