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 218 of file Parser.C.

Constructor & Destructor Documentation

◆ BadActiveWalker()

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

Definition at line 221 of file Parser.C.

221 : _fname(fname) {}
std::string _fname
Definition: Parser.C:285

Member Function Documentation

◆ walk()

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

Definition at line 222 of file Parser.C.

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

Member Data Documentation

◆ _fname

std::string BadActiveWalker::_fname
private

Definition at line 285 of file Parser.C.

Referenced by walk().

◆ errors

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

Definition at line 282 of file Parser.C.

Referenced by Parser::parse(), and walk().


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