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::HcalPatternXMLParser ( )

Definition at line 16 of file HcalPatternXMLParser.cc.

References m_parser.

16 { m_parser = nullptr; }
HcalPatternXMLParserImpl * m_parser

◆ ~HcalPatternXMLParser()

HcalPatternXMLParser::~HcalPatternXMLParser ( )

Definition at line 17 of file HcalPatternXMLParser.cc.

References m_parser.

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

Member Function Documentation

◆ parse() [1/2]

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 171 of file HcalPatternXMLParser.cc.

References cppFunctionSkipper::exception, Exception, mps_monitormerge::items, m_parser, HcalPatternXMLParserImpl::parser, and TrackRefitter_38T_cff::src.

Referenced by parse().

174  {
175  // uses XERCES SAX2 parser
176  ConfigurationDBHandler handler(parameters, items, encoding);
177 
178  try {
179  if (m_parser == nullptr) {
181  m_parser->parser = std::unique_ptr<xercesc::SAX2XMLReader>(xercesc::XMLReaderFactory::createXMLReader());
182  }
183 
184  MemBufInputSource src((const unsigned char*)xmlDocument.c_str(), xmlDocument.length(), "hcal::PatternReader");
185  m_parser->parser->setContentHandler(&handler);
186  m_parser->parser->parse(src);
187  } catch (std::exception& ex) {
188  throw cms::Exception("ParseError") << ex.what();
189  }
190 }
std::unique_ptr< SAX2XMLReader > parser
HcalPatternXMLParserImpl * m_parser

◆ parse() [2/2]

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

Definition at line 192 of file HcalPatternXMLParser.cc.

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

194  {
195  std::vector<std::string> items;
196  std::string encoding;
197 
198  this->parse(xmlDocument, parameters, items, encoding);
199  int formatting = 0;
200  if (encoding == "dec")
201  formatting = 10;
202  if (encoding == "hex")
203  formatting = 16;
204 
205  data.clear();
206  for (std::vector<std::string>::const_iterator i = items.begin(); i != items.end(); i++)
207  data.push_back(strtol(i->c_str(), nullptr, formatting));
208 }
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:80

Member Data Documentation

◆ m_parser

HcalPatternXMLParserImpl* HcalPatternXMLParser::m_parser
private

Definition at line 25 of file HcalPatternXMLParser.h.

Referenced by HcalPatternXMLParser(), parse(), and ~HcalPatternXMLParser().