Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:47

0001 #ifndef L1Trigger_L1TCommon_l1t_XmlConfigParser_h
0002 #define L1Trigger_L1TCommon_l1t_XmlConfigParser_h
0003 
0004 #include <string>
0005 #include <vector>
0006 
0007 #include "xercesc/util/XercesDefs.hpp"
0008 #include "xercesc/parsers/XercesDOMParser.hpp"
0009 #include "xercesc/dom/DOM.hpp"
0010 #include "xercesc/framework/MemBufInputSource.hpp"
0011 
0012 namespace XERCES_CPP_NAMESPACE {
0013 
0014   class DOMNode;
0015   class XercesDOMParser;
0016 
0017 }  // namespace XERCES_CPP_NAMESPACE
0018 
0019 namespace l1t {
0020 
0021   class TriggerSystem;
0022 
0023   class XmlConfigParser {
0024   public:
0025     const XMLCh* kTagHw;
0026     const XMLCh* kTagAlgo;
0027     const XMLCh* kTagRunSettings;
0028     const XMLCh* kTagDb;
0029     const XMLCh* kTagKey;
0030     const XMLCh* kTagLoad;
0031     const XMLCh* kTagContext;
0032     const XMLCh* kTagParam;
0033     const XMLCh* kTagMask;
0034     const XMLCh* kTagDisable;
0035     const XMLCh* kTagExclBoards;
0036     const XMLCh* kTagExclude;
0037     const XMLCh* kTagColumns;
0038     const XMLCh* kTagTypes;
0039     const XMLCh* kTagRow;
0040     const XMLCh* kTagProcessor;
0041     const XMLCh* kTagRole;
0042     const XMLCh* kTagCrate;
0043     const XMLCh* kTagSlot;
0044     const XMLCh* kTagDaqTtc;
0045     const XMLCh* kAttrId;
0046     const XMLCh* kAttrType;
0047     const XMLCh* kAttrDelim;
0048     const XMLCh* kAttrModule;
0049     const std::string kTypeTable;
0050 
0051     XmlConfigParser();
0052     XmlConfigParser(xercesc::DOMDocument* doc);
0053     ~XmlConfigParser();
0054     void readDOMFromString(const std::string& str, xercesc::DOMDocument*& doc);
0055     void readDOMFromString(const std::string& str);
0056     void readDOMFromFile(const std::string& fName, xercesc::DOMDocument*& doc);
0057     void readDOMFromFile(const std::string& fName);
0058     void readRootElement(TriggerSystem& aTriggerSystem, const std::string& sysId = "");
0059     void readElement(const xercesc::DOMElement* element, TriggerSystem& aTriggerSystem, const std::string& sysId = "");
0060     void readHwDescription(const xercesc::DOMElement* element,
0061                            TriggerSystem& aTriggerSystem,
0062                            const std::string& sysId = "");
0063     void readContext(const xercesc::DOMElement* element, const std::string& sysId, TriggerSystem& aTriggerSystem);
0064     void readContexts(const std::string& key, const std::string& sysId, TriggerSystem& aTriggerSystem);
0065     xercesc::DOMElement* getKeyElement(const std::string& key);
0066     void buildGlobalDoc(const std::string& key, const std::string& topPath = "");
0067 
0068   private:
0069     xercesc::XercesDOMParser* parser_;
0070     xercesc::DOMDocument* doc_;
0071 
0072     void appendNodesFromSubDoc(xercesc::DOMNode* parentNode, xercesc::DOMDocument* subDoc);
0073     void pruneString(std::string& str);
0074     char* pruneString(char*& str);
0075   };
0076 
0077 }  // namespace l1t
0078 #endif