UDQDefine.hpp
Go to the documentation of this file.
1/*
2 Copyright 2018 Statoil ASA.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20
21#ifndef UDQ_DEFINE_HPP
22#define UDQ_DEFINE_HPP
23
24#include <string>
25#include <vector>
26#include <set>
27
32
33namespace Opm {
34
35class UDQASTNode;
36class ParseContext;
37class ErrorGuard;
38
40public:
42
43 UDQDefine(const UDQParams& udq_params,
44 const std::string& keyword,
45 const std::vector<std::string>& deck_data);
46
47 UDQDefine(const UDQParams& udq_params,
48 const std::string& keyword,
49 const std::vector<std::string>& deck_data,
50 const ParseContext& parseContext,
51 ErrorGuard& errors);
52
53 template <typename T>
54 UDQDefine(const UDQParams& udq_params,
55 const std::string& keyword,
56 const std::vector<std::string>& deck_data,
57 const ParseContext& parseContext,
58 T&& errors);
59
61 std::shared_ptr<UDQASTNode> astPtr,
62 UDQVarType type,
63 const std::string& string_data);
64
66
67 UDQSet eval(const UDQContext& context) const;
68 const std::string& keyword() const;
69 const std::string& input_string() const;
71 std::set<UDQTokenType> func_tokens() const;
72
73 bool operator==(const UDQDefine& data) const;
74
75 template<class Serializer>
76 void serializeOp(Serializer& serializer)
77 {
78 serializer(m_keyword);
79 serializer(ast);
80 serializer(m_var_type);
81 serializer(string_data);
82 }
83
84private:
85 std::string m_keyword;
86 std::shared_ptr<UDQASTNode> ast;
87 UDQVarType m_var_type;
88 std::string string_data;
89};
90}
91
92
93
94#endif
const char *const string
Definition: cJSON.h:170
Definition: ErrorGuard.hpp:29
Definition: ParseContext.hpp:84
Definition: Serializer.hpp:38
Definition: UDQContext.hpp:35
Definition: UDQDefine.hpp:39
UDQDefine(const UDQParams &udq_params, const std::string &keyword, const std::vector< std::string > &deck_data)
UDQDefine(const UDQParams &udq_params, const std::string &keyword, const std::vector< std::string > &deck_data, const ParseContext &parseContext, ErrorGuard &errors)
const std::string & input_string() const
bool operator==(const UDQDefine &data) const
static UDQDefine serializeObject()
const std::string & keyword() const
UDQSet eval(const UDQContext &context) const
UDQDefine(const UDQParams &udq_params, const std::string &keyword, const std::vector< std::string > &deck_data, const ParseContext &parseContext, T &&errors)
UDQDefine(const std::string &keyword, std::shared_ptr< UDQASTNode > astPtr, UDQVarType type, const std::string &string_data)
void serializeOp(Serializer &serializer)
Definition: UDQDefine.hpp:76
UDQVarType var_type() const
std::set< UDQTokenType > func_tokens() const
Definition: UDQParams.hpp:31
Definition: UDQSet.hpp:60
Definition: A.hpp:4
UDQVarType
Definition: UDQEnums.hpp:59
static std::string data()
Definition: exprtk.hpp:40022