00001 /****************************************************************************/ 00007 // Base class for loading routes from XML-files 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 ROTypedXMLRoutesLoader_h 00020 #define ROTypedXMLRoutesLoader_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 <xercesc/framework/XMLPScanToken.hpp> 00035 #include <utils/xml/SUMOSAXHandler.h> 00036 #include "ROAbstractRouteDefLoader.h" 00037 00038 00039 // =========================================================================== 00040 // class declarations 00041 // =========================================================================== 00042 class RONet; 00043 class Options; 00044 00045 00046 // =========================================================================== 00047 // class definitions 00048 // =========================================================================== 00059 class ROTypedXMLRoutesLoader : public ROAbstractRouteDefLoader, 00060 public SUMOSAXHandler { 00061 public: 00071 ROTypedXMLRoutesLoader(RONet &net, 00072 SUMOTime begin, SUMOTime end, const std::string &file="") throw(ProcessError); 00073 00074 00076 virtual ~ROTypedXMLRoutesLoader() throw(); 00077 00078 00080 00081 00090 bool readRoutesAtLeastUntil(SUMOTime time, bool skipping) throw(ProcessError); 00091 00092 00097 bool ended() const throw() { 00098 return myEnded; 00099 } 00101 00102 00107 void endDocument(); 00108 00109 00110 00111 protected: 00114 00120 virtual bool nextRouteRead() throw() = 0; 00121 00122 00127 virtual void beginNextRoute() throw() = 0; 00129 00130 00131 protected: 00133 SAX2XMLReader *myParser; 00134 00136 XMLPScanToken myToken; 00137 00139 bool myEnded; 00140 00141 00142 private: 00144 ROTypedXMLRoutesLoader(const ROTypedXMLRoutesLoader &src); 00145 00147 ROTypedXMLRoutesLoader &operator=(const ROTypedXMLRoutesLoader &src); 00148 00149 }; 00150 00151 00152 #endif 00153 00154 /****************************************************************************/ 00155
1.5.6