#include "src/logic/RewardOperatorFormula.h" #include "src/logic/FormulaVisitor.h" #include "src/utility/macros.h" #include "src/exceptions/InvalidPropertyException.h" namespace storm { namespace logic { RewardOperatorFormula::RewardOperatorFormula(std::shared_ptr const& subformula, boost::optional const& rewardModelName, OperatorInformation const& operatorInformation, RewardMeasureType rewardMeasureType) : OperatorFormula(subformula, operatorInformation), rewardModelName(rewardModelName), rewardMeasureType(rewardMeasureType) { // Intentionally left empty. } bool RewardOperatorFormula::isRewardOperatorFormula() const { return true; } boost::any RewardOperatorFormula::accept(FormulaVisitor const& visitor, boost::any const& data) const { return visitor.visit(*this, data); } std::string const& RewardOperatorFormula::getRewardModelName() const { return this->rewardModelName.get(); } bool RewardOperatorFormula::hasRewardModelName() const { return static_cast(rewardModelName); } boost::optional const& RewardOperatorFormula::getOptionalRewardModelName() const { return this->rewardModelName; } void RewardOperatorFormula::gatherReferencedRewardModels(std::set& referencedRewardModels) const { if (this->hasRewardModelName()) { referencedRewardModels.insert(this->getRewardModelName()); } else { referencedRewardModels.insert(""); } this->getSubformula().gatherReferencedRewardModels(referencedRewardModels); } RewardMeasureType RewardOperatorFormula::getMeasureType() const { return rewardMeasureType; } std::ostream& RewardOperatorFormula::writeToStream(std::ostream& out) const { out << "R"; out << "[" << rewardMeasureType << "]"; if (this->hasRewardModelName()) { out << "{\"" << this->getRewardModelName() << "\"}"; } OperatorFormula::writeToStream(out); return out; } } }