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.

16 { m_parser = nullptr; }

References m_parser.

◆ ~HcalPatternXMLParser()

HcalPatternXMLParser::~HcalPatternXMLParser ( )

Definition at line 17 of file HcalPatternXMLParser.cc.

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

References 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.

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 }

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

Referenced by parse().

◆ 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.

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 }

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

Member Data Documentation

◆ m_parser

HcalPatternXMLParserImpl* HcalPatternXMLParser::m_parser
private

Definition at line 25 of file HcalPatternXMLParser.h.

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

BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
mps_fire.i
i
Definition: mps_fire.py:428
HcalPatternXMLParser::m_parser
HcalPatternXMLParserImpl * m_parser
Definition: HcalPatternXMLParser.h:25
HcalPatternXMLParserImpl
Definition: HcalPatternXMLParser.cc:11
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
HcalPatternXMLParserImpl::parser
std::unique_ptr< SAX2XMLReader > parser
Definition: HcalPatternXMLParser.cc:13
HcalPatternXMLParser::parse
void parse(const std::string &xmlDocument, std::map< std::string, std::string > &parameters, std::vector< std::string > &items, std::string &encoding)
Definition: HcalPatternXMLParser.cc:171
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
ConfigurationDBHandler
Definition: ConfigurationDatabaseStandardXMLParser.cc:37
Exception
Definition: hltDiff.cc:246
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79