Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BEConst.h
Go to the documentation of this file.
1#pragma once
2
3#include "DFTBE.h"
4
5namespace storm::dft {
6namespace storage {
7namespace elements {
8
13template<typename ValueType>
14class BEConst : public DFTBE<ValueType> {
15 public:
22 BEConst(size_t id, std::string const& name, bool failed) : DFTBE<ValueType>(id, name), mFailed(failed) {
23 // Intentionally empty
24 }
25
26 std::shared_ptr<DFTElement<ValueType>> clone() const override {
27 return std::shared_ptr<DFTElement<ValueType>>(new BEConst<ValueType>(this->id(), this->name(), this->failed()));
28 }
29
33
38 bool failed() const {
39 return mFailed;
40 }
41
42 bool canFail() const override {
43 return this->failed();
44 }
45
46 ValueType getUnreliability(ValueType time) const override;
47
48 std::string distributionString() const override {
49 std::stringstream stream;
50 stream << "const " << (this->failed() ? "failed" : "failsafe");
51 return stream.str();
52 }
53
54 private:
55 bool mFailed;
56};
57
58} // namespace elements
59} // namespace storage
60} // namespace storm::dft
BE which is either constant failed or constant failsafe.
Definition BEConst.h:14
ValueType getUnreliability(ValueType time) const override
Return the unreliability of the BE up to the given time point.
Definition BEConst.cpp:8
std::shared_ptr< DFTElement< ValueType > > clone() const override
Create a shallow copy of the element.
Definition BEConst.h:26
BEConst(size_t id, std::string const &name, bool failed)
Constructor.
Definition BEConst.h:22
bool failed() const
Return whether the BE has failed.
Definition BEConst.h:38
bool canFail() const override
Return whether the BE can fail.
Definition BEConst.h:42
storm::dft::storage::elements::BEType beType() const override
Get type of BE (constant, exponential, etc.).
Definition BEConst.h:30
std::string distributionString() const override
Print information about failure distribution to string.
Definition BEConst.h:48
Abstract base class for basic events (BEs) in DFTs.
Definition DFTBE.h:14
virtual size_t id() const
Get id.
Definition DFTElement.h:73
virtual std::string const & name() const
Get name.
Definition DFTElement.h:89