www.mooseframework.org
Public Member Functions | Public Attributes | Private Attributes | List of all members
BadActiveWalker Class Reference
Inheritance diagram for BadActiveWalker:
[legend]

Public Member Functions

 BadActiveWalker (std::string fname)
 
void walk (const std::string &, const std::string &, hit::Node *section) override
 

Public Attributes

std::vector< std::string > errors
 

Private Attributes

std::string _fname
 

Detailed Description

Definition at line 222 of file Parser.C.

Constructor & Destructor Documentation

BadActiveWalker::BadActiveWalker ( std::string  fname)
inline

Definition at line 225 of file Parser.C.

225 : _fname(fname) {}
std::string _fname
Definition: Parser.C:289

Member Function Documentation

void BadActiveWalker::walk ( const std::string &  ,
const std::string &  ,
hit::Node *  section 
)
inlineoverride

Definition at line 226 of file Parser.C.

229  {
230  auto actives = section->find("active");
231  auto inactives = section->find("inactive");
232 
233  if (actives && inactives && actives->type() == hit::NodeType::Field &&
234  inactives->type() == hit::NodeType::Field && actives->parent() == inactives->parent())
235  {
236  errors.push_back(
237  errormsg(_fname, section, "'active' and 'inactive' parameters both provided in section"));
238  return;
239  }
240 
241  // ensures we don't recheck deeper nesting levels
242  if (actives && actives->type() == hit::NodeType::Field && actives->parent() == section)
243  {
244  auto vars = section->param<std::vector<std::string>>("active");
245  std::string msg = "";
246  for (auto & var : vars)
247  {
248  if (!section->find(var))
249  msg += var + ", ";
250  }
251  if (msg.size() > 0)
252  {
253  msg = msg.substr(0, msg.size() - 2);
254  errors.push_back(errormsg(_fname,
255  section,
256  "variables listed as active (",
257  msg,
258  ") in section '",
259  section->fullpath(),
260  "' not found in input"));
261  }
262  }
263  // ensures we don't recheck deeper nesting levels
264  if (inactives && inactives->type() == hit::NodeType::Field && inactives->parent() == section)
265  {
266  auto vars = section->param<std::vector<std::string>>("inactive");
267  std::string msg = "";
268  for (auto & var : vars)
269  {
270  if (!section->find(var))
271  msg += var + ", ";
272  }
273  if (msg.size() > 0)
274  {
275  msg = msg.substr(0, msg.size() - 2);
276  errors.push_back(errormsg(_fname,
277  section,
278  "variables listed as inactive (",
279  msg,
280  ") in section '",
281  section->fullpath(),
282  "' not found in input"));
283  }
284  }
285  }
std::vector< std::string > errors
Definition: Parser.C:286
std::string errormsg(std::string, hit::Node *)
Definition: Parser.h:39
std::string _fname
Definition: Parser.C:289

Member Data Documentation

std::string BadActiveWalker::_fname
private

Definition at line 289 of file Parser.C.

std::vector<std::string> BadActiveWalker::errors

Definition at line 286 of file Parser.C.

Referenced by Parser::parse().


The documentation for this class was generated from the following file: