Browse Source

Use PYBIND11_MODULE instead of PYBIND11_PLUGIN

refactoring
Matthias Volk 7 years ago
parent
commit
4c64f2a0fe
  1. 5
      src/mod_core.cpp
  2. 7
      src/mod_dft.cpp
  3. 10
      src/mod_expressions.cpp
  4. 6
      src/mod_info.cpp
  5. 9
      src/mod_logic.cpp
  6. 5
      src/mod_pars.cpp
  7. 9
      src/mod_storage.cpp
  8. 6
      src/mod_utility.cpp

5
src/mod_core.cpp

@ -6,8 +6,8 @@
#include "core/bisimulation.h" #include "core/bisimulation.h"
#include "core/input.h" #include "core/input.h"
PYBIND11_PLUGIN(core) {
py::module m("core");
PYBIND11_MODULE(core, m) {
m.doc() = "core";
#ifdef STORMPY_DISABLE_SIGNATURE_DOC #ifdef STORMPY_DISABLE_SIGNATURE_DOC
py::options options; py::options options;
@ -24,5 +24,4 @@ PYBIND11_PLUGIN(core) {
define_modelchecking(m); define_modelchecking(m);
define_bisimulation(m); define_bisimulation(m);
define_input(m); define_input(m);
return m.ptr();
} }

7
src/mod_dft.cpp

@ -2,14 +2,13 @@
#include "dft/dft.h" #include "dft/dft.h"
PYBIND11_PLUGIN(dft) {
py::module m("dft", "Functionality for DFT analysis");
PYBIND11_MODULE(dft, m) {
m.doc() = "Functionality for DFT analysis";
#ifdef STORMPY_DISABLE_SIGNATURE_DOC #ifdef STORMPY_DISABLE_SIGNATURE_DOC
py::options options; py::options options;
options.disable_function_signatures(); options.disable_function_signatures();
#endif #endif
define_dft(m); define_dft(m);
return m.ptr();
} }

10
src/mod_expressions.cpp

@ -1,16 +1,16 @@
#include "common.h" #include "common.h"
#include "storm/storage/expressions/ExpressionManager.h" #include "storm/storage/expressions/ExpressionManager.h"
PYBIND11_PLUGIN(expressions) {
py::module m("expressions", "Storm expressions");
PYBIND11_MODULE(expressions, m) {
m.doc() = "Storm expressions";
#ifdef STORMPY_DISABLE_SIGNATURE_DOC #ifdef STORMPY_DISABLE_SIGNATURE_DOC
py::options options; py::options options;
options.disable_function_signatures(); options.disable_function_signatures();
#endif #endif
py::class_<std::shared_ptr<storm::expressions::ExpressionManager>>(m, "ExpressionManager", "Manages variables for expressions"); py::class_<std::shared_ptr<storm::expressions::ExpressionManager>>(m, "ExpressionManager", "Manages variables for expressions");
py::class_<storm::expressions::Expression>(m, "Expression", "Holds an expression") py::class_<storm::expressions::Expression>(m, "Expression", "Holds an expression")
.def("__str__", &storm::expressions::Expression::toString) .def("__str__", &storm::expressions::Expression::toString)
.def_property_readonly("contains_variables", &storm::expressions::Expression::containsVariables) .def_property_readonly("contains_variables", &storm::expressions::Expression::containsVariables)
@ -18,6 +18,4 @@ PYBIND11_PLUGIN(expressions) {
.def_property_readonly("has_integer_type", &storm::expressions::Expression::hasIntegerType) .def_property_readonly("has_integer_type", &storm::expressions::Expression::hasIntegerType)
.def_property_readonly("has_rational_type", &storm::expressions::Expression::hasRationalType) .def_property_readonly("has_rational_type", &storm::expressions::Expression::hasRationalType)
; ;
return m.ptr();
} }

6
src/mod_info.cpp

@ -1,8 +1,9 @@
#include "common.h" #include "common.h"
#include "storm/utility/storm-version.h" #include "storm/utility/storm-version.h"
PYBIND11_PLUGIN(info) {
py::module m("info", "Storm information");
PYBIND11_MODULE(info, m) {
m.doc() = "Storm information";
py::class_<storm::utility::StormVersion>(m, "Version", "Version information for Storm") py::class_<storm::utility::StormVersion>(m, "Version", "Version information for Storm")
// static properties are still called with self as argument (which we ignore), see // static properties are still called with self as argument (which we ignore), see
// https://pybind11.readthedocs.io/en/master/advanced/classes.html#static-properties // https://pybind11.readthedocs.io/en/master/advanced/classes.html#static-properties
@ -10,5 +11,4 @@ PYBIND11_PLUGIN(info) {
.def_property_readonly_static("long", [](py::object /* self */){ return storm::utility::StormVersion::longVersionString(); }, "Storm version in long representation") .def_property_readonly_static("long", [](py::object /* self */){ return storm::utility::StormVersion::longVersionString(); }, "Storm version in long representation")
.def_property_readonly_static("build_info", [](py::object /* self */){ return storm::utility::StormVersion::buildInfo(); }, "Build info for Storm") .def_property_readonly_static("build_info", [](py::object /* self */){ return storm::utility::StormVersion::buildInfo(); }, "Build info for Storm")
; ;
return m.ptr();
} }

9
src/mod_logic.cpp

@ -2,14 +2,13 @@
#include "logic/formulae.h" #include "logic/formulae.h"
PYBIND11_PLUGIN(logic) {
py::module m("logic", "Logic module for Storm");
PYBIND11_MODULE(logic, m) {
m.doc() = "Logic module for Storm";
#ifdef STORMPY_DISABLE_SIGNATURE_DOC #ifdef STORMPY_DISABLE_SIGNATURE_DOC
py::options options; py::options options;
options.disable_function_signatures(); options.disable_function_signatures();
#endif #endif
define_formulae(m); define_formulae(m);
return m.ptr();
} }

5
src/mod_pars.cpp

@ -4,8 +4,8 @@
#include "pars/pla.h" #include "pars/pla.h"
#include "pars/model_instantiator.h" #include "pars/model_instantiator.h"
PYBIND11_PLUGIN(pars) {
py::module m("pars", "Functionality for parametric analysis");
PYBIND11_MODULE(pars, m) {
m.doc() = "Functionality for parametric analysis";
#ifdef STORMPY_DISABLE_SIGNATURE_DOC #ifdef STORMPY_DISABLE_SIGNATURE_DOC
py::options options; py::options options;
@ -15,5 +15,4 @@ PYBIND11_PLUGIN(pars) {
define_pars(m); define_pars(m);
define_pla(m); define_pla(m);
define_model_instantiator(m); define_model_instantiator(m);
return m.ptr();
} }

9
src/mod_storage.cpp

@ -6,18 +6,17 @@
#include "storage/state.h" #include "storage/state.h"
#include "storage/labeling.h" #include "storage/labeling.h"
PYBIND11_PLUGIN(storage) {
py::module m("storage");
PYBIND11_MODULE(storage, m) {
m.doc() = "Data structures in Storm";
#ifdef STORMPY_DISABLE_SIGNATURE_DOC #ifdef STORMPY_DISABLE_SIGNATURE_DOC
py::options options; py::options options;
options.disable_function_signatures(); options.disable_function_signatures();
#endif #endif
define_bitvector(m); define_bitvector(m);
define_model(m); define_model(m);
define_sparse_matrix(m); define_sparse_matrix(m);
define_state(m); define_state(m);
define_labeling(m); define_labeling(m);
return m.ptr();
} }

6
src/mod_utility.cpp

@ -2,8 +2,8 @@
#include "utility/shortestPaths.h" #include "utility/shortestPaths.h"
PYBIND11_PLUGIN(utility) {
py::module m("utility", "Dumping ground of stuff that really should be somewhere more reasonable");
PYBIND11_MODULE(utility, m) {
m.doc() = "Utilities for Storm";
define_ksp(m); define_ksp(m);
return m.ptr();
} }
Loading…
Cancel
Save