CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDLParser.h
Go to the documentation of this file.
1 #ifndef DDL_Parser_H
2 #define DDL_Parser_H
3 
4 // ---------------------------------------------------------------------------
5 // Includes
6 // ---------------------------------------------------------------------------
10 
11 // Xerces C++ dependencies
12 #include <xercesc/util/XercesDefs.hpp>
14 #include <xercesc/sax2/SAX2XMLReader.hpp>
15 #include <xercesc/sax2/XMLReaderFactory.hpp>
16 #include <xercesc/sax/SAXException.hpp>
17 
18 #include <string>
19 #include <vector>
20 #include <map>
21 #include <iosfwd>
22 
24 
26 
64 class DDLParser
65 
66 {
67  public:
68  typedef XERCES_CPP_NAMESPACE::SAX2XMLReader SAX2XMLReader;
69 
70  typedef std::map< int, std::pair<std::string, std::string> > FileNameHolder;
71 
72  DDLParser ( DDCompactView& cpv );
73 
74  protected:
75  DDLParser( );
76 
77  public:
78  ~DDLParser();
79 
81  int parse( const DDLDocumentProvider& dp );
82 
84 
104  bool parseOneFile(const std::string& filename);
105 
106  // I ASSUME I take ownership of this blob
107  // void parse( std::vector<unsigned char>* ablob, unsigned int bsize ) ;
108  //old way void parse( const std::vector<unsigned char>& ablob, unsigned int bsize ) ;
109  void parse( const std::vector<unsigned char>& ablob, unsigned int bsize ) ;
110 
112  std::vector<std::string> getFileList();
113 
116 
118 
122 
124  size_t isFound(const std::string& filename);
125 
127  bool isParsed(const std::string& filename);
128 
130 
133  void clearFiles () ;
134 
137 
138  protected:
139 
141  void parseFile (const int& numtoproc);
142 
143  private:
144 
147 
150 
152  std::map<int, bool> parsed_;
153 
155  int nFiles_;
156 
159 
162 
166 
167 
168 };
169 
170 #endif
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
Definition: DDLParser.cc:204
std::map< int, bool > parsed_
Parse status of a given file.
Definition: DDLParser.h:152
std::string getNameSpace(const std::string &fname)
Definition: DDLParser.cc:392
XERCES_CPP_NAMESPACE::SAX2XMLReader SAX2XMLReader
Definition: DDLParser.h:68
std::string extractFileName(std::string fullname)
Definition: DDLParser.cc:381
DDLSAX2FileHandler * fileHandler_
Definition: DDLParser.h:163
SAX2XMLReader * SAX2Parser_
SAX2XMLReader is one way of parsing.
Definition: DDLParser.h:161
std::string currFileName_
Which file is currently being processed.
Definition: DDLParser.h:158
FileNameHolder fileNames_
List of files to be processed, obtained from the DDLDocumentProvider.
Definition: DDLParser.h:149
type of data representation of DDCompactView
Definition: DDCompactView.h:77
~DDLParser()
Destructor terminates the XMLPlatformUtils (as required by Xerces)
Definition: DDLParser.cc:52
DDLSAX2FileHandler is the SAX2 Handler for XML files found in the configuration file.
std::map< int, std::pair< std::string, std::string > > FileNameHolder
Definition: DDLParser.h:70
size_t isFound(const std::string &filename)
Is the file already known by the DDLParser? Returns 0 if not found, and index if found.
Definition: DDLParser.cc:79
DDLSAX2ExpressionHandler is the first pass SAX2 Handler for XML files found in the configuration file...
DDLSAX2ExpressionHandler * expHandler_
Definition: DDLParser.h:164
bool parseOneFile(const std::string &filename)
Process a single files.
Definition: DDLParser.cc:110
DDLSAX2Handler * errHandler_
Definition: DDLParser.h:165
void clearFiles()
Clear the file list - see Warning!
Definition: DDLParser.cc:374
DDLSAX2FileHandler * getDDLSAX2FileHandler()
To get the parent this class allows access to the handler.
Definition: DDLParser.cc:73
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:64
void parseFile(const int &numtoproc)
Parse File. Just to hold some common looking code.
Definition: DDLParser.cc:343
std::vector< std::string > getFileList()
Return list of files.
Definition: DDLParser.cc:193
auto dp
Definition: deltaR.h:24
SAX2XMLReader * getXMLParser()
Get the SAX2Parser from the DDLParser. USE WITH CAUTION. Set your own handler, etc.
Definition: DDLParser.cc:67
string fname
main script
DDLDocumentProvider provides a set of URLs and filenames.
tuple filename
Definition: lut2db_cfg.py:20
DDLSAX2Handler inherits from Xerces C++ DefaultHandler.
DDCompactView & cpv_
reference to storage
Definition: DDLParser.h:146
bool isParsed(const std::string &filename)
Is the file already parsed?
Definition: DDLParser.cc:99
int nFiles_
Number of files + 1.
Definition: DDLParser.h:155