DDLParser is the main class of Detector Description Language Parser. More...
#include <DDLParser.h>
Public Types | |
typedef std::map< int, std::pair< std::string, std::string > > | FileNameHolder |
typedef XERCES_CPP_NAMESPACE::SAX2XMLReader | SAX2XMLReader |
Public Member Functions | |
void | clearFiles () |
Clear the file list - see Warning! More... | |
DDLParser (DDCompactView &cpv) | |
Constructor MUST associate a DDCompactView storage. More... | |
std::string | extractFileName (std::string fullname) |
DDLSAX2FileHandler * | getDDLSAX2FileHandler () |
To get the parent this class allows access to the handler. More... | |
std::vector< std::string > | getFileList () |
Return list of files. More... | |
std::string | getNameSpace (const std::string &fname) |
SAX2XMLReader * | getXMLParser () |
Get the SAX2Parser from the DDLParser. USE WITH CAUTION. Set your own handler, etc. More... | |
size_t | isFound (const std::string &filename) |
Is the file already known by the DDLParser? Returns 0 if not found, and index if found. More... | |
bool | isParsed (const std::string &filename) |
Is the file already parsed? More... | |
int | parse (const DDLDocumentProvider &dp) |
Parse all files. Return is meaningless. More... | |
void | parse (const std::vector< unsigned char > &ablob, unsigned int bsize) |
bool | parseOneFile (const std::string &filename) |
Process a single files. More... | |
~DDLParser () | |
Destructor terminates the XMLPlatformUtils (as required by Xerces) More... | |
Protected Member Functions | |
DDLParser () | |
void | parseFile (const int &numtoproc) |
Parse File. Just to hold some common looking code. More... | |
Private Attributes | |
DDCompactView & | cpv_ |
reference to storage More... | |
std::string | currFileName_ |
Which file is currently being processed. More... | |
DDLSAX2Handler * | errHandler_ |
DDLSAX2ExpressionHandler * | expHandler_ |
DDLSAX2FileHandler * | fileHandler_ |
FileNameHolder | fileNames_ |
List of files to be processed, obtained from the DDLDocumentProvider. More... | |
int | nFiles_ |
Number of files + 1. More... | |
std::map< int, bool > | parsed_ |
Parse status of a given file. More... | |
SAX2XMLReader * | SAX2Parser_ |
SAX2XMLReader is one way of parsing. More... | |
DDLParser is the main class of Detector Description Language Parser.
begin: Mon Oct 22 2001 email: case@ ucdh ep.uc davi s.edu
Singleton which controls the parsing of XML files (DDL). It guarantees that a given filename will only be parsed once regardless of its path. It now relies on a DDLDocumentProvider class which provides a list of file names and URLs to be parsed.
It uses the Xerces C++ Parser from the Apache Group straight-forwardly. One main thing to note is that only one DDLParser can ever be made. This allows for sub-components of the parser to easily find out information from the parser during run-time.
There is an interface to parse just one file. If one uses this method and does not use the default DDLDocumentProvider user is responsible for also setting the DDRootDef.
Modification: 2003-02-13: Michael Case, Stepan Wynhoff and Martin Liendl 2003-02-24: same. DDLParser will use DDLDocumentProvider (abstract). One of these and will be defaulted to DDLConfiguration. This will read the "configuration.xml" file provided and will be used by the Parser to "get" the files. 2005-11-13: Michael Case removed some of the un-necessary methods that were deprecated. 2010-01 to 2010-04 sometime: Michael Case removed singleton-ness. MUST have a DDCompactView to refer to and no more default constructor at the moment. 2010-07-29: removed DDLConfiguration; use FIPConfiguration, it is easier. for CMSSW Framework example see XMLIdealGeometryESSource (different DDLDocumentProvider completely
Definition at line 64 of file DDLParser.h.
typedef std::map< int, std::pair<std::string, std::string> > DDLParser::FileNameHolder |
Definition at line 70 of file DDLParser.h.
typedef XERCES_CPP_NAMESPACE::SAX2XMLReader DDLParser::SAX2XMLReader |
Definition at line 68 of file DDLParser.h.
DDLParser::DDLParser | ( | DDCompactView & | cpv | ) |
Constructor MUST associate a DDCompactView storage.
Definition at line 30 of file DDLParser.cc.
References DCOUT_V, errHandler_, expHandler_, fileHandler_, SAX2Parser_, and cms::concurrency::xercesInitialize().
|
protected |
DDLParser::~DDLParser | ( | void | ) |
Destructor terminates the XMLPlatformUtils (as required by Xerces)
Definition at line 52 of file DDLParser.cc.
References DCOUT_V, errHandler_, expHandler_, fileHandler_, and cms::concurrency::xercesTerminate().
void DDLParser::clearFiles | ( | void | ) |
Clear the file list - see Warning!
This could result in mangled geometry if the Core has not been cleared.
Definition at line 373 of file DDLParser.cc.
References fileNames_, and parsed_.
Referenced by XMLIdealMagneticFieldGeometryESProducer::produce(), magneticfield::VolumeBasedMagneticFieldESProducerFromDB::produce(), and XMLIdealGeometryESProducer::produce().
std::string DDLParser::extractFileName | ( | std::string | fullname | ) |
Definition at line 380 of file DDLParser.cc.
References run_regression::ret, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by parse(), and parseOneFile().
DDLSAX2FileHandler * DDLParser::getDDLSAX2FileHandler | ( | void | ) |
To get the parent this class allows access to the handler.
In order to retrieve the name of the parent element from DDLSAX2Handlers.
Definition at line 73 of file DDLParser.cc.
References fileHandler_.
Referenced by XMLIdealGeometryESSource::produce(), XMLIdealMagneticFieldGeometryESProducer::produce(), magneticfield::VolumeBasedMagneticFieldESProducerFromDB::produce(), and XMLIdealGeometryESProducer::produce().
std::vector< std::string > DDLParser::getFileList | ( | void | ) |
Return list of files.
Definition at line 193 of file DDLParser.cc.
References fileNames_.
std::string DDLParser::getNameSpace | ( | const std::string & | fname | ) |
Definition at line 391 of file DDLParser.cc.
References j, run_regression::ret, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by parse(), and parseOneFile().
SAX2XMLReader * DDLParser::getXMLParser | ( | void | ) |
Get the SAX2Parser from the DDLParser. USE WITH CAUTION. Set your own handler, etc.
This method allows external "users" to use the current DDLParser on their own. by giving them access to the SAX2XMLReader. This may not be a good idea! The reason that I
Definition at line 67 of file DDLParser.cc.
References SAX2Parser_.
Referenced by FIPConfiguration::readConfig().
size_t DDLParser::isFound | ( | const std::string & | filename | ) |
Is the file already known by the DDLParser? Returns 0 if not found, and index if found.
Definition at line 79 of file DDLParser.cc.
References fileNames_, and i.
Referenced by isParsed(), parse(), and parseOneFile().
bool DDLParser::isParsed | ( | const std::string & | filename | ) |
Is the file already parsed?
Definition at line 99 of file DDLParser.cc.
References newFWLiteAna::found, isFound(), and parsed_.
int DDLParser::parse | ( | const DDLDocumentProvider & | dp | ) |
Parse all files. Return is meaningless.
Definition at line 204 of file DDLParser.cc.
References currFileName_, DCOUT, DDLSAX2FileHandler::dumpElementTypeCounter(), expHandler_, extractFileName(), fileHandler_, fileNames_, DDLDocumentProvider::getFileList(), getNameSpace(), DDLDocumentProvider::getURLList(), i, isFound(), LogDebug, nFiles_, parsed_, parseFile(), SAX2Parser_, DDLSAX2Handler::setNameSpace(), findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by output(), XMLIdealGeometryESSource::produce(), XMLIdealMagneticFieldGeometryESProducer::produce(), magneticfield::VolumeBasedMagneticFieldESProducerFromDB::produce(), XMLIdealGeometryESProducer::produce(), and testParser().
void DDLParser::parse | ( | const std::vector< unsigned char > & | ablob, |
unsigned int | bsize | ||
) |
Definition at line 185 of file DDLParser.cc.
References SAX2Parser_.
|
protected |
Parse File. Just to hold some common looking code.
Definition at line 342 of file DDLParser.cc.
References currFileName_, DCOUT, fileNames_, plotBeamSpotDB::first, alignmentValidation::fname, parsed_, SAX2Parser_, edm::second(), and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by parse(), and parseOneFile().
bool DDLParser::parseOneFile | ( | const std::string & | filename | ) |
Process a single files.
This method allows a user to add to an existing DDD by parsing a new XML file. Ideally, these would be in addition to an existing DDD configuration which was processed using Parse(...).
The idea is based on whether users decide that the configuration will only hold "standard geometry files" and that any ancillary parameter files, filters and so forth will be unknown to the main configuration file. For me, this seems to go against the principle of knowing what files are relevant because now, there is no central way to find out (externally) what XML files generate the DDD in memory.
On the other hand, if on any run, a dumpFileList is run, then the user will at least know what files were used from where in a given run.
2007-04-06: filename is now relative to src directory of checkout (or share). edm:FileInPath used internally.
Definition at line 110 of file DDLParser.cc.
References currFileName_, DCOUT, DCOUT_V, expHandler_, extractFileName(), fileHandler_, lut2db_cfg::filename, fileNames_, personalPlayback::fp, edm::FileInPath::fullPath(), getNameSpace(), isFound(), LogDebug, nFiles_, parsed_, parseFile(), SAX2Parser_, edm::second(), DDLSAX2Handler::setNameSpace(), and AlCaHLTBitMon_QueryRunRegistry::string.
|
private |
reference to storage
Definition at line 146 of file DDLParser.h.
|
private |
Which file is currently being processed.
Definition at line 158 of file DDLParser.h.
Referenced by parse(), parseFile(), and parseOneFile().
|
private |
Definition at line 165 of file DDLParser.h.
Referenced by DDLParser(), and ~DDLParser().
|
private |
Definition at line 164 of file DDLParser.h.
Referenced by DDLParser(), parse(), parseOneFile(), and ~DDLParser().
|
private |
Definition at line 163 of file DDLParser.h.
Referenced by DDLParser(), getDDLSAX2FileHandler(), parse(), parseOneFile(), and ~DDLParser().
|
private |
List of files to be processed, obtained from the DDLDocumentProvider.
Definition at line 149 of file DDLParser.h.
Referenced by clearFiles(), getFileList(), isFound(), parse(), parseFile(), and parseOneFile().
|
private |
Number of files + 1.
Definition at line 155 of file DDLParser.h.
Referenced by parse(), and parseOneFile().
|
private |
Parse status of a given file.
Definition at line 152 of file DDLParser.h.
Referenced by clearFiles(), isParsed(), parse(), parseFile(), and parseOneFile().
|
private |
SAX2XMLReader is one way of parsing.
Definition at line 161 of file DDLParser.h.
Referenced by DDLParser(), getXMLParser(), parse(), parseFile(), and parseOneFile().