CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HcalPatternXMLParser Class Reference

#include <HcalPatternXMLParser.h>

Public Member Functions

 HcalPatternXMLParser ()
 
void parse (const std::string &xmlDocument, std::map< std::string, std::string > &parameters, std::vector< std::string > &items, std::string &encoding)
 
void parse (const std::string &xmlDocument, std::map< std::string, std::string > &parameters, std::vector< uint32_t > &items)
 
 ~HcalPatternXMLParser ()
 

Private Attributes

HcalPatternXMLParserImplm_parser
 

Detailed Description

Definition at line 12 of file HcalPatternXMLParser.h.

Constructor & Destructor Documentation

HcalPatternXMLParser::HcalPatternXMLParser ( )

Definition at line 16 of file HcalPatternXMLParser.cc.

16  {
17  m_parser=nullptr;
18 }
HcalPatternXMLParserImpl * m_parser
HcalPatternXMLParser::~HcalPatternXMLParser ( )

Definition at line 19 of file HcalPatternXMLParser.cc.

19  {
20  if (m_parser!=nullptr) delete m_parser;
21 }
HcalPatternXMLParserImpl * m_parser

Member Function Documentation

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 cppFunctionSkipper::exception, Exception, and TrackRefitter_38T_cff::src.

Referenced by HcalPatternSource::loadPatternFile().

149  {
150  // uses XERCES SAX2 parser
151  ConfigurationDBHandler handler(parameters,items,encoding);
152 
153  try {
154  if (m_parser==nullptr) {
156  m_parser->parser=std::unique_ptr<xercesc::SAX2XMLReader>(xercesc::XMLReaderFactory::createXMLReader());
157  }
158 
159  MemBufInputSource src((const unsigned char*)xmlDocument.c_str(), xmlDocument.length(),"hcal::PatternReader");
160  m_parser->parser->setContentHandler(&handler);
161  m_parser->parser->parse(src);
162  } catch (std::exception& ex) {
163  throw cms::Exception("ParseError") << ex.what();
164  }
165  }
std::unique_ptr< SAX2XMLReader > parser
HcalPatternXMLParserImpl * m_parser
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.

References mps_fire::i, mps_monitormerge::items, dumpparser::parse(), and AlCaHLTBitMon_QueryRunRegistry::string.

167  {
168  std::vector<std::string> items;
169  std::string encoding;
170 
171  this->parse(xmlDocument,parameters,items,encoding);
172  int formatting=0;
173  if (encoding=="dec") formatting=10;
174  if (encoding=="hex") formatting=16;
175 
176  data.clear();
177  for (std::vector<std::string>::const_iterator i=items.begin(); i!=items.end(); i++)
178  data.push_back(strtol(i->c_str(),nullptr,formatting));
179 
180 }
void parse(const std::string &xmlDocument, std::map< std::string, std::string > &parameters, std::vector< std::string > &items, std::string &encoding)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82

Member Data Documentation

HcalPatternXMLParserImpl* HcalPatternXMLParser::m_parser
private

Definition at line 19 of file HcalPatternXMLParser.h.