CMS 3D CMS Logo

DDLParser.h
Go to the documentation of this file.
1 #ifndef DETECTOR_DESCRIPTION_PARSER_DDL_PARSER_H
2 #define DETECTOR_DESCRIPTION_PARSER_DDL_PARSER_H
3 
8 #include <xercesc/sax/SAXException.hpp>
9 #include <xercesc/sax2/SAX2XMLReader.hpp>
10 #include <xercesc/sax2/XMLReaderFactory.hpp>
11 #include <xercesc/util/XercesDefs.hpp>
12 #include <xercesc/util/XercesVersion.hpp>
13 #include <iosfwd>
14 #include <map>
15 #include <string>
16 #include <utility>
17 #include <vector>
18 #include <cstddef>
19 
20 class DDCompactView;
22 class DDLElementRegistry;
23 
25 
63 class DDLParser {
64 public:
65  typedef XERCES_CPP_NAMESPACE::SAX2XMLReader SAX2XMLReader;
66 
67  typedef std::map<int, std::pair<std::string, std::string> > FileNameHolder;
68 
70 
71  DDLParser() = delete;
72 
73  ~DDLParser();
74 
76  int parse(const DDLDocumentProvider& dp);
77 
79 
99  bool parseOneFile(const std::string& filename);
100 
101  // I ASSUME I take ownership of this blob
102  // void parse( std::vector<unsigned char>* ablob, unsigned int bsize ) ;
103  //old way void parse( const std::vector<unsigned char>& ablob, unsigned int bsize ) ;
104  void parse(const std::vector<unsigned char>& ablob, unsigned int bsize);
105 
108 
110 
114 
116 
119  void clearFiles();
120 
121 private:
123  void parseFile(const int& numtoproc);
124 
126  size_t isFound(const std::string& filename);
127 
129  bool isParsed(const std::string& filename);
130 
131  std::string const extractFileName(const std::string& fullname);
132 
134 
137 
140 
142  std::map<int, bool> parsed_;
143 
145  size_t nFiles_;
146 
149 
152 
157 };
158 
159 #endif
DDLParser::elementRegistry_
DDLElementRegistry * elementRegistry_
Definition: DDLParser.h:153
DDLParser::parse
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
Definition: DDLParser.cc:123
DDLParser::SAX2XMLReader
XERCES_CPP_NAMESPACE::SAX2XMLReader SAX2XMLReader
Definition: DDLParser.h:65
DDLParser::isParsed
bool isParsed(const std::string &filename)
Is the file already parsed?
Definition: DDLParser.cc:71
DDLParser::SAX2Parser_
SAX2XMLReader * SAX2Parser_
SAX2XMLReader is one way of parsing.
Definition: DDLParser.h:151
DDLParser::isFound
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:55
DDLParser::currFileName_
std::string currFileName_
Which file is currently being processed.
Definition: DDLParser.h:148
DDLSAX2Handler.h
DDLParser::cpv_
DDCompactView & cpv_
reference to storage
Definition: DDLParser.h:136
DDLElementRegistry
The main class for processing parsed elements.
Definition: DDLElementRegistry.h:23
DDLParser::errHandler_
DDLSAX2Handler * errHandler_
Definition: DDLParser.h:156
DDLParser::~DDLParser
~DDLParser()
Destructor terminates the XMLPlatformUtils (as required by Xerces)
Definition: DDLParser.cc:38
DDLSAX2FileHandler
DDLSAX2FileHandler is the SAX2 Handler for XML files found in the configuration file.
Definition: DDLSAX2FileHandler.h:35
DDLDocumentProvider
DDLDocumentProvider provides a set of URLs and filenames.
Definition: DDLDocumentProvider.h:20
DDLParser::getNameSpace
const std::string getNameSpace(const std::string &fname)
Definition: DDLParser.cc:217
DDLParser::clearFiles
void clearFiles()
Clear the file list - see Warning!
Definition: DDLParser.cc:208
DDLParser::nFiles_
size_t nFiles_
Number of files + 1.
Definition: DDLParser.h:145
DDLParser::getXMLParser
SAX2XMLReader * getXMLParser()
Get the SAX2Parser from the DDLParser. USE WITH CAUTION. Set your own handler, etc.
Definition: DDLParser.cc:51
DDLSAX2Handler
DDLSAX2Handler inherits from Xerces C++ DefaultHandler.
Definition: DDLSAX2Handler.h:27
Calorimetry_cff.dp
dp
Definition: Calorimetry_cff.py:157
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
DDLParser::getDDLSAX2FileHandler
DDLSAX2FileHandler * getDDLSAX2FileHandler()
To get the parent this class allows access to the handler.
Definition: DDLParser.cc:53
DDLParser::extractFileName
const std::string extractFileName(const std::string &fullname)
Definition: DDLParser.cc:213
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDLSAX2ExpressionHandler
DDLSAX2ExpressionHandler is the first pass SAX2 Handler for XML files found in the configuration file...
Definition: DDLSAX2ExpressionHandler.h:25
DDLParser
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:63
Xerces.h
DDLParser::parsed_
std::map< int, bool > parsed_
Parse status of a given file.
Definition: DDLParser.h:142
DDLSAX2ExpressionHandler.h
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
DDLParser::fileHandler_
DDLSAX2FileHandler * fileHandler_
Definition: DDLParser.h:154
DDLParser::FileNameHolder
std::map< int, std::pair< std::string, std::string > > FileNameHolder
Definition: DDLParser.h:67
DDLParser::fileNames_
FileNameHolder fileNames_
List of files to be processed, obtained from the DDLDocumentProvider.
Definition: DDLParser.h:139
DDLParser::parseOneFile
bool parseOneFile(const std::string &filename)
Process a single files.
Definition: DDLParser.cc:80
DDLParser::DDLParser
DDLParser()=delete
DDLParser::expHandler_
DDLSAX2ExpressionHandler * expHandler_
Definition: DDLParser.h:155
DDLParser::parseFile
void parseFile(const int &numtoproc)
Parse File. Just to hold some common looking code.
Definition: DDLParser.cc:199
DDLSAX2FileHandler.h