Loading...
Searching...
No Matches
ActionAST.hpp
/*
Copyright 2018 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ActionAST_HPP
#define ActionAST_HPP
#include <opm/input/eclipse/Schedule/Action/ActionResult.hpp>
#include <memory>
#include <string>
#include <unordered_set>
#include <vector>
namespace Opm::Action {
class Context;
class ASTNode;
} // namespace Opm::Action
namespace Opm::Action {
class AST
{
public:
AST();
explicit AST(const std::vector<std::string>& tokens);
~AST();
AST(const AST& rhs);
AST(AST&& rhs);
AST& operator=(const AST& rhs);
AST& operator=(AST&& rhs);
static AST serializationTestObject();
Result eval(const Context& context) const;
bool operator==(const AST& data) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(condition);
}
void required_summary(std::unordered_set<std::string>& required_summary) const;
private:
std::unique_ptr<ASTNode> condition{};
};
} // namespace Opm::Action
#endif // ActionAST_HPP
Opm::Action::AST::AST
AST()
Default constructor.
Opm::Action::AST::serializationTestObject
static AST serializationTestObject()
Create a serialisation test object.
Definition ActionAST.cpp:76
Opm::Action::AST::operator==
bool operator==(const AST &data) const
Equality predicate.
Definition ActionAST.cpp:94
Opm::Action::AST::eval
Result eval(const Context &context) const
Evaluate the expression tree at current dynamic state.
Definition ActionAST.cpp:85
Opm::Action::AST::operator=
AST & operator=(const AST &rhs)
Assignment operator.
Definition ActionAST.cpp:52
Opm::Action::AST::serializeOp
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition ActionAST.hpp:119
Opm::Action::AST::required_summary
void required_summary(std::unordered_set< std::string > &required_summary) const
Export all summary vectors needed to evaluate the expression tree.
Definition ActionAST.cpp:102
Opm::Action::AST::~AST
~AST()
Destructor.
Opm::Action::Context
Manager of summary vector values.
Definition ActionContext.hpp:42
Opm::Action::Result
Class Action::Result holds the boolean result of a ACTIONX condition like.
Definition ActionResult.hpp:69
Opm::Serializer
Class for (de-)serializing.
Definition Serializer.hpp:94