SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XMLSubSys.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Utility methods for initialising, closing and using the XML-subsystem
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef XMLSubSys_h
22 #define XMLSubSys_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <xercesc/sax2/SAX2XMLReader.hpp>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class GenericSAXHandler;
43 class SUMOSAXHandler;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
73 class XMLSubSys {
74 public:
89  static void init(bool enableValidation) ;
90 
91 
97  static void close() ;
98 
99 
111  static XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader* getSAXReader(SUMOSAXHandler& handler) ;
112 
113 
121  static void setHandler(GenericSAXHandler& handler);
122 
123 
141  static bool runParser(GenericSAXHandler& handler,
142  const std::string& file) ;
143 
144 
145 protected:
156  static XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader* getSAXReader() ;
157 
158 
168  static void setFeature(XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader& reader,
169  const std::string& feature, bool value) ;
170 
171 
172 private:
174  static std::vector<XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader*> myReaders;
175 
177  static unsigned int myNextFreeReader;
178 
180  static bool myEnableValidation;
181 
182 };
183 
184 
185 #endif
186 
187 /****************************************************************************/
188