24#ifndef IO_XML_READER_OUTPUT_H_
25#define IO_XML_READER_OUTPUT_H_
40 template<
typename ParameterType>
41 void parameterReading(std::vector<std::string> parameters, ParameterType& var,
42 bool defaultAvailable,
bool exitIfMissing,
bool showWarning)
const;
43 void loadFile(
bool loadOK, std::string fName)
const;
44 void readValue(
bool warningsOn, std::string name, std::string fName)
const;
45 void printWarning(std::string name, std::string typeName, std::string value,
46 bool verboseOn,
bool exitIfMissing)
const;
47 template<
typename XMLreaderType>
48 void print(
int indent, XMLreaderType& xmlReader)
const;
74template<
typename ParameterType>
77 bool defaultAvailable,
79 bool showWarning)
const
82 clout <<
"Warning: Cannot read parameter from XML File: ";
83 std::for_each(parameters.begin(), parameters.end(), [
this](
const std::string name_parameter)
84 { clout <<
"<" << name_parameter <<
">"; });
87 if ( exitIfMissing ) {
88 clout <<
"Error: This program cannot continue without ";
89 std::for_each(parameters.begin(), parameters.end(), [
this](
const std::string name_parameter)
90 { clout <<
"<" << name_parameter <<
">"; });
91 clout <<
". Optimization aborted." << std::endl;
94 if (defaultAvailable) {
95 clout <<
"\t Setting default value: " << parameters.back() <<
" = "<< var << std::endl;
98 clout <<
"\t Setting arbitrarily: " << parameters.back() <<
" = " << var << std::endl;
107 clout << std::string(
"Problem processing input XML file ") << fName << std::endl;
114 clout <<
"Warning: cannot read value from node \"" << name <<
"\"" <<
", \"" << fName <<
"\"" << std::endl;
120 std::string value,
bool verboseOn,
bool exitIfMissing)
const
124 clout <<
"Warning: Cannot read " << typeName <<
" value from XML element " << name <<
"." << std::endl;
125 if ( ! value.empty() ) {
126 clout <<
" Setting default value = " << value << std::endl;
129 if ( exitIfMissing ) {
130 clout <<
"Error: This program cannot continue without \"" << name <<
"\". Optimization aborted." << std::endl;
136template<
typename XMLreaderType>
138 std::string indentStr(indent,
' ');
139 clout << indentStr <<
"[" << xmlReader.getName() <<
"]" << std::endl;
140 if (!xmlReader.getText().empty()) {
141 clout << indentStr <<
" " << xmlReader.getText() << std::endl;
143 for (
unsigned int iNode=0; iNode<xmlReader._children.size(); ++iNode) {
144 xmlReader._children[iNode]->_output.print(indent+2,*xmlReader._children[iNode]);
class for marking output with some text
void loadFile(bool loadOK, std::string fName) const
void parameterReading(std::vector< std::string > parameters, ParameterType &var, bool defaultAvailable, bool exitIfMissing, bool showWarning) const
void printWarning(std::string name, std::string typeName, std::string value, bool verboseOn, bool exitIfMissing) const
print warning if verbose mode is on and exit, if exItMissing is true
void print(int indent, XMLreaderType &xmlReader) const
printing the whole structure of the XMLreader
void readValue(bool warningsOn, std::string name, std::string fName) const
XMLreaderOutput(std::ostream &stream)
Top level namespace for all of OpenLB.