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

357{
358 auto actives = section->find("active");
359 auto inactives = section->find("inactive");
360
361 if (actives && inactives && actives->type() == hit::NodeType::Field &&
362 inactives->type() == hit::NodeType::Field && actives->parent() == inactives->parent())
363 {
364 errors.emplace_back(
365 "'active' and 'inactive' parameters both provided in section '" + fullpath + "'", section);
366 return;
367 }
368
369 // ensures we don't recheck deeper nesting levels
370 if (actives && actives->type() == hit::NodeType::Field && actives->parent() == section)
371 {
372 auto vars = section->param<std::vector<std::string>>("active");
373 std::string msg = "";
374 for (auto & var : vars)
375 {
376 if (!section->find(var))
377 msg += var + ", ";
378 }
379 if (msg.size() > 0)
380 {
381 msg = msg.substr(0, msg.size() - 2);
382 errors.emplace_back("variables listed as active (" + msg + ") in section '" +
383 section->fullpath() + "' not found in input",
384 section);
385 }
386 }
387 // ensures we don't recheck deeper nesting levels
388 if (inactives && inactives->type() == hit::NodeType::Field && inactives->parent() == section)
389 {
390 auto vars = section->param<std::vector<std::string>>("inactive");
391 std::string msg = "";
392 for (auto & var : vars)
393 {
394 if (!section->find(var))
395 msg += var + ", ";
396 }
397 if (msg.size() > 0)
398 {
399 msg = msg.substr(0, msg.size() - 2);
400 errors.emplace_back("variables listed as inactive (" + msg + ") in section '" +
401 section->fullpath() + "' not found in input",
402 section);
403 }
404 }
405}
char ** vars
std::vector< hit::ErrorMessage > errors
Definition Parser.h:75

Referenced by Parser::parse().

Member Data Documentation

◆ errors

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

Definition at line 75 of file Parser.h.

Referenced by Parser::parse().


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