diff --git a/src/storm-dft-cli/storm-dyftee.cpp b/src/storm-dft-cli/storm-dyftee.cpp index 3056cbdf1..b785be6c3 100644 --- a/src/storm-dft-cli/storm-dyftee.cpp +++ b/src/storm-dft-cli/storm-dyftee.cpp @@ -77,11 +77,12 @@ void analyzeWithSMT(std::string filename) { * */ template -storm::gspn::GSPN transformDFT(std::string filename) { +storm::gspn::GSPN* transformDFT(std::string filename) { storm::parser::DFTGalileoParser parser; storm::storage::DFT dft = parser.parseDFT(filename); storm::transformations::dft::DftToGspnTransformator gspnTransformator(dft); gspnTransformator.transform(); + return gspnTransformator.obtainGSPN(); } /*! @@ -138,9 +139,9 @@ int main(const int argc, const char** argv) { } if (dftSettings.isTransformToGspn()) { - // For now we only transform the DFT to a GSPN and then exit - transformDFT(dftSettings.getDftFilename()); + storm::gspn::GSPN* gspn = transformDFT(dftSettings.getDftFilename()); + delete gspn; storm::utility::cleanUp(); return 0; } diff --git a/src/storm-dft/transformations/DftToGspnTransformator.cpp b/src/storm-dft/transformations/DftToGspnTransformator.cpp index 49f58707f..5649754cd 100644 --- a/src/storm-dft/transformations/DftToGspnTransformator.cpp +++ b/src/storm-dft/transformations/DftToGspnTransformator.cpp @@ -25,9 +25,6 @@ namespace storm { // Draw restrictions into the GSPN (i.e. SEQ or MUTEX). //drawGSPNRestrictions(); - - // Write GSPN to file. - writeGspn(true); } template @@ -457,21 +454,8 @@ namespace storm { } template - void DftToGspnTransformator::writeGspn(bool toFile) { - if (toFile) { - // Writing to file - std::ofstream file; - file.open("gspn.dot"); - storm::gspn::GSPN* gspn = builder.buildGspn(); - gspn->writeDotToStream(file); - delete gspn; - file.close(); - } else { - // Writing to console - storm::gspn::GSPN* gspn = builder.buildGspn(); - gspn->writeDotToStream(std::cout); - delete gspn; - } + gspn::GSPN* DftToGspnTransformator::obtainGSPN() { + return builder.buildGspn(); } // Explicitly instantiate the class. diff --git a/src/storm-dft/transformations/DftToGspnTransformator.h b/src/storm-dft/transformations/DftToGspnTransformator.h index 4d827e44b..e2812f738 100644 --- a/src/storm-dft/transformations/DftToGspnTransformator.h +++ b/src/storm-dft/transformations/DftToGspnTransformator.h @@ -27,16 +27,14 @@ namespace storm { */ void transform(); - private: /*! - * Write Gspn to file or console. + * Extract Gspn by building * - * @param toFile If true, the GSPN will be written to a file, otherwise it will - be written to the console. */ - void writeGspn(bool toFile); - - /* + gspn::GSPN* obtainGSPN(); + + private: + /* * Draw all elements of the GSPN. */ void drawGSPNElements(); diff --git a/src/storm-gspn/storage/gspn/GspnBuilder.cpp b/src/storm-gspn/storage/gspn/GspnBuilder.cpp index 9cb662eb7..fa81444c3 100644 --- a/src/storm-gspn/storage/gspn/GspnBuilder.cpp +++ b/src/storm-gspn/storage/gspn/GspnBuilder.cpp @@ -35,7 +35,7 @@ namespace storm { if(partitions.count(priority) == 0) { TransitionPartition newPart; newPart.priority = priority; - partitions.at(priority).push_back(newPart); + partitions[priority].push_back(newPart); } if(storm::utility::isZero(weight)) {