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

Public Member Functions

 DupParamWalker (std::string fname)
 
void walk (const std::string &fullpath, const std::string &, hit::Node *n) override
 

Public Attributes

std::vector< std::string > errors
 

Private Attributes

std::string _fname
 
std::set< std::string > _duplicates
 
std::map< std::string, hit::Node * > _have
 

Detailed Description

Definition at line 104 of file Parser.C.

Constructor & Destructor Documentation

◆ DupParamWalker()

DupParamWalker::DupParamWalker ( std::string  fname)
inline

Definition at line 107 of file Parser.C.

107 : _fname(fname) {}
std::string _fname
Definition: Parser.C:129

Member Function Documentation

◆ walk()

void DupParamWalker::walk ( const std::string &  fullpath,
const std::string &  ,
hit::Node *  n 
)
inlineoverride

Definition at line 108 of file Parser.C.

109  {
110  std::string prefix = n->type() == hit::NodeType::Field ? "parameter" : "section";
111 
112  if (_have.count(fullpath) > 0)
113  {
114  auto existing = _have[fullpath];
115  if (_duplicates.count(fullpath) == 0)
116  {
117  errors.push_back(
118  errormsg(_fname, existing, prefix, " '", fullpath, "' supplied multiple times"));
119  _duplicates.insert(fullpath);
120  }
121  errors.push_back(errormsg(_fname, n, prefix, " '", fullpath, "' supplied multiple times"));
122  }
123  _have[n->fullpath()] = n;
124  }
std::set< std::string > _duplicates
Definition: Parser.C:130
std::string _fname
Definition: Parser.C:129
std::map< std::string, hit::Node * > _have
Definition: Parser.C:131
PetscInt n
std::string errormsg(std::string, hit::Node *)
Definition: Parser.h:34
std::vector< std::string > errors
Definition: Parser.C:126

Member Data Documentation

◆ _duplicates

std::set<std::string> DupParamWalker::_duplicates
private

Definition at line 130 of file Parser.C.

Referenced by walk().

◆ _fname

std::string DupParamWalker::_fname
private

Definition at line 129 of file Parser.C.

Referenced by walk().

◆ _have

std::map<std::string, hit::Node *> DupParamWalker::_have
private

Definition at line 131 of file Parser.C.

Referenced by walk().

◆ errors

std::vector<std::string> DupParamWalker::errors

Definition at line 126 of file Parser.C.

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


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