#pragma once #include "DFTElement.h" namespace storm { namespace storage { template class DFTConst : public DFTElement { bool mFailed; public: DFTConst(size_t id, std::string const& name, bool failed) : DFTElement(id, name), mFailed(failed) {} DFTElementType type() const override { if(mFailed) { return DFTElementType::CONSTF; } else { return DFTElementType::CONSTS; } } bool failed() const { return mFailed; } virtual bool isConstant() const override { return true; } virtual size_t nrChildren() const override { return 0; } std::string toString() const override { std::stringstream stream; stream << *this; return stream.str(); } bool isTypeEqualTo(DFTElement const& other) const override { if(!DFTElement::isTypeEqualTo(other)) return false; DFTConst const& otherCNST = static_cast const&>(other); return (mFailed == otherCNST.mFailed); } }; template inline std::ostream& operator<<(std::ostream& os, DFTConst const& be) { return os << "{" << be.name() << "} BE(const " << (be.failed() ? "failed" : "failsafe") << ")"; } } }