Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::io Namespace Reference

Namespaces

namespace  detail
 

Classes

class  ArchiveReader
 
class  ArchiveWriter
 
struct  DirectEncodingExporterOptions
 

Typedefs

template<typename T >
using Vec = typename ArchiveReader::ArchiveReadEntry::VectorType< T >
 

Enumerations

enum class  CompressionMode { Default , None , Gzip , Xz }
 
enum class  ModelExportFormat { Dot , Drdd , Drn , Json }
 

Functions

ArchiveReader openArchive (std::filesystem::path const &file)
 Reads an archive file.
 
template Vec< char > ArchiveReader::ArchiveReadEntry::toVector< char, std::endian::little > ()
 
template Vec< bool > ArchiveReader::ArchiveReadEntry::toVector< bool, std::endian::little > ()
 
template Vec< uint32_t > ArchiveReader::ArchiveReadEntry::toVector< uint32_t, std::endian::little > ()
 
template Vec< uint64_t > ArchiveReader::ArchiveReadEntry::toVector< uint64_t, std::endian::little > ()
 
template Vec< int64_t > ArchiveReader::ArchiveReadEntry::toVector< int64_t, std::endian::little > ()
 
template Vec< double > ArchiveReader::ArchiveReadEntry::toVector< double, std::endian::little > ()
 
CompressionMode getCompressionModeFromString (std::string const &input)
 
std::string toString (CompressionMode const &input)
 
CompressionMode getCompressionModeFromFileExtension (std::filesystem::path const &filename)
 
template<storm::dd::DdType Type, typename ValueType >
void explicitExportSymbolicModel (std::string const &filename, std::shared_ptr< storm::models::symbolic::Model< Type, ValueType > > symbolicModel)
 Exports a sparse model into the explicit drdd format.
 
template void explicitExportSymbolicModel< storm::dd::DdType::CUDD, double > (std::string const &, std::shared_ptr< storm::models::symbolic::Model< storm::dd::DdType::CUDD, double > > sparseModel)
 
template void explicitExportSymbolicModel< storm::dd::DdType::Sylvan, double > (std::string const &, std::shared_ptr< storm::models::symbolic::Model< storm::dd::DdType::Sylvan, double > > sparseModel)
 
template void explicitExportSymbolicModel< storm::dd::DdType::Sylvan, storm::RationalNumber > (std::string const &, std::shared_ptr< storm::models::symbolic::Model< storm::dd::DdType::Sylvan, storm::RationalNumber > > sparseModel)
 
template void explicitExportSymbolicModel< storm::dd::DdType::Sylvan, storm::RationalFunction > (std::string const &, std::shared_ptr< storm::models::symbolic::Model< storm::dd::DdType::Sylvan, storm::RationalFunction > > sparseModel)
 
template<typename ValueType >
void explicitExportSparseModel (std::filesystem::path const &filename, std::shared_ptr< storm::models::sparse::Model< ValueType > > sparseModel, std::vector< std::string > const &parameters, DirectEncodingExporterOptions const &options=DirectEncodingExporterOptions())
 Exports a sparse model into the explicit DRN format.
 
template<typename ValueType >
void explicitExportSparseModel (std::ostream &os, std::shared_ptr< storm::models::sparse::Model< ValueType > > sparseModel, std::vector< std::string > const &parameters, DirectEncodingExporterOptions const &options=DirectEncodingExporterOptions())
 Exports a sparse model into the explicit DRN format.
 
template<typename ValueType >
std::vector< std::string > getParameters (std::shared_ptr< storm::models::sparse::Model< ValueType > > sparseModel)
 Accumulate parameters in the model.
 
template<>
std::vector< std::string > getParameters (std::shared_ptr< storm::models::sparse::Model< storm::RationalFunction > > sparseModel)
 
template<typename ValueType >
std::unordered_map< ValueType, std::string > generatePlaceholders (std::shared_ptr< storm::models::sparse::Model< ValueType > > sparseModel, std::vector< ValueType > exitRates)
 Generate placeholders for rational functions in the model.
 
void createPlaceholder (std::unordered_map< storm::RationalFunction, std::string > &placeholders, storm::RationalFunction const &value, size_t &i)
 Helper function to create a possible placeholder.
 
template<>
std::unordered_map< storm::RationalFunction, std::string > generatePlaceholders (std::shared_ptr< storm::models::sparse::Model< storm::RationalFunction > > sparseModel, std::vector< storm::RationalFunction > exitRates)
 
template<typename ValueType >
void writeValue (std::ostream &os, ValueType value, std::unordered_map< ValueType, std::string > const &placeholders)
 Write value to stream while using the placeholders.
 
template void explicitExportSparseModel< double > (std::filesystem::path const &os, std::shared_ptr< storm::models::sparse::Model< double > > sparseModel, std::vector< std::string > const &parameters, DirectEncodingExporterOptions const &options)
 
template void explicitExportSparseModel< storm::RationalNumber > (std::filesystem::path const &os, std::shared_ptr< storm::models::sparse::Model< storm::RationalNumber > > sparseModel, std::vector< std::string > const &parameters, DirectEncodingExporterOptions const &options)
 
template void explicitExportSparseModel< storm::RationalFunction > (std::filesystem::path const &os, std::shared_ptr< storm::models::sparse::Model< storm::RationalFunction > > sparseModel, std::vector< std::string > const &parameters, DirectEncodingExporterOptions const &options)
 
template void explicitExportSparseModel< storm::Interval > (std::filesystem::path const &os, std::shared_ptr< storm::models::sparse::Model< storm::Interval > > sparseModel, std::vector< std::string > const &parameters, DirectEncodingExporterOptions const &options)
 
template void explicitExportSparseModel< double > (std::ostream &os, std::shared_ptr< storm::models::sparse::Model< double > > sparseModel, std::vector< std::string > const &parameters, DirectEncodingExporterOptions const &options)
 
template void explicitExportSparseModel< storm::RationalNumber > (std::ostream &os, std::shared_ptr< storm::models::sparse::Model< storm::RationalNumber > > sparseModel, std::vector< std::string > const &parameters, DirectEncodingExporterOptions const &options)
 
template void explicitExportSparseModel< storm::RationalFunction > (std::ostream &os, std::shared_ptr< storm::models::sparse::Model< storm::RationalFunction > > sparseModel, std::vector< std::string > const &parameters, DirectEncodingExporterOptions const &options)
 
template void explicitExportSparseModel< storm::Interval > (std::ostream &os, std::shared_ptr< storm::models::sparse::Model< storm::Interval > > sparseModel, std::vector< std::string > const &parameters, DirectEncodingExporterOptions const &options)
 
template<typename DataType , typename Header1Type = DataType, typename Header2Type = DataType>
void exportDataToCSVFile (std::string filepath, std::vector< std::vector< DataType > > const &data, boost::optional< std::vector< Header1Type > > const &header1=boost::none, boost::optional< std::vector< Header2Type > > const &header2=boost::none)
 
template<typename Container >
void outputFixedWidth (std::ostream &stream, Container const &output, size_t maxWidth=30)
 Output list of strings with linebreaks according to fixed width.
 
void openFile (std::string const &filepath, std::ofstream &filestream, bool append=false, bool silent=false)
 Open the given file for writing.
 
void openFile (std::string const &filepath, std::ifstream &filestream)
 Open the given file for reading.
 
void closeFile (std::ofstream &stream)
 Close the given file after writing.
 
void closeFile (std::ifstream &stream)
 Close the given file after reading.
 
bool fileExistsAndIsReadable (std::string const &filename)
 Tests whether the given file exists and is readable.
 
template<class CharT , class Traits , class Allocator >
std::basic_istream< CharT, Traits > & getline (std::basic_istream< CharT, Traits > &input, std::basic_string< CharT, Traits, Allocator > &str)
 Overloaded getline function which handles different types of newline (
and \r).
 
ModelExportFormat getModelExportFormatFromString (std::string const &input)
 
std::string toString (ModelExportFormat const &input)
 
ModelExportFormat getModelExportFormatFromFileExtension (std::string const &filename)
 

Typedef Documentation

◆ Vec

template<typename T >
using storm::io::Vec = typedef typename ArchiveReader::ArchiveReadEntry::VectorType<T>

Definition at line 64 of file ArchiveReader.cpp.

Enumeration Type Documentation

◆ CompressionMode

enum class storm::io::CompressionMode
strong
Enumerator
Default 
None 
Gzip 
Xz 

Definition at line 8 of file CompressionMode.h.

◆ ModelExportFormat

enum class storm::io::ModelExportFormat
strong
Enumerator
Dot 
Drdd 
Drn 
Json 

Definition at line 8 of file ModelExportFormat.h.

Function Documentation

◆ ArchiveReader::ArchiveReadEntry::toVector< bool, std::endian::little >()

template Vec< bool > storm::io::ArchiveReader::ArchiveReadEntry::toVector< bool, std::endian::little > ( )

◆ ArchiveReader::ArchiveReadEntry::toVector< char, std::endian::little >()

template Vec< char > storm::io::ArchiveReader::ArchiveReadEntry::toVector< char, std::endian::little > ( )

◆ ArchiveReader::ArchiveReadEntry::toVector< double, std::endian::little >()

template Vec< double > storm::io::ArchiveReader::ArchiveReadEntry::toVector< double, std::endian::little > ( )

◆ ArchiveReader::ArchiveReadEntry::toVector< int64_t, std::endian::little >()

template Vec< int64_t > storm::io::ArchiveReader::ArchiveReadEntry::toVector< int64_t, std::endian::little > ( )

◆ ArchiveReader::ArchiveReadEntry::toVector< uint32_t, std::endian::little >()

template Vec< uint32_t > storm::io::ArchiveReader::ArchiveReadEntry::toVector< uint32_t, std::endian::little > ( )

◆ ArchiveReader::ArchiveReadEntry::toVector< uint64_t, std::endian::little >()

template Vec< uint64_t > storm::io::ArchiveReader::ArchiveReadEntry::toVector< uint64_t, std::endian::little > ( )

◆ closeFile() [1/2]

void storm::io::closeFile ( std::ifstream &  stream)
inline

Close the given file after reading.

Parameters
streamContains the file handler to close.

Definition at line 56 of file file.h.

◆ closeFile() [2/2]

void storm::io::closeFile ( std::ofstream &  stream)
inline

Close the given file after writing.

Parameters
streamContains the file handler to close.

Definition at line 47 of file file.h.

◆ createPlaceholder()

void storm::io::createPlaceholder ( std::unordered_map< storm::RationalFunction, std::string > &  placeholders,
storm::RationalFunction const &  value,
size_t &  i 
)

Helper function to create a possible placeholder.

A new placeholder is inserted if the rational function is not constant and the function does not exist yet.

Parameters
placeholdersExisting placeholders.
valueValue.
iCounter to enumerate placeholders.

Definition at line 258 of file DirectEncodingExporter.cpp.

◆ explicitExportSparseModel() [1/2]

template<typename ValueType >
void storm::io::explicitExportSparseModel ( std::filesystem::path const &  filename,
std::shared_ptr< storm::models::sparse::Model< ValueType > >  sparseModel,
std::vector< std::string > const &  parameters,
DirectEncodingExporterOptions const &  options = DirectEncodingExporterOptions() 
)

Exports a sparse model into the explicit DRN format.

Parameters
filenamefile to export to
sparseModelModel to export
parametersList of parameters
optionsOptions for direct encoding export

Definition at line 23 of file DirectEncodingExporter.cpp.

◆ explicitExportSparseModel() [2/2]

template<typename ValueType >
void storm::io::explicitExportSparseModel ( std::ostream &  os,
std::shared_ptr< storm::models::sparse::Model< ValueType > >  sparseModel,
std::vector< std::string > const &  parameters,
DirectEncodingExporterOptions const &  options = DirectEncodingExporterOptions() 
)

Exports a sparse model into the explicit DRN format.

Parameters
osStream to export to
sparseModelModel to export
parametersList of parameters
optionsOptions for direct encoding export

Definition at line 47 of file DirectEncodingExporter.cpp.

◆ explicitExportSparseModel< double >() [1/2]

template void storm::io::explicitExportSparseModel< double > ( std::filesystem::path const &  os,
std::shared_ptr< storm::models::sparse::Model< double > >  sparseModel,
std::vector< std::string > const &  parameters,
DirectEncodingExporterOptions const &  options 
)

◆ explicitExportSparseModel< double >() [2/2]

template void storm::io::explicitExportSparseModel< double > ( std::ostream &  os,
std::shared_ptr< storm::models::sparse::Model< double > >  sparseModel,
std::vector< std::string > const &  parameters,
DirectEncodingExporterOptions const &  options 
)

◆ explicitExportSparseModel< storm::Interval >() [1/2]

template void storm::io::explicitExportSparseModel< storm::Interval > ( std::filesystem::path const &  os,
std::shared_ptr< storm::models::sparse::Model< storm::Interval > >  sparseModel,
std::vector< std::string > const &  parameters,
DirectEncodingExporterOptions const &  options 
)

◆ explicitExportSparseModel< storm::Interval >() [2/2]

template void storm::io::explicitExportSparseModel< storm::Interval > ( std::ostream &  os,
std::shared_ptr< storm::models::sparse::Model< storm::Interval > >  sparseModel,
std::vector< std::string > const &  parameters,
DirectEncodingExporterOptions const &  options 
)

◆ explicitExportSparseModel< storm::RationalFunction >() [1/2]

template void storm::io::explicitExportSparseModel< storm::RationalFunction > ( std::filesystem::path const &  os,
std::shared_ptr< storm::models::sparse::Model< storm::RationalFunction > >  sparseModel,
std::vector< std::string > const &  parameters,
DirectEncodingExporterOptions const &  options 
)

◆ explicitExportSparseModel< storm::RationalFunction >() [2/2]

template void storm::io::explicitExportSparseModel< storm::RationalFunction > ( std::ostream &  os,
std::shared_ptr< storm::models::sparse::Model< storm::RationalFunction > >  sparseModel,
std::vector< std::string > const &  parameters,
DirectEncodingExporterOptions const &  options 
)

◆ explicitExportSparseModel< storm::RationalNumber >() [1/2]

template void storm::io::explicitExportSparseModel< storm::RationalNumber > ( std::filesystem::path const &  os,
std::shared_ptr< storm::models::sparse::Model< storm::RationalNumber > >  sparseModel,
std::vector< std::string > const &  parameters,
DirectEncodingExporterOptions const &  options 
)

◆ explicitExportSparseModel< storm::RationalNumber >() [2/2]

template void storm::io::explicitExportSparseModel< storm::RationalNumber > ( std::ostream &  os,
std::shared_ptr< storm::models::sparse::Model< storm::RationalNumber > >  sparseModel,
std::vector< std::string > const &  parameters,
DirectEncodingExporterOptions const &  options 
)

◆ explicitExportSymbolicModel()

template<storm::dd::DdType Type, typename ValueType >
void storm::io::explicitExportSymbolicModel ( std::string const &  filename,
std::shared_ptr< storm::models::symbolic::Model< Type, ValueType > >  symbolicModel 
)

Exports a sparse model into the explicit drdd format.

Parameters
filenameFile path
symbolicModelModel to export

Definition at line 10 of file DDEncodingExporter.cpp.

◆ explicitExportSymbolicModel< storm::dd::DdType::CUDD, double >()

template void storm::io::explicitExportSymbolicModel< storm::dd::DdType::CUDD, double > ( std::string const &  ,
std::shared_ptr< storm::models::symbolic::Model< storm::dd::DdType::CUDD, double > >  sparseModel 
)

◆ explicitExportSymbolicModel< storm::dd::DdType::Sylvan, double >()

template void storm::io::explicitExportSymbolicModel< storm::dd::DdType::Sylvan, double > ( std::string const &  ,
std::shared_ptr< storm::models::symbolic::Model< storm::dd::DdType::Sylvan, double > >  sparseModel 
)

◆ explicitExportSymbolicModel< storm::dd::DdType::Sylvan, storm::RationalFunction >()

◆ explicitExportSymbolicModel< storm::dd::DdType::Sylvan, storm::RationalNumber >()

template void storm::io::explicitExportSymbolicModel< storm::dd::DdType::Sylvan, storm::RationalNumber > ( std::string const &  ,
std::shared_ptr< storm::models::symbolic::Model< storm::dd::DdType::Sylvan, storm::RationalNumber > >  sparseModel 
)

◆ exportDataToCSVFile()

template<typename DataType , typename Header1Type = DataType, typename Header2Type = DataType>
void storm::io::exportDataToCSVFile ( std::string  filepath,
std::vector< std::vector< DataType > > const &  data,
boost::optional< std::vector< Header1Type > > const &  header1 = boost::none,
boost::optional< std::vector< Header2Type > > const &  header2 = boost::none 
)
inline

Definition at line 13 of file export.h.

◆ fileExistsAndIsReadable()

bool storm::io::fileExistsAndIsReadable ( std::string const &  filename)
inline

Tests whether the given file exists and is readable.

Parameters
filenamePath and name of the file to be tested.
Returns
True iff the file exists and is readable.

Definition at line 66 of file file.h.

◆ generatePlaceholders() [1/2]

template<>
std::unordered_map< storm::RationalFunction, std::string > storm::io::generatePlaceholders ( std::shared_ptr< storm::models::sparse::Model< storm::RationalFunction > >  sparseModel,
std::vector< storm::RationalFunction exitRates 
)

Definition at line 269 of file DirectEncodingExporter.cpp.

◆ generatePlaceholders() [2/2]

template<typename ValueType >
std::unordered_map< ValueType, std::string > storm::io::generatePlaceholders ( std::shared_ptr< storm::models::sparse::Model< ValueType > >  sparseModel,
std::vector< ValueType >  exitRates 
)

Generate placeholders for rational functions in the model.

Parameters
sparseModelModel.
exitRatesExit rates.
Returns
Mapping of the form:rational function -> placeholder name.

Definition at line 246 of file DirectEncodingExporter.cpp.

◆ getCompressionModeFromFileExtension()

CompressionMode storm::io::getCompressionModeFromFileExtension ( std::filesystem::path const &  filename)
Returns
the compression that the file extension of the given filename suggests. None if it was not detected.

Definition at line 39 of file CompressionMode.cpp.

◆ getCompressionModeFromString()

CompressionMode storm::io::getCompressionModeFromString ( std::string const &  input)
Returns
The compression mode whose string representation matches the given input
Exceptions
InvalidArgumentExceptionif the input doesn't match any known compression mode

Definition at line 8 of file CompressionMode.cpp.

◆ getline()

template<class CharT , class Traits , class Allocator >
std::basic_istream< CharT, Traits > & storm::io::getline ( std::basic_istream< CharT, Traits > &  input,
std::basic_string< CharT, Traits, Allocator > &  str 
)
inline

Overloaded getline function which handles different types of newline (
and \r).

Parameters
inputInput stream.
strOutput string.
Returns
Remaining stream.

Definition at line 80 of file file.h.

◆ getModelExportFormatFromFileExtension()

ModelExportFormat storm::io::getModelExportFormatFromFileExtension ( std::string const &  filename)
Returns
The ModelExportFormat whose string representation matches the extension of the given file
Exceptions
InvalidArgumentExceptionif there is no file extension or if it doesn't match any known format.

Definition at line 39 of file ModelExportFormat.cpp.

◆ getModelExportFormatFromString()

ModelExportFormat storm::io::getModelExportFormatFromString ( std::string const &  input)
Returns
The ModelExportFormat whose string representation matches the given input
Exceptions
InvalidArgumentExceptionif the input doesn't match any known format

Definition at line 12 of file ModelExportFormat.cpp.

◆ getParameters() [1/2]

template<>
std::vector< std::string > storm::io::getParameters ( std::shared_ptr< storm::models::sparse::Model< storm::RationalFunction > >  sparseModel)

Definition at line 232 of file DirectEncodingExporter.cpp.

◆ getParameters() [2/2]

template<typename ValueType >
std::vector< std::string > storm::io::getParameters ( std::shared_ptr< storm::models::sparse::Model< ValueType > >  sparseModel)

Accumulate parameters in the model.

Parameters
sparseModelModel.
Returns
List of parameters in the model.

Definition at line 227 of file DirectEncodingExporter.cpp.

◆ openArchive()

ArchiveReader storm::io::openArchive ( std::filesystem::path const &  file)

Reads an archive file.

Parameters
filepath to an archive file
Returns
A range-like object to iterate over the entries in the archive.

Definition at line 307 of file ArchiveReader.cpp.

◆ openFile() [1/2]

void storm::io::openFile ( std::string const &  filepath,
std::ifstream &  filestream 
)
inline

Open the given file for reading.

Parameters
filepathPath and name of the file to be tested.
filestreamContains the file handler afterwards.

Definition at line 37 of file file.h.

◆ openFile() [2/2]

void storm::io::openFile ( std::string const &  filepath,
std::ofstream &  filestream,
bool  append = false,
bool  silent = false 
)
inline

Open the given file for writing.

Parameters
filepathPath and name of the file to be written to.
filestreamContains the file handler afterwards.
appendIf true, the new content is appended instead of clearing the existing content.

Definition at line 18 of file file.h.

◆ outputFixedWidth()

template<typename Container >
void storm::io::outputFixedWidth ( std::ostream &  stream,
Container const &  output,
size_t  maxWidth = 30 
)
inline

Output list of strings with linebreaks according to fixed width.

Strings are printed with comma separator. If the length of the current line is greater than maxWidth, a linebreak is inserted.

Parameters
streamOutput stream.
outputList of strings to output.
maxWidthMaximal width after which a linebreak is inserted. Value 0 represents no linebreaks.

Definition at line 60 of file export.h.

◆ toString() [1/2]

std::string storm::io::toString ( CompressionMode const &  input)
Returns
The string representation of the given input

Definition at line 23 of file CompressionMode.cpp.

◆ toString() [2/2]

std::string storm::io::toString ( ModelExportFormat const &  input)
Returns
The string representation of the given input

Definition at line 25 of file ModelExportFormat.cpp.

◆ writeValue()

template<typename ValueType >
void storm::io::writeValue ( std::ostream &  os,
ValueType  value,
std::unordered_map< ValueType, std::string > const &  placeholders 
)

Write value to stream while using the placeholders.

Parameters
osOutput stream.
valueValue.
placeholdersPlaceholders.

Definition at line 302 of file DirectEncodingExporter.cpp.