Browse Source

DFT: export to JSON as string

tempestpy_adaptions
Matthias Volk 6 years ago
parent
commit
48efde755b
  1. 2
      src/storm-dft-cli/storm-dft.cpp
  2. 16
      src/storm-dft/api/storm-dft.cpp
  3. 10
      src/storm-dft/api/storm-dft.h

2
src/storm-dft-cli/storm-dft.cpp

@ -46,7 +46,7 @@ void processOptions() {
if (dftIOSettings.isExportToJson()) {
// Export to json
storm::api::exportDFTToJson<ValueType>(*dft, dftIOSettings.getExportJsonFilename());
storm::api::exportDFTToJsonFile<ValueType>(*dft, dftIOSettings.getExportJsonFilename());
return;
}

16
src/storm-dft/api/storm-dft.cpp

@ -4,12 +4,24 @@ namespace storm {
namespace api {
template<>
void exportDFTToJson(storm::storage::DFT<double> const& dft, std::string const& file) {
void exportDFTToJsonFile(storm::storage::DFT<double> const& dft, std::string const& file) {
storm::storage::DftJsonExporter<double>::toFile(dft, file);
}
template<>
void exportDFTToJson(storm::storage::DFT<storm::RationalFunction> const& dft, std::string const& file) {
void exportDFTToJsonFile(storm::storage::DFT<storm::RationalFunction> const& dft, std::string const& file) {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Export to JSON not supported for this data type.");
}
template<>
std::string exportDFTToJsonString(storm::storage::DFT<double> const& dft) {
std::stringstream stream;
storm::storage::DftJsonExporter<double>::toStream(dft, stream);
return stream.str();
}
template<>
std::string exportDFTToJsonString(storm::storage::DFT<storm::RationalFunction> const& dft) {
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Export to JSON not supported for this data type.");
}

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

@ -107,7 +107,15 @@ namespace storm {
* @param file File.
*/
template<typename ValueType>
void exportDFTToJson(storm::storage::DFT<ValueType> const& dft, std::string const& file);
void exportDFTToJsonFile(storm::storage::DFT<ValueType> const& dft, std::string const& file);
/*!
* Export DFT to JSON string.
*
* @param dft DFT.
*/
template<typename ValueType>
std::string exportDFTToJsonString(storm::storage::DFT<ValueType> const& dft);
/*!
* Export DFT to SMT encoding.

Loading…
Cancel
Save