From 2d44d4f822335ae67dab858931c58082d4cb18ba Mon Sep 17 00:00:00 2001 From: sjunges Date: Fri, 15 Jan 2016 19:10:52 +0100 Subject: [PATCH] getUndefinedConstantsAsString added to storm::prism::program Former-commit-id: 8dbfbf256614d635b3f2cec0511c17d0d66e4f86 --- src/storage/prism/Program.cpp | 15 +++++++++++++++ src/storage/prism/Program.h | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/storage/prism/Program.cpp b/src/storage/prism/Program.cpp index fee721878..7947b4c78 100644 --- a/src/storage/prism/Program.cpp +++ b/src/storage/prism/Program.cpp @@ -171,6 +171,21 @@ namespace storm { } return result; } + + std::string Program::getUndefinedConstantsAsString() const { + std::stringstream stream; + bool printComma = false; + for (auto const& constant : getUndefinedConstants()) { + if (printComma) { + stream << ", "; + } else { + printComma = true; + } + stream << constant.get().getName() << " (" << constant.get().getType() << ")"; + } + stream << "."; + return stream.str(); + } bool Program::hasConstant(std::string const& constantName) const { return this->constantToIndexMap.find(constantName) != this->constantToIndexMap.end(); diff --git a/src/storage/prism/Program.h b/src/storage/prism/Program.h index b4e6d45b5..45ac16b62 100644 --- a/src/storage/prism/Program.h +++ b/src/storage/prism/Program.h @@ -89,7 +89,14 @@ namespace storm { * @return The undefined constants in the program. */ std::vector> getUndefinedConstants() const; - + + /*! + * Retrieves the undefined constants in the program as a comma-separated string. + * + * @return A string with the undefined constants in the program, separated by a comma + */ + std::string getUndefinedConstantsAsString() const; + /*! * Retrieves whether the given constant exists in the program. *