From 00569096f95666504c321fca1e2dbcb044d5c7fb Mon Sep 17 00:00:00 2001 From: hannah Date: Tue, 10 Mar 2020 14:50:24 +0100 Subject: [PATCH] added gspn_builder class --- src/gspn/gspn.cpp | 27 ++++++++++++++++++++++++--- src/gspn/gspn.h | 2 ++ tests/gspn/test_gspn.py | 10 +++++++++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/gspn/gspn.cpp b/src/gspn/gspn.cpp index b17ac26..2049d0f 100644 --- a/src/gspn/gspn.cpp +++ b/src/gspn/gspn.cpp @@ -5,14 +5,35 @@ #include "storm/settings/SettingsManager.h" -typedef storm::gspn::GSPN GSPN; +using GSPN = storm::gspn::GSPN; +using GSPNBuilder = storm::gspn::GspnBuilder; void define_gspn(py::module& m) { - // GSPN class py::class_>(m, "GSPN", "Generalized Stochastic Petri Net") .def("name", &GSPN::getName, "Name of GSPN") + // todo getter ; - +//} +// todo ? void define_gspn_builder(py::module& m) { + // GSPN_Builder class + py::class_>(m, "GSPNBuilder", "Generalized Stochastic Petri Net Builder") + .def(py::init(), "Constructor") + .def("set_name", &GSPNBuilder::setGspnName, "Name of GSPN", py::arg("name")) + //.def("add_place", &GSPNBuilder::addPlace, "Add a place to the gspn", py::arg("todo")) + //.def("set_place_layout_info", &GSPNBuilder::setPlaceLayoutInfo, "Layout"py::arg("todo")) + //addImmediateTransition + //addTimedTransition + //addTimedTransition + //setTransitionLayoutInfo + //addInputArc todo overloaded fcts + //addInhibitionArc //todo overloaded fcts + //addOutputArc //todo overloaded fcts + //addNormalArc + .def("build_gspn", &GSPNBuilder::buildGspn, "Construct GSPN", py::arg("exprManager") = nullptr, py::arg("constantsSubstitution") = std::map()) + // todo py::arg(... + // , py::arg("constantsSubstitution") = std::map() + // todo: argument ExpressionManager, map constantsSubstitution (aufrufe auch ohne args) + ; } diff --git a/src/gspn/gspn.h b/src/gspn/gspn.h index 17d58ea..ff36197 100644 --- a/src/gspn/gspn.h +++ b/src/gspn/gspn.h @@ -3,3 +3,5 @@ #include "common.h" void define_gspn(py::module& m); +// todo ? void define_gspn_builder(py::module& m); + diff --git a/tests/gspn/test_gspn.py b/tests/gspn/test_gspn.py index fa368c2..4948f27 100644 --- a/tests/gspn/test_gspn.py +++ b/tests/gspn/test_gspn.py @@ -9,4 +9,12 @@ from configurations import gspn @gspn class TestGSPNBuilder: def test_build_gspn(self): - assert True + # assert True + # builder: ~/storm/src/storm-dft/transformations/DFTToGSPNTransformator.cpp + name = "gspn_test" + builder = stormpy.gspn.GSPNBuilder() + builder.set_name(name) + gspn = builder.build_gspn() + assert gspn.name() == name + +