CMS 3D CMS Logo

Public Member Functions | Private Attributes

HcalPatternXMLParser Class Reference

#include <HcalPatternXMLParser.h>

List of all members.

Public Member Functions

 HcalPatternXMLParser ()
void parse (const std::string &xmlDocument, std::map< std::string, std::string > &parameters, std::vector< uint32_t > &items)
void parse (const std::string &xmlDocument, std::map< std::string, std::string > &parameters, std::vector< std::string > &items, std::string &encoding)
 ~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.

References m_parser.

                                           {
  m_parser=0;
}
HcalPatternXMLParser::~HcalPatternXMLParser ( )

Definition at line 19 of file HcalPatternXMLParser.cc.

References m_parser.

                                            {
  if (m_parser!=0) delete 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 exception, Exception, m_parser, HcalPatternXMLParserImpl::parser, and align_tpl::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.

References i, and parse().

                                                                                                                                 {
  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));

}

Member Data Documentation

Definition at line 19 of file HcalPatternXMLParser.h.

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