Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
io.cpp
Go to the documentation of this file.
1#include "io.h"
2
3#include <memory>
4
9
10namespace storm::dft {
11namespace api {
12
13template<typename ValueType>
14std::shared_ptr<storm::dft::storage::DFT<ValueType>> loadDFTGalileoFile(std::string const& file) {
15 return std::make_shared<storm::dft::storage::DFT<ValueType>>(parser::DFTGalileoParser<ValueType>::parseDFT(file));
16}
17
18template<typename ValueType>
19std::shared_ptr<storm::dft::storage::DFT<ValueType>> loadDFTJsonString(std::string const& jsonString) {
20 return std::make_shared<storm::dft::storage::DFT<ValueType>>(parser::DFTJsonParser<ValueType>::parseJsonFromString(jsonString));
21}
22
23template<typename ValueType>
24std::shared_ptr<storm::dft::storage::DFT<ValueType>> loadDFTJsonFile(std::string const& file) {
25 return std::make_shared<storm::dft::storage::DFT<ValueType>>(storm::dft::parser::DFTJsonParser<ValueType>::parseJsonFromFile(file));
26}
27
28template<typename ValueType>
32
33template<typename ValueType>
35 std::stringstream stream;
37 return stream.str();
38}
39
40template<>
41void exportDFTToSMT(storm::dft::storage::DFT<double> const& dft, std::string const& file) {
43 asfChecker.convert();
44 asfChecker.toFile(file);
45}
46
47template<>
49 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Export to SMT does not support this data type.");
50}
51
52// Explicitly instantiate methods
53template std::shared_ptr<storm::dft::storage::DFT<double>> loadDFTGalileoFile(std::string const&);
54template std::shared_ptr<storm::dft::storage::DFT<double>> loadDFTJsonString(std::string const&);
55template std::shared_ptr<storm::dft::storage::DFT<double>> loadDFTJsonFile(std::string const&);
56template void exportDFTToJsonFile(storm::dft::storage::DFT<double> const&, std::string const&);
58
59template std::shared_ptr<storm::dft::storage::DFT<storm::RationalFunction>> loadDFTGalileoFile(std::string const&);
60template std::shared_ptr<storm::dft::storage::DFT<storm::RationalFunction>> loadDFTJsonString(std::string const&);
61template std::shared_ptr<storm::dft::storage::DFT<storm::RationalFunction>> loadDFTJsonFile(std::string const&);
64
65} // namespace api
66} // namespace storm::dft
void convert()
Generate general variables and constraints for the DFT and store them in the corresponding maps and v...
static storm::dft::storage::DFT< ValueType > parseDFT(std::string const &filename)
Parse DFT in Galileo format and build DFT.
static storm::dft::storage::DFT< ValueType > parseJsonFromFile(std::string const &filename)
Parse DFT from JSON format given as file and build DFT.
static storm::dft::storage::DFT< ValueType > parseJsonFromString(std::string const &jsonString)
Parse DFT from JSON format given as a string and build DFT.
Represents a Dynamic Fault Tree.
Definition DFT.h:49
static void toFile(storm::dft::storage::DFT< ValueType > const &dft, std::string const &filepath)
Export DFT to given file.
static void toStream(storm::dft::storage::DFT< ValueType > const &dft, std::ostream &os)
Export DFT to given stream.
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:28
void exportDFTToJsonFile(storm::dft::storage::DFT< ValueType > const &dft, std::string const &file)
Export DFT to JSON file.
Definition io.cpp:29
std::shared_ptr< storm::dft::storage::DFT< ValueType > > loadDFTGalileoFile(std::string const &file)
Load DFT from Galileo file.
Definition io.cpp:14
std::string exportDFTToJsonString(storm::dft::storage::DFT< ValueType > const &dft)
Export DFT to JSON string.
Definition io.cpp:34
std::shared_ptr< storm::dft::storage::DFT< ValueType > > loadDFTJsonFile(std::string const &file)
Load DFT from JSON file.
Definition io.cpp:24
std::shared_ptr< storm::dft::storage::DFT< ValueType > > loadDFTJsonString(std::string const &jsonString)
Load DFT from JSON string.
Definition io.cpp:19
void exportDFTToSMT(storm::dft::storage::DFT< double > const &dft, std::string const &file)
Definition io.cpp:41