https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SyntaxTree.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
13
14#include <map>
15#include <memory>
16#include <set>
17#include <string>
18
19// Forward declarations
20class InputParameters;
21class SyntaxTree;
22
24{
25public:
26 SyntaxTree(bool use_long_names = false);
27 virtual ~SyntaxTree();
28
29 void insertNode(std::string syntax,
30 const std::string & action,
31 bool is_action_params = true,
32 InputParameters * params = NULL);
33
34 std::string print(const std::string & search_string);
35
36 void seenIt(const std::string & prefix, const std::string & item);
37 bool haveSeenIt(const std::string & prefix, const std::string & item) const;
38
39protected:
44 {
45 public:
46 TreeNode(const std::string & name,
47 SyntaxTree & syntax_tree,
48 const std::string * action = NULL,
49 InputParameters * params = NULL,
50 TreeNode * parent = NULL);
52
53 void insertNode(std::string & syntax,
54 const std::string & action,
55 bool is_action_params = true,
56 InputParameters * params = NULL);
57 std::string print(short depth, const std::string & search_string, bool & found);
58
59 std::string getLongName(const std::string & delim = "/") const;
60
61 protected:
62 void insertParams(const std::string & action,
63 bool is_action_params,
64 InputParameters * params = NULL);
65
66 std::map<std::string, std::unique_ptr<TreeNode>> _children;
67 std::multimap<std::string, std::unique_ptr<InputParameters>> _action_params;
68 std::multimap<std::string, std::unique_ptr<InputParameters>> _moose_object_params;
69 std::string _name;
72 };
73
74 bool isLongNames() const;
75
76 std::unique_ptr<TreeNode> _root;
78
79private:
80 std::set<std::string> _params_printed;
81};
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
This interface is for classes that want to be called to format InputParameters.
This class represents a single node in our tree.
Definition SyntaxTree.h:44
std::string print(short depth, const std::string &search_string, bool &found)
Definition SyntaxTree.C:126
std::string getLongName(const std::string &delim="/") const
Definition SyntaxTree.C:218
void insertNode(std::string &syntax, const std::string &action, bool is_action_params=true, InputParameters *params=NULL)
Definition SyntaxTree.C:82
std::multimap< std::string, std::unique_ptr< InputParameters > > _moose_object_params
Definition SyntaxTree.h:68
std::string _name
Definition SyntaxTree.h:69
std::multimap< std::string, std::unique_ptr< InputParameters > > _action_params
Definition SyntaxTree.h:67
SyntaxTree & _syntax_tree
Definition SyntaxTree.h:71
std::map< std::string, std::unique_ptr< TreeNode > > _children
Definition SyntaxTree.h:66
void insertParams(const std::string &action, bool is_action_params, InputParameters *params=NULL)
Definition SyntaxTree.C:115
std::set< std::string > _params_printed
Definition SyntaxTree.h:80
bool isLongNames() const
Definition SyntaxTree.C:227
std::unique_ptr< TreeNode > _root
Definition SyntaxTree.h:76
virtual ~SyntaxTree()
void insertNode(std::string syntax, const std::string &action, bool is_action_params=true, InputParameters *params=NULL)
Definition SyntaxTree.C:27
void seenIt(const std::string &prefix, const std::string &item)
Definition SyntaxTree.C:57
bool _use_long_names
Definition SyntaxTree.h:77
std::string print(const std::string &search_string)
Definition SyntaxTree.C:39
bool haveSeenIt(const std::string &prefix, const std::string &item) const
Definition SyntaxTree.C:63