My Project
ASTNode.hpp
1 #ifndef ASTNODE_HPP
2 #define ASTNODE_HPP
3 
4 #include <unordered_set>
5 
6 #include <opm/input/eclipse/Schedule/Action/ActionContext.hpp>
7 
8 #include "ActionValue.hpp"
9 
10 namespace Opm {
11 namespace Action {
12 
13 class ActionContext;
14 class WellSet;
15 class ASTNode {
16 public:
17 
18  ASTNode();
19  ASTNode(TokenType type_arg);
20  ASTNode(double value);
21  ASTNode(TokenType type_arg, FuncType func_type_arg, const std::string& func_arg, const std::vector<std::string>& arg_list_arg);
22 
23  static ASTNode serializeObject();
24 
25  Action::Result eval(const Action::Context& context) const;
26  Action::Value value(const Action::Context& context) const;
27  TokenType type;
28  FuncType func_type;
29  void add_child(const ASTNode& child);
30  size_t size() const;
31  bool empty() const;
32 
33  std::string func;
34  void required_summary(std::unordered_set<std::string>& required_summary) const;
35 
36  bool operator==(const ASTNode& data) const;
37 
38  template<class Serializer>
39  void serializeOp(Serializer& serializer)
40  {
41  serializer(type);
42  serializer(func_type);
43  serializer(func);
44  serializer(arg_list);
45  serializer(number);
46  serializer.vector(children);
47  }
48 
49 private:
50  std::vector<std::string> arg_list;
51  double number = 0.0;
52 
53  /*
54  To have a member std::vector<ASTNode> inside the ASTNode class is
55  supposedly borderline undefined behaviour; it compiles without warnings
56  and works. Good for enough for me.
57  */
58  std::vector<ASTNode> children;
59 };
60 }
61 }
62 #endif
Definition: ASTNode.hpp:15
Definition: ActionContext.hpp:39
Definition: ActionResult.hpp:99
Definition: ActionValue.hpp:43
Definition: Serializer.hpp:38
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29