#include <FWXMLConfigParser.h>
Public Member Functions | |
FWConfiguration * | config (void) |
void | data (const std::string &data) override |
void | debug_config_state_machine (const char *where, const std::string &tag, int state) |
void | endElement (const std::string &tag) override |
FWXMLConfigParser (std::istream &f) | |
void | pushConfig (Attributes &attributes) |
void | startElement (const std::string &tag, Attributes &attributes) override |
Public Member Functions inherited from SimpleSAXParser | |
const SimpleSAXParser & | operator= (const SimpleSAXParser &)=delete |
void | parse (void) |
SimpleSAXParser (std::istream &f) | |
SimpleSAXParser (const SimpleSAXParser &)=delete | |
virtual | ~SimpleSAXParser () |
Private Types | |
enum | STATES { IN_BEGIN_DOCUMENT, IN_PUSHED_CONFIG, IN_POPPED_CONFIG, IN_BEGIN_STRING, IN_STORED_STRING } |
Private Attributes | |
std::vector< std::pair< std::string, FWConfiguration * > > | m_configs |
std::string | m_currentConfigName |
std::unique_ptr< FWConfiguration > | m_first |
enum STATES | m_state |
Additional Inherited Members | |
Public Types inherited from SimpleSAXParser | |
typedef std::vector< Attribute > | Attributes |
enum | PARSER_STATES { IN_DOCUMENT, IN_BEGIN_TAG, IN_DONE, IN_BEGIN_ELEMENT, IN_ELEMENT_WHITESPACE, IN_END_ELEMENT, IN_ATTRIBUTE_KEY, IN_END_TAG, IN_DATA, IN_BEGIN_ATTRIBUTE_VALUE, IN_STRING, IN_END_ATTRIBUTE_VALUE, IN_STRING_ENTITY, IN_DATA_ENTITY } |
Helper class which reads the XML configuration and constructs the FWConfiguration classes.
State machine for the parser can be found by cut and pasting the following in graphviz.
digraph { IN_BEGIN_DOCUMENT->IN_PUSHED_CONFIG [label = "beginElement(config)"]
IN_PUSHED_CONFIG->IN_PUSHED_CONFIG [label = "beginElement(config)"] IN_PUSHED_CONFIG->IN_POPPED_CONFIG [label = "endElement(config)"] IN_PUSHED_CONFIG->IN_BEGIN_STRING [label = "beginElement(string)"]
IN_POPPED_CONFIG->IN_PUSHED_CONFIG [label = "beginElement(config)"] IN_POPPED_CONFIG->IN_POPPED_CONFIG [label = "endElement(config)"] IN_POPPED_CONFIG->DONE [label = "top level config popped"]
IN_BEGIN_STRING->IN_STORED_STRING [label = "data()"]; IN_BEGIN_STRING->IN_PUSHED_CONFIG [label = "endElement(string)"]
IN_STORED_STRING->IN_PUSHED_CONFIG [label = "endElement(string)"] }
Definition at line 32 of file FWXMLConfigParser.h.
|
private |
Enumerator | |
---|---|
IN_BEGIN_DOCUMENT | |
IN_PUSHED_CONFIG | |
IN_POPPED_CONFIG | |
IN_BEGIN_STRING | |
IN_STORED_STRING |
Definition at line 33 of file FWXMLConfigParser.h.
|
inline |
Definition at line 36 of file FWXMLConfigParser.h.
|
inline |
The parsed configuration. Notice that the parser owns it and destroys it when destroyed.
Definition at line 132 of file FWXMLConfigParser.h.
References m_first.
|
inlineoverridevirtual |
Executes any transaction in the state machine which happens when the xml parser finds some data (i.e. text) between tags This is mainly used to handle <string> element contents but also whitespace between tags.
Reimplemented from SimpleSAXParser.
Definition at line 118 of file FWXMLConfigParser.h.
References debug_config_state_machine(), IN_BEGIN_STRING, IN_STORED_STRING, m_configs, and m_state.
|
inline |
Definition at line 134 of file FWXMLConfigParser.h.
References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, and makeGlobalPositionRcd_cfg::tag.
Referenced by data(), endElement(), and startElement().
|
inlineoverridevirtual |
Executes any transaction in the state machine which happens when the xml parser closes an element.
Notice that we need to do addKeyValue on endElement (and carry around the FWConfigutation name) because of the "copy by value" policy of addKeyValue addition which would add empty FWConfiguration objects if done on startElement.
Reimplemented from SimpleSAXParser.
Definition at line 92 of file FWXMLConfigParser.h.
References debug_config_state_machine(), IN_BEGIN_STRING, IN_POPPED_CONFIG, IN_PUSHED_CONFIG, IN_STORED_STRING, crabWrapper::key, m_configs, m_state, AlCaHLTBitMon_QueryRunRegistry::string, and makeGlobalPositionRcd_cfg::tag.
|
inline |
Pushes the configuration on stack eventually
Definition at line 39 of file FWXMLConfigParser.h.
References MillePedeFileConverter_cfg::e, mps_fire::i, SimpleSAXParser::Attribute::key, m_configs, Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, SimpleSAXParser::Attribute::value, and BeamSplash_cfg::version.
Referenced by startElement().
|
inlineoverridevirtual |
Executes any transaction in the state machine which happens when the xml parser finds an new element.
Reimplemented from SimpleSAXParser.
Definition at line 60 of file FWXMLConfigParser.h.
References debug_config_state_machine(), IN_BEGIN_DOCUMENT, IN_BEGIN_STRING, IN_POPPED_CONFIG, IN_PUSHED_CONFIG, m_configs, m_first, m_state, pushConfig(), and makeGlobalPositionRcd_cfg::tag.
|
private |
Definition at line 144 of file FWXMLConfigParser.h.
Referenced by data(), endElement(), pushConfig(), and startElement().
|
private |
Definition at line 148 of file FWXMLConfigParser.h.
|
private |
Definition at line 146 of file FWXMLConfigParser.h.
Referenced by config(), and startElement().
|
private |
Definition at line 145 of file FWXMLConfigParser.h.
Referenced by data(), endElement(), and startElement().