ppap4lmp  0.7.2
py_updater.h
Go to the documentation of this file.
1 
8 #ifndef PYBIND_UPDATER_H
9 #define PYBIND_UPDATER_H
10 
11 #include <alias/pybind.h>
12 #include <core/updater.h>
13 
21 template <class UPD = Updater>
22 class PyUpdater : public UPD {
23  protected:
24  void compute_body(
25  const ElPtr &elem,
26  Json &data) override
27  {
28  PYBIND11_OVERLOAD_PURE(
29  void, UPD, compute_body, elem, data);
30  }
31  void compute_common(
32  const ElPtr &elem,
33  Json &data) override
34  {
35  PYBIND11_OVERLOAD(
36  void, UPD, compute_common, elem, data);
37  }
38  void compute_impl(
39  Json &data,
40  JsonToVoidFunc check_required_keys,
41  JsonToBoolFunc check_optional_keys) override
42  {
43  PYBIND11_OVERLOAD_PURE(
44  void, UPD, compute_impl, data, check_required_keys, check_optional_keys);
45  }
46  public:
47  using UPD::UPD;
48 };
49 
51 namespace pybind
52 {
61  void py_updater(py::module &m);
62 }
63 
64 #endif
ShPtr< Element > ElPtr
An alias for a shared pointer of Element class.
Definition: element.h:378
Namespace for functions to bind C++ classes to Python.
std::function< bool(const Json &)> JsonToBoolFunc
An alias for a function accepts a Json object and returns a bool.
Definition: updater.h:20
nlohmann::json Json
Json is an alias for nlohmann::json.
Definition: json.h:22
Trampoline class to bind Updater class and its subclasses to Python.
Definition: py_updater.h:22
void py_updater(py::module &m)
Bind Updater class to Python.
Definition: py_updater.cpp:10
std::function< void(const Json &)> JsonToVoidFunc
An alias for a function accepts a Json object.
Definition: updater.h:18
This file has a definition of Updater class, which is one of the cores of this program.
This file includes pybind11 and defines an alias for the namespace pybind11.