From 66a8e472e38d0c1fa932d4c858ea9bee0273abf2 Mon Sep 17 00:00:00 2001 From: Stefan Pranger Date: Wed, 17 Feb 2021 08:07:36 +0100 Subject: [PATCH] added ostream for ShieldExpression --- src/storm/logic/ShieldExpression.cpp | 22 ++++++++++++++++++++++ src/storm/logic/ShieldExpression.h | 6 ++++++ 2 files changed, 28 insertions(+) diff --git a/src/storm/logic/ShieldExpression.cpp b/src/storm/logic/ShieldExpression.cpp index 2959cfd0d..a85a84b9f 100644 --- a/src/storm/logic/ShieldExpression.cpp +++ b/src/storm/logic/ShieldExpression.cpp @@ -1,5 +1,7 @@ #include "storm/logic/ShieldExpression.h" +#include + namespace storm { namespace logic { ShieldExpression::ShieldExpression() {} @@ -27,5 +29,25 @@ namespace storm { double ShieldExpression::getValue() const { return value; } + + std::string ShieldExpression::typeToString() const { + switch(type) { + case storm::logic::ShieldingType::PostSafety: return "PostSafety"; + case storm::logic::ShieldingType::PreSafety: return "PreSafety"; + case storm::logic::ShieldingType::Optimal: return "Optimal"; + } + } + + std::string ShieldExpression::comparisonToString() const { + switch(comparison) { + case storm::logic::ShieldComparison::Absolute: return "gamma"; + case storm::logic::ShieldComparison::Relative: return "lambda"; + } + } + + std::ostream& operator<<(std::ostream& out, ShieldExpression const& shieldExpression) { + out << "<" << shieldExpression.typeToString() << ", " << shieldExpression.comparisonToString() << "=" << std::to_string(shieldExpression.value) << ">"; + return out; + } } } diff --git a/src/storm/logic/ShieldExpression.h b/src/storm/logic/ShieldExpression.h index 9305a2f1f..83c3d3602 100644 --- a/src/storm/logic/ShieldExpression.h +++ b/src/storm/logic/ShieldExpression.h @@ -1,6 +1,7 @@ #pragma once #include +#include namespace storm { namespace logic { @@ -25,6 +26,11 @@ namespace storm { double getValue() const; + std::string typeToString() const; + std::string comparisonToString() const; + + friend std::ostream& operator<<(std::ostream& stream, ShieldExpression const& shieldExpression); + private: ShieldingType type; ShieldComparison comparison;