OpenLB 1.7
|
#include <xmlReader.h>
Public Member Functions | |
XMLreader (TiXmlNode *pParent, OutputChannel outputChannel=OutputChannel::ERRCHANNEL) | |
Constructs a new XMLreader from another XMLreader. | |
XMLreader (const std::string &fName, OutputChannel outputChannel=OutputChannel::ERRCHANNEL) | |
Constructs a new XMLreader from a XML file fName. | |
~XMLreader () | |
destructor | |
template<typename T > | |
bool | read (T &value, bool verboseOn=true, bool exitIfMissing=false) const |
Prints out the XML structure read in, mostly for debugging purposes. | |
template<typename T , unsigned DIM> | |
bool | read (util::ADf< T, DIM > &value, bool verboseOn=true, bool exitIfMissing=false) const |
template<typename T > | |
bool | read (std::vector< T > &value, bool verboseOn=true, bool exitIfMissing=false) const |
template<typename T > | |
T | get (bool verboseOn=true, bool exitIfMissing=false) const |
template<typename ParameterType > | |
bool | readOrWarn (std::string name_parameter_1, std::string name_parameter_2, std::string name_parameter_3, ParameterType &var, bool defaultAvailable=true, bool exitIfMissing=false, bool showWarning=true) const |
This wrapper function reads the given parameter from the "type_parameter" and "name_parameter_1" or "name_parameter_2" tag and prints a warning, if the parameter can not be read. | |
template<typename ParameterType > | |
bool | readOrWarn (std::string name_parameter_1, std::string name_parameter_2, std::string name_parameter_3, std::string name_parameter_4, ParameterType &var, bool defaultAvailable=true, bool exitIfMissing=false, bool showWarning=true) const |
XMLreader const & | operator[] (std::string name) const |
std::vector< XMLreader * >::const_iterator | begin () const |
Returns an iterator.begin() of the child XMLreader This means an iterator to the next level on an XML tree. | |
std::vector< XMLreader * >::const_iterator | end () const |
Returns an iterator.end() of the child XMLreader This means an iterator to the next level on an XML tree. | |
void | setWarningsOn (bool warnings) const |
switch warnings on/off | |
std::string | getName () const |
return the name of the element | |
std::string | getText () const |
return the text of the element | |
std::string | getAttribute (const std::string &aName) const |
template<> | |
bool | read (bool &value, bool verboseOn, bool exitIfMissing) const |
template<> | |
bool | read (int &value, bool verboseOn, bool exitIfMissing) const |
template<> | |
bool | read (double &value, bool verboseOn, bool exitIfMissing) const |
template<> | |
bool | read (long double &value, bool verboseOn, bool exitIfMissing) const |
template<> | |
bool | read (float &value, bool verboseOn, bool exitIfMissing) const |
Public Attributes | |
XMLreaderOutput | _output |
handling all the output for the XMLreader | |
Protected Attributes | |
std::map< std::string, std::string > | _attributes |
std::vector< XMLreader * > | _children |
Friends | |
class | olb::XMLreaderOutput |
Definition at line 49 of file xmlReader.h.
olb::XMLreader::XMLreader | ( | TiXmlNode * | pParent, |
OutputChannel | outputChannel = OutputChannel::ERRCHANNEL ) |
Constructs a new XMLreader from another XMLreader.
pParent | The new root node for the XMLreader |
Definition at line 244 of file xmlReader.h.
References olb::singleton::mpi().
olb::XMLreader::XMLreader | ( | const std::string & | fName, |
OutputChannel | outputChannel = OutputChannel::ERRCHANNEL ) |
Constructs a new XMLreader from a XML file fName.
Definition at line 257 of file xmlReader.h.
References _output, olb::XMLreaderOutput::loadFile(), and olb::singleton::mpi().
olb::XMLreader::~XMLreader | ( | ) |
std::vector< XMLreader * >::const_iterator olb::XMLreader::begin | ( | ) | const |
Returns an iterator.begin() of the child XMLreader This means an iterator to the next level on an XML tree.
Definition at line 392 of file xmlReader.h.
References _children, and begin().
std::vector< XMLreader * >::const_iterator olb::XMLreader::end | ( | ) | const |
Returns an iterator.end() of the child XMLreader This means an iterator to the next level on an XML tree.
Definition at line 397 of file xmlReader.h.
References _children.
T olb::XMLreader::get | ( | bool | verboseOn = true, |
bool | exitIfMissing = false ) const |
Definition at line 163 of file xmlReader.h.
References _output, and olb::XMLreaderOutput::printWarning().
std::string olb::XMLreader::getAttribute | ( | const std::string & | aName | ) | const |
Definition at line 541 of file xmlReader.h.
References _attributes.
std::string olb::XMLreader::getName | ( | ) | const |
return the name of the element
Definition at line 402 of file xmlReader.h.
std::string olb::XMLreader::getText | ( | ) | const |
return the text of the element
Definition at line 407 of file xmlReader.h.
XMLreader const & olb::XMLreader::operator[] | ( | std::string | name | ) | const |
name | The name from which to take the subtree |
Definition at line 381 of file xmlReader.h.
References _children, _output, and olb::XMLreaderOutput::readValue().
bool olb::XMLreader::read | ( | bool & | value, |
bool | verboseOn, | ||
bool | exitIfMissing ) const |
Definition at line 422 of file xmlReader.h.
References _output, and olb::XMLreaderOutput::printWarning().
bool olb::XMLreader::read | ( | double & | value, |
bool | verboseOn, | ||
bool | exitIfMissing ) const |
Definition at line 481 of file xmlReader.h.
References _output, and olb::XMLreaderOutput::printWarning().
bool olb::XMLreader::read | ( | float & | value, |
bool | verboseOn, | ||
bool | exitIfMissing ) const |
Definition at line 508 of file xmlReader.h.
References _output, and olb::XMLreaderOutput::printWarning().
bool olb::XMLreader::read | ( | int & | value, |
bool | verboseOn, | ||
bool | exitIfMissing ) const |
Definition at line 449 of file xmlReader.h.
References _output, and olb::XMLreaderOutput::printWarning().
bool olb::XMLreader::read | ( | long double & | value, |
bool | verboseOn, | ||
bool | exitIfMissing ) const |
Definition at line 495 of file xmlReader.h.
References _output, and olb::XMLreaderOutput::printWarning().
bool olb::XMLreader::read | ( | std::vector< T > & | value, |
bool | verboseOn = true, | ||
bool | exitIfMissing = false ) const |
Definition at line 141 of file xmlReader.h.
References _output, and olb::XMLreaderOutput::printWarning().
bool olb::XMLreader::read | ( | T & | value, |
bool | verboseOn = true, | ||
bool | exitIfMissing = false ) const |
Prints out the XML structure read in, mostly for debugging purposes.
Read a value from the xml file
reference | to return the value |
bool olb::XMLreader::read | ( | util::ADf< T, DIM > & | value, |
bool | verboseOn = true, | ||
bool | exitIfMissing = false ) const |
Definition at line 125 of file xmlReader.h.
References _output, and olb::XMLreaderOutput::printWarning().
bool olb::XMLreader::readOrWarn | ( | std::string | name_parameter_1, |
std::string | name_parameter_2, | ||
std::string | name_parameter_3, | ||
ParameterType & | var, | ||
bool | defaultAvailable = true, | ||
bool | exitIfMissing = false, | ||
bool | showWarning = true ) const |
This wrapper function reads the given parameter from the "type_parameter" and "name_parameter_1" or "name_parameter_2" tag and prints a warning, if the parameter can not be read.
The warning contains the default value, if available. Will exit(1) if exitIfMissing == true. The warning is not displayed, if showWarning == false.
Definition at line 178 of file xmlReader.h.
References _output, olb::XMLreaderOutput::parameterReading(), and setWarningsOn().
bool olb::XMLreader::readOrWarn | ( | std::string | name_parameter_1, |
std::string | name_parameter_2, | ||
std::string | name_parameter_3, | ||
std::string | name_parameter_4, | ||
ParameterType & | var, | ||
bool | defaultAvailable = true, | ||
bool | exitIfMissing = false, | ||
bool | showWarning = true ) const |
name | The name from which to take the subtree |
Definition at line 203 of file xmlReader.h.
References _output, olb::XMLreaderOutput::parameterReading(), and setWarningsOn().
void olb::XMLreader::setWarningsOn | ( | bool | warnings | ) | const |
switch warnings on/off
Definition at line 412 of file xmlReader.h.
References _children.
|
friend |
Definition at line 50 of file xmlReader.h.
|
protected |
Definition at line 118 of file xmlReader.h.
|
protected |
Definition at line 119 of file xmlReader.h.
XMLreaderOutput olb::XMLreader::_output |
handling all the output for the XMLreader
Definition at line 106 of file xmlReader.h.