Make SummaryState::set() available as __setitem__ in Python
This commit is contained in:
@@ -75,8 +75,10 @@ public:
|
||||
explicit SummaryState(std::time_t sim_start_arg);
|
||||
|
||||
/*
|
||||
The set() function has to be retained temporarily to support updating of
|
||||
cumulatives from restart files.
|
||||
The canonical way to update the SummaryState is through the update_xxx()
|
||||
methods which will inspect the variable and either accumulate or just
|
||||
assign, depending on whether it represents a total or not. The set()
|
||||
method is low level and unconditionally do an assignment.
|
||||
*/
|
||||
void set(const std::string& key, double value);
|
||||
|
||||
|
||||
@@ -55,5 +55,6 @@ void python::common::export_SummaryState(py::module& module) {
|
||||
.def("__contains__", &SummaryState::has)
|
||||
.def("has_well_var", py::overload_cast<const std::string&, const std::string&>(&SummaryState::has_well_var, py::const_))
|
||||
.def("has_group_var", py::overload_cast<const std::string&, const std::string&>(&SummaryState::has_group_var, py::const_))
|
||||
.def("__setitem__", &SummaryState::set)
|
||||
.def("__getitem__", py::overload_cast<const std::string&>(&SummaryState::get, py::const_));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user