20 #ifndef ACTION_STATE_HPP 21 #define ACTION_STATE_HPP 64 bool hasWell(
const std::string& well)
const;
82 template <
class Serializer>
85 serializer(this->wells_);
92 std::vector<std::string> wells_{};
103 void add_run(
const ActionX& action, std::time_t sim_time,
const Result&
result);
117 std::size_t
run_count(
const ActionX& action)
const;
127 std::time_t
run_time(
const ActionX& action)
const;
136 const MatchSet*
result(
const std::string& action)
const;
143 std::optional<bool>
python_result(
const std::string& action)
const;
151 void load_rst(
const Actions& action_config,
159 template<
class Serializer>
162 serializer(this->run_state);
163 serializer(this->last_result);
164 serializer(this->m_python_result);
183 RunState() =
default;
188 explicit RunState(
const std::time_t sim_time)
196 void add_run(
const std::time_t sim_time)
198 this->last_run = sim_time;
208 rs.last_run = 123456;
221 return (this->
run_count == other.run_count)
222 && (this->last_run == other.last_run);
230 template <
class Serializer>
234 serializer(this->last_run);
241 std::time_t last_run{};
248 using ActionID = std::pair<std::string, std::size_t>;
252 std::map<ActionID, RunState> run_state{};
256 std::map<std::string, MatchSet> last_result{};
259 std::map<std::string, bool> m_python_result{};
264 #endif // ACTION_STATE_HPP
std::size_t run_count(const ActionX &action) const
Retrieve number of times an action has run.
Definition: State.cpp:74
Definition: Python.hpp:35
bool operator==(const State &other) const
Equality predicate.
Definition: State.cpp:160
Matching entities from a successfully triggered ActionX object.
Definition: State.hpp:54
void add_run(const ActionX &action, std::time_t sim_time, const Result &result)
Record ActionX Run.
Definition: State.cpp:94
static MatchSet serializationTestObject()
Create a serialisation test object.
Definition: State.cpp:56
Management information about the current run's ACTION system, especially concerning the number of tim...
Definition: State.hpp:50
std::optional< bool > python_result(const std::string &action) const
Query for the result of running a PyAction.
Definition: State.cpp:133
bool hasWell(const std::string &well) const
Whether or not a particular well exists in the set of matching entities.
Definition: State.cpp:49
bool operator==(const MatchSet &that) const
Equality predicate.
Definition: State.cpp:67
std::time_t run_time(const ActionX &action) const
Retrieve timestamp of the last time an action ran.
Definition: State.cpp:82
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition: State.hpp:83
static State serializationTestObject()
Create a serialisation test object.
Definition: State.cpp:168
void load_rst(const Actions &action_config, const RestartIO::RstState &rst_state)
Load action state from restart file.
Definition: State.cpp:146
Definition: Aquancon.hpp:40
Class for (de-)serializing.
Definition: Serializer.hpp:94
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition: State.hpp:160
const MatchSet * result(const std::string &action) const
Retrieve set of matching entities from the last time an action ran.
Definition: State.cpp:124