My Project
ASTNode.hpp
1 #ifndef ASTNODE_HPP
2 #define ASTNODE_HPP
3 
4 #include <unordered_set>
5 
6 #include <opm/parser/eclipse/EclipseState/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  std::string func;
32  void required_summary(std::unordered_set<std::string>& required_summary) const;
33 
34  bool operator==(const ASTNode& data) const;
35 
36  template<class Serializer>
37  void serializeOp(Serializer& serializer)
38  {
39  serializer(type);
40  serializer(func_type);
41  serializer(func);
42  serializer(arg_list);
43  serializer(number);
44  serializer.vector(children);
45  }
46 
47 private:
48  std::vector<std::string> arg_list;
49  double number = 0.0;
50 
51  /*
52  To have a member std::vector<ASTNode> inside the ASTNode class is
53  supposedly borderline undefined behaviour; it compiles without warnings
54  and works. Good for enough for me.
55  */
56  std::vector<ASTNode> children;
57 };
58 }
59 }
60 #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