https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
BadActiveWalker Class Reference

#include <Parser.h>

Inheritance diagram for BadActiveWalker:
[legend]

Public Member Functions

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

Public Attributes

std::vector< hit::ErrorMessage > errors
 

Detailed Description

Definition at line 62 of file Parser.h.

Member Function Documentation

◆ walk()

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

Definition at line 282 of file Parser.C.

285{
286 auto actives = section->find("active");
287 auto inactives = section->find("inactive");
288
289 if (actives && inactives && actives->type() == hit::NodeType::Field &&
290 inactives->type() == hit::NodeType::Field && actives->parent() == inactives->parent())
291 {
292 errors.emplace_back(
293 "'active' and 'inactive' parameters both provided in section '" + fullpath + "'", section);
294 return;
295 }
296
297 // ensures we don't recheck deeper nesting levels
298 if (actives && actives->type() == hit::NodeType::Field && actives->parent() == section)
299 {
300 auto vars = section->param<std::vector<std::string>>("active");
301 std::string msg = "";
302 for (auto & var : vars)
303 {
304 if (!section->find(var))
305 msg += var + ", ";
306 }
307 if (msg.size() > 0)
308 {
309 msg = msg.substr(0, msg.size() - 2);
310 errors.emplace_back("variables listed as active (" + msg + ") in section '" +
311 section->fullpath() + "' not found in input",
312 section);
313 }
314 }
315 // ensures we don't recheck deeper nesting levels
316 if (inactives && inactives->type() == hit::NodeType::Field && inactives->parent() == section)
317 {
318 auto vars = section->param<std::vector<std::string>>("inactive");
319 std::string msg = "";
320 for (auto & var : vars)
321 {
322 if (!section->find(var))
323 msg += var + ", ";
324 }
325 if (msg.size() > 0)
326 {
327 msg = msg.substr(0, msg.size() - 2);
328 errors.emplace_back("variables listed as inactive (" + msg + ") in section '" +
329 section->fullpath() + "' not found in input",
330 section);
331 }
332 }
333}
char ** vars
std::vector< hit::ErrorMessage > errors
Definition Parser.h:68

Referenced by Parser::parse().

Member Data Documentation

◆ errors

std::vector<hit::ErrorMessage> BadActiveWalker::errors

Definition at line 68 of file Parser.h.

Referenced by Parser::parse().


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