Browse Source

fixed appending to existing files in jani export

tempestpy_adaptions
TimQu 6 years ago
parent
commit
0dcfd41f87
  1. 5
      src/storm/storage/jani/JSONExporter.cpp

5
src/storm/storage/jani/JSONExporter.cpp

@ -742,7 +742,7 @@ namespace storm {
void JsonExporter::toFile(storm::jani::Model const& janiModel, std::vector<storm::jani::Property> const& formulas, std::string const& filepath, bool checkValid, bool compact) { void JsonExporter::toFile(storm::jani::Model const& janiModel, std::vector<storm::jani::Property> const& formulas, std::string const& filepath, bool checkValid, bool compact) {
std::ofstream stream; std::ofstream stream;
storm::utility::openFile(filepath, stream, true);
storm::utility::openFile(filepath, stream, false, true);
toStream(janiModel, formulas, stream, checkValid, compact); toStream(janiModel, formulas, stream, checkValid, compact);
storm::utility::closeFile(stream); storm::utility::closeFile(stream);
} }
@ -1036,6 +1036,9 @@ namespace storm {
jsonStruct["type"] = to_string(janiModel.getModelType()); jsonStruct["type"] = to_string(janiModel.getModelType());
jsonStruct["actions"] = buildActionArray(janiModel.getActions()); jsonStruct["actions"] = buildActionArray(janiModel.getActions());
jsonStruct["constants"] = buildConstantsArray(janiModel.getConstants()); jsonStruct["constants"] = buildConstantsArray(janiModel.getConstants());
for (auto const& v : janiModel.getGlobalVariables()) {
std::cout << "global var " << v.getName() << std::endl;
}
jsonStruct["variables"] = buildVariablesArray(janiModel.getGlobalVariables(), janiModel.getConstants(), janiModel.getGlobalVariables()); jsonStruct["variables"] = buildVariablesArray(janiModel.getGlobalVariables(), janiModel.getConstants(), janiModel.getGlobalVariables());
if (!janiModel.getGlobalFunctionDefinitions().empty()) { if (!janiModel.getGlobalFunctionDefinitions().empty()) {
jsonStruct["functions"] = buildFunctionsArray(janiModel.getGlobalFunctionDefinitions(), janiModel.getConstants(), janiModel.getGlobalVariables()); jsonStruct["functions"] = buildFunctionsArray(janiModel.getGlobalFunctionDefinitions(), janiModel.getConstants(), janiModel.getGlobalVariables());

Loading…
Cancel
Save