From 77598a8774679fe3de8f6a71e7dd9a6c4fbc0be4 Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Mon, 6 Feb 2017 15:08:18 +0100 Subject: [PATCH] gspn extension --- src/storm-gspn/storage/gspn/GSPN.cpp | 13 +++++++++---- src/storm-gspn/storage/gspn/GSPN.h | 17 ++++++++++++++--- src/storm-gspn/storage/gspn/GspnBuilder.cpp | 3 +++ src/storm-gspn/storm-gspn.h | 3 +-- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/storm-gspn/storage/gspn/GSPN.cpp b/src/storm-gspn/storage/gspn/GSPN.cpp index ce0d47d44..34967daee 100644 --- a/src/storm-gspn/storage/gspn/GSPN.cpp +++ b/src/storm-gspn/storage/gspn/GSPN.cpp @@ -27,8 +27,8 @@ namespace storm { return tId; } - GSPN::GSPN(std::string const& name, std::vector const& places, std::vector> const& itransitions, std::vector> const& ttransitions, std::vector const& partitions) - : name(name), places(places), immediateTransitions(itransitions), timedTransitions(ttransitions), partitions(partitions) + GSPN::GSPN(std::string const& name, std::vector const& places, std::vector> const& itransitions, std::vector> const& ttransitions, std::vector const& partitions, std::shared_ptr const& exprManager) + : name(name), places(places), immediateTransitions(itransitions), timedTransitions(ttransitions), partitions(partitions), exprManager(exprManager); { } @@ -134,8 +134,13 @@ namespace storm { return getImmediateTransition(id); } - - void GSPN::setCapacities(std::unordered_map const& mapping) { + + + std::shared_ptr const& GSPN::getExpressionManager() { + return exprManager; + } + + void GSPN::setCapacities(std::unordered_map const& mapping) { for(auto const& entry : mapping) { storm::gspn::Place* place = getPlace(entry.first); STORM_LOG_THROW(place != nullptr, storm::exceptions::InvalidArgumentException, "No place with name " << entry.first); diff --git a/src/storm-gspn/storage/gspn/GSPN.h b/src/storm-gspn/storage/gspn/GSPN.h index 947769af3..19101ffe4 100644 --- a/src/storm-gspn/storage/gspn/GSPN.h +++ b/src/storm-gspn/storage/gspn/GSPN.h @@ -6,6 +6,8 @@ #include #include +#include "storm/storage/expressions/ExpressionManager.h" + #include "storm-gspn/storage/gspn/ImmediateTransition.h" #include "storm-gspn/storage/gspn/Marking.h" #include "storm-gspn/storage/gspn/Place.h" @@ -30,7 +32,7 @@ namespace storm { GSPN(std::string const& name, std::vector const& places, std::vector> const& itransitions, - std::vector> const& ttransitions, std::vector const& partitions); + std::vector> const& ttransitions, std::vector const& partitions, std::shared_ptr const& exprManager); /*! * Returns the number of places in this gspn. @@ -135,7 +137,13 @@ namespace storm { * @return The name. */ std::string const& getName() const; - + + /*! + * Obtain the expression manager used for expressions over GSPNs. + * + * @return + */ + std::shared_ptr const& getExpressionManager() const; /** * Set Capacities according to name->capacity map. @@ -197,7 +205,10 @@ namespace storm { std::vector> timedTransitions; std::vector partitions; - + + std::shared_ptr exprManager; + + // Layout information mutable std::map placeLayout; mutable std::map transitionLayout; diff --git a/src/storm-gspn/storage/gspn/GspnBuilder.cpp b/src/storm-gspn/storage/gspn/GspnBuilder.cpp index a727ebebf..52833419a 100644 --- a/src/storm-gspn/storage/gspn/GspnBuilder.cpp +++ b/src/storm-gspn/storage/gspn/GspnBuilder.cpp @@ -164,6 +164,9 @@ namespace storm { storm::gspn::GSPN* GspnBuilder::buildGspn() const { + std::shared_ptr exprManager(new storm::expressions::ExpressionManager()); + exprManager-> + std::vector orderedPartitions; for(auto const& priorityPartitions : partitions) { for (auto const& partition : priorityPartitions.second) { diff --git a/src/storm-gspn/storm-gspn.h b/src/storm-gspn/storm-gspn.h index 095b82aca..de3811109 100644 --- a/src/storm-gspn/storm-gspn.h +++ b/src/storm-gspn/storm-gspn.h @@ -13,8 +13,7 @@ namespace storm { * Builds JANI model from GSPN. */ storm::jani::Model* buildJani(storm::gspn::GSPN const& gspn) { - std::shared_ptr exprManager(new storm::expressions::ExpressionManager()); - storm::builder::JaniGSPNBuilder builder(gspn, exprManager); + storm::builder::JaniGSPNBuilder builder(gspn); return builder.build(); }