Actions.hpp
Go to the documentation of this file.
1/*
2 Copyright 2018 Equinor 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 ActionCOnfig_HPP
22#define ActionCOnfig_HPP
23
24#include <string>
25#include <ctime>
26#include <vector>
27
30
31namespace Opm {
32namespace Action {
33
34/*
35 The Actions class is a container of ACTIONX keywords. The main functionality
36 is to provide a list of ACTIONX keywords which are ready to be evaluated.
37*/
38
39class Actions {
40public:
41 Actions() = default;
42 Actions(const std::vector<ActionX>& action, const std::vector<PyAction>& pyactions);
43
45
46 size_t size() const;
47 int max_input_lines() const;
48 bool empty() const;
49 void add(const ActionX& action);
50 void add(const PyAction& pyaction);
51 bool ready(std::time_t sim_time) const;
52 const ActionX& get(const std::string& name) const;
53 const ActionX& get(std::size_t index) const;
54 std::vector<const ActionX *> pending(std::time_t sim_time) const;
55 std::vector<const PyAction *> pending_python() const;
56
57 std::vector<ActionX>::const_iterator begin() const;
58 std::vector<ActionX>::const_iterator end() const;
59
60 bool operator==(const Actions& data) const;
61
62 template<class Serializer>
63 void serializeOp(Serializer& serializer)
64 {
65 serializer.vector(actions);
66 serializer.vector(pyactions);
67 }
68
69private:
70 std::vector<ActionX> actions;
71 std::vector<PyAction> pyactions;
72};
73}
74}
75#endif
const char *const name
Definition: cJSON.h:258
int index
Definition: cJSON.h:168
const char *const string
Definition: cJSON.h:170
Definition: ActionX.hpp:64
Definition: Actions.hpp:39
void add(const PyAction &pyaction)
std::vector< const ActionX * > pending(std::time_t sim_time) const
void serializeOp(Serializer &serializer)
Definition: Actions.hpp:63
std::vector< ActionX >::const_iterator end() const
bool operator==(const Actions &data) const
std::vector< ActionX >::const_iterator begin() const
void add(const ActionX &action)
bool ready(std::time_t sim_time) const
static Actions serializeObject()
const ActionX & get(std::size_t index) const
const ActionX & get(const std::string &name) const
int max_input_lines() const
size_t size() const
Actions(const std::vector< ActionX > &action, const std::vector< PyAction > &pyactions)
std::vector< const PyAction * > pending_python() const
bool empty() const
Definition: PyAction.hpp:39
Definition: Serializer.hpp:38
Action
Definition: InputErrorAction.hpp:36
Definition: A.hpp:4
static std::string data()
Definition: exprtk.hpp:40022