#include <HcalPatternXMLParser.h>
Public Member Functions | |
HcalPatternXMLParser () | |
void | parse (const std::string &xmlDocument, std::map< std::string, std::string > ¶meters, std::vector< uint32_t > &items) |
void | parse (const std::string &xmlDocument, std::map< std::string, std::string > ¶meters, std::vector< std::string > &items, std::string &encoding) |
~HcalPatternXMLParser () | |
Private Attributes | |
HcalPatternXMLParserImpl * | m_parser |
Definition at line 12 of file HcalPatternXMLParser.h.
HcalPatternXMLParser::HcalPatternXMLParser | ( | ) |
HcalPatternXMLParser::~HcalPatternXMLParser | ( | ) |
Definition at line 19 of file HcalPatternXMLParser.cc.
References m_parser.
void HcalPatternXMLParser::parse | ( | const std::string & | xmlDocument, |
std::map< std::string, std::string > & | parameters, | ||
std::vector< std::string > & | items, | ||
std::string & | encoding | ||
) |
Definition at line 149 of file HcalPatternXMLParser.cc.
References exception, Exception, m_parser, HcalPatternXMLParserImpl::parser, and alcazmumu_cfi::src.
Referenced by HcalPatternSource::loadPatternFile(), and parse().
{ // uses XERCES SAX2 parser ConfigurationDBHandler handler(parameters,items,encoding); try { if (m_parser==0) { m_parser=new HcalPatternXMLParserImpl(); m_parser->parser=std::auto_ptr<xercesc::SAX2XMLReader>(xercesc::XMLReaderFactory::createXMLReader()); } MemBufInputSource src((const unsigned char*)xmlDocument.c_str(), xmlDocument.length(),"hcal::PatternReader"); m_parser->parser->setContentHandler(&handler); m_parser->parser->parse(src); } catch (std::exception& ex) { throw cms::Exception("ParseError") << ex.what(); } }
void HcalPatternXMLParser::parse | ( | const std::string & | xmlDocument, |
std::map< std::string, std::string > & | parameters, | ||
std::vector< uint32_t > & | items | ||
) |
Definition at line 167 of file HcalPatternXMLParser.cc.
{ std::vector<std::string> items; std::string encoding; this->parse(xmlDocument,parameters,items,encoding); int formatting=0; if (encoding=="dec") formatting=10; if (encoding=="hex") formatting=16; data.clear(); for (std::vector<std::string>::const_iterator i=items.begin(); i!=items.end(); i++) data.push_back(strtol(i->c_str(),0,formatting)); }
Definition at line 19 of file HcalPatternXMLParser.h.
Referenced by HcalPatternXMLParser(), parse(), and ~HcalPatternXMLParser().