From 12bcd673007225d2e09c36bba7ab72d752a88752 Mon Sep 17 00:00:00 2001 From: Thomas Knoll Date: Fri, 4 Aug 2023 15:05:43 +0200 Subject: [PATCH] added suffix for shield template classes --- src/mod_shields.cpp | 16 ++++++++-------- src/shields/abstract_shield.cpp | 10 ++++++---- src/shields/abstract_shield.h | 2 +- src/shields/optimal_shield.cpp | 10 ++++++---- src/shields/optimal_shield.h | 2 +- src/shields/post_shield.cpp | 10 ++++++---- src/shields/post_shield.h | 2 +- src/shields/pre_shield.cpp | 12 ++++++++---- src/shields/pre_shield.h | 2 +- 9 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/mod_shields.cpp b/src/mod_shields.cpp index ed1a806..0cab87c 100644 --- a/src/mod_shields.cpp +++ b/src/mod_shields.cpp @@ -22,12 +22,12 @@ PYBIND11_MODULE(shields, m) { define_pet(m); define_add(m); - define_abstract_shield::index_type>(m); - define_abstract_shield::index_type>(m); - define_pre_shield::index_type>(m); - define_pre_shield::index_type>(m); - define_post_shield::index_type>(m); - define_post_shield::index_type>(m); - define_optimal_shield::index_type>(m); - define_optimal_shield::index_type>(m); + define_abstract_shield::index_type>(m, "Double"); + define_abstract_shield::index_type>(m, "Exact"); + define_pre_shield::index_type>(m, "Double"); + define_pre_shield::index_type>(m, "Exact"); + define_post_shield::index_type>(m, "Double"); + define_post_shield::index_type>(m, "Exact"); + define_optimal_shield::index_type>(m, "Double"); + define_optimal_shield::index_type>(m, "Exact"); } diff --git a/src/shields/abstract_shield.cpp b/src/shields/abstract_shield.cpp index d29475c..d73da84 100644 --- a/src/shields/abstract_shield.cpp +++ b/src/shields/abstract_shield.cpp @@ -7,14 +7,16 @@ #include "storm/storage/Distribution.h" template -void define_abstract_shield(py::module& m) { +void define_abstract_shield(py::module& m, std::string vt_suffix) { using AbstractShield = tempest::shields::AbstractShield; - py::class_(m, "AbstractShield") + std::string shieldClassName = std::string("AbstractShield") + vt_suffix; + + py::class_(m, shieldClassName.c_str()) .def("compute_row_group_size", &AbstractShield::computeRowGroupSizes) .def("get_class_name", &AbstractShield::getClassName) .def("get_optimization_direction", &AbstractShield::getOptimizationDirection) ; } -template void define_abstract_shield::index_type>(py::module& m); -template void define_abstract_shield::index_type>(py::module& m); \ No newline at end of file +template void define_abstract_shield::index_type>(py::module& m, std::string vt_suffix); +template void define_abstract_shield::index_type>(py::module& m, std::string vt_suffix); \ No newline at end of file diff --git a/src/shields/abstract_shield.h b/src/shields/abstract_shield.h index c355886..e9b63ec 100644 --- a/src/shields/abstract_shield.h +++ b/src/shields/abstract_shield.h @@ -3,4 +3,4 @@ #include "common.h" template -void define_abstract_shield(py::module& m); \ No newline at end of file +void define_abstract_shield(py::module& m, std::string vt_suffix); \ No newline at end of file diff --git a/src/shields/optimal_shield.cpp b/src/shields/optimal_shield.cpp index 6b5ef26..3c0a41a 100644 --- a/src/shields/optimal_shield.cpp +++ b/src/shields/optimal_shield.cpp @@ -4,13 +4,15 @@ #include "storm/shields/OptimalShield.h" template -void define_optimal_shield(py::module& m) { +void define_optimal_shield(py::module& m, std::string vt_suffix) { using OptimalShield = tempest::shields::OptimalShield; using AbstractShield = tempest::shields::AbstractShield; - py::class_(m, "OptimalShield") + std::string shieldClassName = std::string("OptimalShield") + vt_suffix; + + py::class_(m, shieldClassName.c_str()) ; } -template void define_optimal_shield::index_type>(py::module& m); -template void define_optimal_shield::index_type>(py::module& m); \ No newline at end of file +template void define_optimal_shield::index_type>(py::module& m, std::string vt_suffix); +template void define_optimal_shield::index_type>(py::module& m, std::string vt_suffix); \ No newline at end of file diff --git a/src/shields/optimal_shield.h b/src/shields/optimal_shield.h index fd35e21..93a1eb5 100644 --- a/src/shields/optimal_shield.h +++ b/src/shields/optimal_shield.h @@ -3,4 +3,4 @@ #include "common.h" template -void define_optimal_shield(py::module& m); +void define_optimal_shield(py::module& m, std::string vt_suffix); diff --git a/src/shields/post_shield.cpp b/src/shields/post_shield.cpp index 87d449a..862e1d8 100644 --- a/src/shields/post_shield.cpp +++ b/src/shields/post_shield.cpp @@ -4,14 +4,16 @@ #include "storm/shields/PostShield.h" template -void define_post_shield(py::module& m) { +void define_post_shield(py::module& m, std::string vt_suffix) { using PostShield = tempest::shields::PostShield; using AbstractShield = tempest::shields::AbstractShield; + + std::string shieldClassName = std::string("PostShield") + vt_suffix; - py::class_(m, "PostShield") + py::class_(m, shieldClassName.c_str()) ; } -template void define_post_shield::index_type>(py::module& m); -template void define_post_shield::index_type>(py::module& m); \ No newline at end of file +template void define_post_shield::index_type>(py::module& m, std::string vt_suffix); +template void define_post_shield::index_type>(py::module& m, std::string vt_suffix); \ No newline at end of file diff --git a/src/shields/post_shield.h b/src/shields/post_shield.h index 24421d8..e48cbe8 100644 --- a/src/shields/post_shield.h +++ b/src/shields/post_shield.h @@ -3,4 +3,4 @@ #include "common.h" template -void define_post_shield(py::module& m); \ No newline at end of file +void define_post_shield(py::module& m, std::string vt_suffix); \ No newline at end of file diff --git a/src/shields/pre_shield.cpp b/src/shields/pre_shield.cpp index da36556..dd42de9 100644 --- a/src/shields/pre_shield.cpp +++ b/src/shields/pre_shield.cpp @@ -11,12 +11,16 @@ template -void define_pre_shield(py::module& m) { +void define_pre_shield(py::module& m, std::string vt_suffix) { using PreShield = tempest::shields::PreShield; using AbstractShield = tempest::shields::AbstractShield; - py::class_(m, "PreShield") + + std::string shieldClassName = std::string("PreShield") + vt_suffix; + + + py::class_(m, shieldClassName.c_str()) ; } -template void define_pre_shield::index_type>(py::module& m); -template void define_pre_shield::index_type>(py::module& m); \ No newline at end of file +template void define_pre_shield::index_type>(py::module& m, std::string vt_suffix); +template void define_pre_shield::index_type>(py::module& m, std::string vt_suffix); \ No newline at end of file diff --git a/src/shields/pre_shield.h b/src/shields/pre_shield.h index 000d85d..c7aca7f 100644 --- a/src/shields/pre_shield.h +++ b/src/shields/pre_shield.h @@ -3,4 +3,4 @@ #include "common.h" template -void define_pre_shield(py::module& m); \ No newline at end of file +void define_pre_shield(py::module& m, std::string vt_suffix); \ No newline at end of file