Browse Source

Add error checking to C style io

tempestpy_adaptions
Daniel Basgöze 5 years ago
parent
commit
7076a54dfb
  1. 10
      src/storm/storage/dd/sylvan/InternalSylvanAdd.cpp

10
src/storm/storage/dd/sylvan/InternalSylvanAdd.cpp

@ -803,17 +803,27 @@ namespace storm {
void InternalAdd<DdType::Sylvan, ValueType>::exportToDot(std::string const& filename, std::vector<std::string> const&, bool) const {
// Open the file, dump the DD and close it again.
FILE* filePointer = fopen(filename.c_str() , "a+");
// fopen returns a nullptr on failure
if (filePointer == nullptr) {
STORM_LOG_ERROR("Failure to open file: " << filename);
} else {
this->sylvanMtbdd.PrintDot(filePointer);
fclose(filePointer);
}
}
template<typename ValueType>
void InternalAdd<DdType::Sylvan, ValueType>::exportToText(std::string const& filename) const {
// Open the file, dump the DD and close it again.
FILE* filePointer = fopen(filename.c_str() , "a+");
// fopen returns a nullptr on failure
if (filePointer == nullptr) {
STORM_LOG_ERROR("Failure to open file: " << filename);
} else {
this->sylvanMtbdd.PrintText(filePointer);
fclose(filePointer);
}
}
template<typename ValueType>
AddIterator<DdType::Sylvan, ValueType> InternalAdd<DdType::Sylvan, ValueType>::begin(DdManager<DdType::Sylvan> const& fullDdManager, InternalBdd<DdType::Sylvan> const& variableCube, uint_fast64_t numberOfDdVariables, std::set<storm::expressions::Variable> const& metaVariables, bool enumerateDontCareMetaVariables) const {

Loading…
Cancel
Save