www.mooseframework.org
SyntaxTree.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef SYNTAXTREE_H
16 #define SYNTAXTREE_H
17 
19 
20 #include <string>
21 #include <map>
22 
23 // Forward declarations
24 class InputParameters;
25 class SyntaxTree;
26 
28 {
29 public:
30  SyntaxTree(bool use_long_names = false);
31  virtual ~SyntaxTree();
32 
33  void insertNode(std::string syntax,
34  const std::string & action,
35  bool is_action_params = true,
36  InputParameters * params = NULL);
37 
38  std::string print(const std::string & search_string);
39 
40  void seenIt(const std::string & prefix, const std::string & item);
41  bool haveSeenIt(const std::string & prefix, const std::string & item) const;
42 
43 protected:
47  class TreeNode
48  {
49  public:
50  TreeNode(const std::string & name,
51  SyntaxTree & syntax_tree,
52  const std::string * action = NULL,
53  InputParameters * params = NULL,
54  TreeNode * parent = NULL);
55  ~TreeNode();
56 
57  void insertNode(std::string & syntax,
58  const std::string & action,
59  bool is_action_params = true,
60  InputParameters * params = NULL);
61  std::string print(short depth, const std::string & search_string, bool & found);
62 
63  std::string getLongName(const std::string & delim = "/") const;
64 
65  protected:
66  void insertParams(const std::string & action,
67  bool is_action_params,
68  InputParameters * params = NULL);
69 
70  std::map<std::string, TreeNode *> _children;
71  std::multimap<std::string, InputParameters *> _action_params;
72  std::multimap<std::string, InputParameters *> _moose_object_params;
73  std::string _name;
76  };
77 
78  bool isLongNames() const;
79 
82 
83 private:
84  std::set<std::string> _params_printed;
85 };
86 
87 #endif // SYNTAXTREE_H
TreeNode * _parent
Definition: SyntaxTree.h:74
This interface is for classes that want to be called to format InputFileParameters.
void insertNode(std::string &syntax, const std::string &action, bool is_action_params=true, InputParameters *params=NULL)
Definition: SyntaxTree.C:97
std::map< std::string, TreeNode * > _children
Definition: SyntaxTree.h:70
void insertParams(const std::string &action, bool is_action_params, InputParameters *params=NULL)
Definition: SyntaxTree.C:130
TreeNode * _root
Definition: SyntaxTree.h:80
std::set< std::string > _params_printed
Definition: SyntaxTree.h:84
SyntaxTree(bool use_long_names=false)
Definition: SyntaxTree.C:24
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
TreeNode(const std::string &name, SyntaxTree &syntax_tree, const std::string *action=NULL, InputParameters *params=NULL, TreeNode *parent=NULL)
Definition: SyntaxTree.C:73
std::string _name
Definition: SyntaxTree.h:73
SyntaxTree & _syntax_tree
Definition: SyntaxTree.h:75
virtual ~SyntaxTree()
Definition: SyntaxTree.C:29
std::multimap< std::string, InputParameters * > _moose_object_params
Definition: SyntaxTree.h:72
bool isLongNames() const
Definition: SyntaxTree.C:241
std::multimap< std::string, InputParameters * > _action_params
Definition: SyntaxTree.h:71
bool _use_long_names
Definition: SyntaxTree.h:81
void insertNode(std::string syntax, const std::string &action, bool is_action_params=true, InputParameters *params=NULL)
Definition: SyntaxTree.C:32
std::string print(const std::string &search_string)
Definition: SyntaxTree.C:44
std::string print(short depth, const std::string &search_string, bool &found)
Definition: SyntaxTree.C:141
std::string getLongName(const std::string &delim="/") const
Definition: SyntaxTree.C:232
bool haveSeenIt(const std::string &prefix, const std::string &item) const
Definition: SyntaxTree.C:68
This class represents a single node in our tree.
Definition: SyntaxTree.h:47
void seenIt(const std::string &prefix, const std::string &item)
Definition: SyntaxTree.C:62