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

Constructor & Destructor Documentation

◆ BadActiveWalker()

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

Definition at line 223 of file Parser.C.

223 : _fname(fname) {}
std::string _fname
Definition: Parser.C:287

Member Function Documentation

◆ walk()

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

Definition at line 224 of file Parser.C.

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

Member Data Documentation

◆ _fname

std::string BadActiveWalker::_fname
private

Definition at line 287 of file Parser.C.

Referenced by walk().

◆ errors

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

Definition at line 284 of file Parser.C.

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


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