Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:40:19

0001 #include "DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler.h"
0002 #include "DetectorDescription/Core/interface/ClhepEvaluator.h"
0003 #include "DetectorDescription/Parser/interface/DDLElementRegistry.h"
0004 #include "Utilities/Xerces/interface/XercesStrUtils.h"
0005 
0006 #include <map>
0007 #include <string>
0008 
0009 using namespace cms::xerces;
0010 
0011 class DDCompactView;
0012 
0013 DDLSAX2ExpressionHandler::DDLSAX2ExpressionHandler(DDCompactView& cpv, DDLElementRegistry& reg)
0014     : DDLSAX2FileHandler::DDLSAX2FileHandler(cpv, reg) {}
0015 
0016 DDLSAX2ExpressionHandler::~DDLSAX2ExpressionHandler(void) {}
0017 
0018 // This does most of the work, it sets and determines whether it is
0019 // in a ConstantsSection element, and if so, to process all the
0020 // constants accordingly.
0021 void DDLSAX2ExpressionHandler::startElement(const XMLCh* const uri,
0022                                             const XMLCh* const localname,
0023                                             const XMLCh* const qname,
0024                                             const Attributes& attrs) {
0025   if (XMLString::equals(qname, uStr("Constant").ptr())) {
0026     std::string varName = toString(attrs.getValue(uStr("name").ptr()));
0027     std::string varValue = toString(attrs.getValue(uStr("value").ptr()));
0028     ClhepEvaluator& ev = registry().evaluator();
0029     ev.set(nmspace_, varName, varValue);
0030   }
0031 }
0032 
0033 void DDLSAX2ExpressionHandler::endElement(const XMLCh* const uri,
0034                                           const XMLCh* const localname,
0035                                           const XMLCh* const qname) {}