MarlinMT
0.1.0
|
XMLConfigWriter plugin Write an XML file from the configuration sections and parameters. More...
Inherits marlinmt::ConfigWriter.
Public Types | |
using | StringMap = std::vector< std::pair< std::string, std::string > > |
Public Member Functions | |
void | init (const std::string &desc) override |
Initialize the parser. More... | |
void | write (const Configuration &cfg) override |
Write the configuration object. More... | |
TiXmlElement | createParameterSection (const std::string &name, const ConfigSection §ion, const StringMap &attrMapping={}) |
Create an XML element containing all parameters from a section. More... | |
void | appendDescription (TiXmlElement &element, const ConfigSection §ion) const |
Append the config section description in the element tree as comment. More... | |
TiXmlElement | createElement (const std::string &name, const StringMap &attrs={}) const |
TiXmlComment | createComment (const std::string &comment) const |
TiXmlText | createText (const std::string &text) const |
TiXmlElement | createParameter (const std::string &name, const std::string &value) const |
Public Member Functions inherited from marlinmt::ConfigWriter | |
virtual | ~ConfigWriter ()=default |
Default destructor. More... | |
Private Attributes | |
std::string | _fname {} |
The output file name. More... | |
XMLConfigWriter plugin Write an XML file from the configuration sections and parameters.
Definition at line 23 of file XMLConfigWriter.cc.
using marlinmt::XMLConfigWriter::StringMap = std::vector<std::pair<std::string, std::string> > |
Definition at line 25 of file XMLConfigWriter.cc.
void marlinmt::XMLConfigWriter::appendDescription | ( | TiXmlElement & | element, |
const ConfigSection & | section | ||
) | const |
Append the config section description in the element tree as comment.
element | the parent element of the XML comment |
section | the config section to get the description from |
Definition at line 153 of file XMLConfigWriter.cc.
References createComment(), and marlinmt::ConfigSection::metadata().
Referenced by write().
TiXmlComment marlinmt::XMLConfigWriter::createComment | ( | const std::string & | comment | ) | const |
Definition at line 202 of file XMLConfigWriter.cc.
Referenced by appendDescription(), createParameterSection(), and write().
TiXmlElement marlinmt::XMLConfigWriter::createElement | ( | const std::string & | name, |
const StringMap & | attrs = {} |
||
) | const |
Definition at line 192 of file XMLConfigWriter.cc.
Referenced by createParameter(), createParameterSection(), and write().
TiXmlElement marlinmt::XMLConfigWriter::createParameter | ( | const std::string & | name, |
const std::string & | value | ||
) | const |
Definition at line 214 of file XMLConfigWriter.cc.
References createElement(), createText(), and MARLINMT_DECLARE_CONFIG_WRITER.
Referenced by createParameterSection().
TiXmlElement marlinmt::XMLConfigWriter::createParameterSection | ( | const std::string & | name, |
const ConfigSection & | section, | ||
const StringMap & | attrMapping = {} |
||
) |
Create an XML element containing all parameters from a section.
The list of attributes in third argument is a mapping of parameters to write as XML element attribute and not as parameter.
name | the XML element name |
section | the config section to dump |
attrMapping | a list of parameters to add as element attribute, not in parameter list |
Definition at line 162 of file XMLConfigWriter.cc.
References createComment(), createElement(), createParameter(), marlinmt::details::keys(), marlinmt::ConfigSection::metadata(), marlinmt::ConfigSection::parameter(), and marlinmt::ConfigSection::parameters().
Referenced by write().
TiXmlText marlinmt::XMLConfigWriter::createText | ( | const std::string & | text | ) | const |
Definition at line 208 of file XMLConfigWriter.cc.
Referenced by createParameter().
|
overridevirtual |
Initialize the parser.
The descriptor string can be e.g:
desc | a descriptor string |
Implements marlinmt::ConfigWriter.
Definition at line 64 of file XMLConfigWriter.cc.
References _fname.
|
overridevirtual |
Write the configuration object.
cfg | the configuration object to write |
Implements marlinmt::ConfigWriter.
Definition at line 70 of file XMLConfigWriter.cc.
References _fname, appendDescription(), createComment(), createElement(), createParameterSection(), marlinmt::Configuration::hasSection(), MARLINMT_RELEASE, marlinmt::ConfigSection::parameter(), marlinmt::ConfigSection::parameters(), marlinmt::Configuration::section(), and marlinmt::ConfigSection::subsectionNames().
|
private |
The output file name.
Definition at line 58 of file XMLConfigWriter.cc.