Browse Source

Introduced api dir in storm-gspn

tempestpy_adaptions
Matthias Volk 7 years ago
parent
commit
853901af45
  1. 5
      src/storm-dft/api/storm-dft.h
  2. 6
      src/storm-gspn-cli/storm-gspn.cpp
  3. 61
      src/storm-gspn/api/storm-gspn.cpp
  4. 17
      src/storm-gspn/api/storm-gspn.h
  5. 69
      src/storm-gspn/storm-gspn.h

5
src/storm-dft/api/storm-dft.h

@ -10,8 +10,7 @@
#include "storm-dft/modelchecker/dft/DFTASFChecker.h" #include "storm-dft/modelchecker/dft/DFTASFChecker.h"
#include "storm-dft/transformations/DftToGspnTransformator.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 storm {
namespace api { namespace api {
@ -145,7 +144,7 @@ namespace storm {
storm::gspn::GSPN* gspn = gspnTransformator.obtainGSPN(); storm::gspn::GSPN* gspn = gspnTransformator.obtainGSPN();
uint64_t toplevelFailedPlace = gspnTransformator.toplevelFailedPlaceId(); uint64_t toplevelFailedPlace = gspnTransformator.toplevelFailedPlaceId();
storm::handleGSPNExportSettings(*gspn);
storm::api::handleGSPNExportSettings(*gspn);
std::shared_ptr<storm::expressions::ExpressionManager> const& exprManager = gspn->getExpressionManager(); std::shared_ptr<storm::expressions::ExpressionManager> const& exprManager = gspn->getExpressionManager();
storm::builder::JaniGSPNBuilder builder(*gspn); storm::builder::JaniGSPNBuilder builder(*gspn);

6
src/storm-gspn-cli/storm-gspn.cpp

@ -3,7 +3,7 @@
#include "storm-gspn/storage/gspn/GSPN.h" #include "storm-gspn/storage/gspn/GSPN.h"
#include "storm-gspn/storage/gspn/GspnBuilder.h" #include "storm-gspn/storage/gspn/GspnBuilder.h"
#include "storm-gspn/builder/JaniGSPNBuilder.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/BaseException.h"
#include "storm/exceptions/WrongFormatException.h" #include "storm/exceptions/WrongFormatException.h"
@ -108,10 +108,10 @@ int main(const int argc, const char **argv) {
gspn->setCapacities(capacities); gspn->setCapacities(capacities);
} }
storm::handleGSPNExportSettings(*gspn);
storm::api::handleGSPNExportSettings(*gspn);
if(storm::settings::getModule<storm::settings::modules::JaniExportSettings>().isJaniFileSet()) { if(storm::settings::getModule<storm::settings::modules::JaniExportSettings>().isJaniFileSet()) {
storm::jani::Model* model = storm::buildJani(*gspn);
storm::jani::Model* model = storm::api::buildJani(*gspn);
storm::api::exportJaniModel(*model, properties, storm::settings::getModule<storm::settings::modules::JaniExportSettings>().getJaniFilename()); storm::api::exportJaniModel(*model, properties, storm::settings::getModule<storm::settings::modules::JaniExportSettings>().getJaniFilename());
delete model; delete model;
} }

61
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<storm::settings::modules::GSPNExportSettings>();
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);
}
}
}
}

17
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);
}
}

69
src/storm-gspn/storm-gspn.h

@ -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<storm::settings::modules::GSPNExportSettings>();
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);
}
}
}
Loading…
Cancel
Save