diff --git a/src/storm-dft/api/storm-dft.h b/src/storm-dft/api/storm-dft.h index 30b06a1e8..fe9a51917 100644 --- a/src/storm-dft/api/storm-dft.h +++ b/src/storm-dft/api/storm-dft.h @@ -10,8 +10,7 @@ #include "storm-dft/modelchecker/dft/DFTASFChecker.h" #include "storm-dft/transformations/DftToGspnTransformator.h" -#include "storm-gspn/storage/gspn/GSPN.h" -#include "storm-gspn/storm-gspn.h" +#include "storm-gspn/api/storm-gspn.h" namespace storm { namespace api { @@ -145,7 +144,7 @@ namespace storm { storm::gspn::GSPN* gspn = gspnTransformator.obtainGSPN(); uint64_t toplevelFailedPlace = gspnTransformator.toplevelFailedPlaceId(); - storm::handleGSPNExportSettings(*gspn); + storm::api::handleGSPNExportSettings(*gspn); std::shared_ptr const& exprManager = gspn->getExpressionManager(); storm::builder::JaniGSPNBuilder builder(*gspn); diff --git a/src/storm-gspn-cli/storm-gspn.cpp b/src/storm-gspn-cli/storm-gspn.cpp index d6a493981..c1931e468 100644 --- a/src/storm-gspn-cli/storm-gspn.cpp +++ b/src/storm-gspn-cli/storm-gspn.cpp @@ -3,7 +3,7 @@ #include "storm-gspn/storage/gspn/GSPN.h" #include "storm-gspn/storage/gspn/GspnBuilder.h" #include "storm-gspn/builder/JaniGSPNBuilder.h" -#include "storm-gspn/storm-gspn.h" +#include "storm-gspn/api/storm-gspn.h" #include "storm/exceptions/BaseException.h" #include "storm/exceptions/WrongFormatException.h" @@ -108,10 +108,10 @@ int main(const int argc, const char **argv) { gspn->setCapacities(capacities); } - storm::handleGSPNExportSettings(*gspn); + storm::api::handleGSPNExportSettings(*gspn); if(storm::settings::getModule().isJaniFileSet()) { - storm::jani::Model* model = storm::buildJani(*gspn); + storm::jani::Model* model = storm::api::buildJani(*gspn); storm::api::exportJaniModel(*model, properties, storm::settings::getModule().getJaniFilename()); delete model; } diff --git a/src/storm-gspn/api/storm-gspn.cpp b/src/storm-gspn/api/storm-gspn.cpp new file mode 100644 index 000000000..08796386b --- /dev/null +++ b/src/storm-gspn/api/storm-gspn.cpp @@ -0,0 +1,61 @@ +#include "storm-gspn/api/storm-gspn.h" + +#include "storm/settings/SettingsManager.h" +#include "storm/utility/file.h" +#include "storm-gspn/settings/modules/GSPNExportSettings.h" + + +namespace storm { + namespace api { + + storm::jani::Model* buildJani(storm::gspn::GSPN const& gspn) { + storm::builder::JaniGSPNBuilder builder(gspn); + return builder.build(); + } + + void handleGSPNExportSettings(storm::gspn::GSPN const& gspn) { + storm::settings::modules::GSPNExportSettings const& exportSettings = storm::settings::getModule(); + if (exportSettings.isWriteToDotSet()) { + std::ofstream fs; + storm::utility::openFile(exportSettings.getWriteToDotFilename(), fs); + gspn.writeDotToStream(fs); + storm::utility::closeFile(fs); + } + + if (exportSettings.isWriteToPnproSet()) { + std::ofstream fs; + storm::utility::openFile(exportSettings.getWriteToPnproFilename(), fs); + gspn.toPnpro(fs); + storm::utility::closeFile(fs); + } + + if (exportSettings.isWriteToPnmlSet()) { + std::ofstream fs; + storm::utility::openFile(exportSettings.getWriteToPnmlFilename(), fs); + gspn.toPnml(fs); + storm::utility::closeFile(fs); + } + + if (exportSettings.isWriteToJsonSet()) { + std::ofstream fs; + storm::utility::openFile(exportSettings.getWriteToJsonFilename(), fs); + gspn.toJson(fs); + storm::utility::closeFile(fs); + } + + if (exportSettings.isDisplayStatsSet()) { + std::cout << "============GSPN Statistics==============" << std::endl; + gspn.writeStatsToStream(std::cout); + std::cout << "=========================================" << std::endl; + } + + if (exportSettings.isWriteStatsToFileSet()) { + std::ofstream fs; + storm::utility::openFile(exportSettings.getWriteStatsFilename(), fs); + gspn.writeStatsToStream(fs); + storm::utility::closeFile(fs); + } + } + + } +} diff --git a/src/storm-gspn/api/storm-gspn.h b/src/storm-gspn/api/storm-gspn.h new file mode 100644 index 000000000..7687c35e4 --- /dev/null +++ b/src/storm-gspn/api/storm-gspn.h @@ -0,0 +1,17 @@ +#pragma once + +#include "storm/storage/jani/Model.h" +#include "storm-gspn/storage/gspn/GSPN.h" +#include "storm-gspn/builder/JaniGSPNBuilder.h" + +namespace storm { + namespace api { + + /** + * Builds JANI model from GSPN. + */ + storm::jani::Model* buildJani(storm::gspn::GSPN const& gspn); + + void handleGSPNExportSettings(storm::gspn::GSPN const& gspn); + } +} diff --git a/src/storm-gspn/storm-gspn.h b/src/storm-gspn/storm-gspn.h deleted file mode 100644 index cc9fd9add..000000000 --- a/src/storm-gspn/storm-gspn.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include "storm/storage/jani/Model.h" - -#include "storm-gspn/builder/JaniGSPNBuilder.h" -#include "storm-gspn/storage/gspn/GSPN.h" - -#include "storm/settings/SettingsManager.h" -#include "storm-gspn/settings/modules/GSPNExportSettings.h" - -#include "storm/utility/file.h" - -namespace storm { - /** - * Builds JANI model from GSPN. - */ - storm::jani::Model* buildJani(storm::gspn::GSPN const& gspn) { - storm::builder::JaniGSPNBuilder builder(gspn); - return builder.build(); - } - - void handleGSPNExportSettings(storm::gspn::GSPN const& gspn) { - storm::settings::modules::GSPNExportSettings const& exportSettings = storm::settings::getModule(); - if (exportSettings.isWriteToDotSet()) { - std::ofstream fs; - storm::utility::openFile(exportSettings.getWriteToDotFilename(), fs); - gspn.writeDotToStream(fs); - storm::utility::closeFile(fs); - } - - if (exportSettings.isWriteToPnproSet()) { - std::ofstream fs; - storm::utility::openFile(exportSettings.getWriteToPnproFilename(), fs); - gspn.toPnpro(fs); - storm::utility::closeFile(fs); - } - - if (exportSettings.isWriteToPnmlSet()) { - std::ofstream fs; - storm::utility::openFile(exportSettings.getWriteToPnmlFilename(), fs); - gspn.toPnml(fs); - storm::utility::closeFile(fs); - } - - if (exportSettings.isWriteToJsonSet()) { - std::ofstream fs; - storm::utility::openFile(exportSettings.getWriteToJsonFilename(), fs); - gspn.toJson(fs); - storm::utility::closeFile(fs); - } - - if (exportSettings.isDisplayStatsSet()) { - std::cout << "============GSPN Statistics==============" << std::endl; - gspn.writeStatsToStream(std::cout); - std::cout << "=========================================" << std::endl; - } - - if (exportSettings.isWriteStatsToFileSet()) { - std::ofstream fs; - storm::utility::openFile(exportSettings.getWriteStatsFilename(), fs); - gspn.writeStatsToStream(fs); - storm::utility::closeFile(fs); - } - - - - } - -}