Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DFTGate.h
Go to the documentation of this file.
1#pragma once
2
3#include "DFTChildren.h"
4
5namespace storm::dft {
6namespace storage {
7namespace elements {
8
12template<typename ValueType>
13class DFTGate : public DFTChildren<ValueType> {
14 using DFTElementPointer = std::shared_ptr<DFTElement<ValueType>>;
15 using DFTElementVector = std::vector<DFTElementPointer>;
16
17 public:
24 DFTGate(size_t id, std::string const& name, DFTElementVector const& children) : DFTChildren<ValueType>(id, name, children) {
25 // Intentionally left empty.
26 }
27
31 virtual ~DFTGate() = default;
32
33 virtual bool isGate() const override {
34 return true;
35 }
36
37 virtual void extendSpareModule(std::set<size_t>& elementsInSpareModule) const override {
38 if (!this->isSpareGate()) {
39 DFTElement<ValueType>::extendSpareModule(elementsInSpareModule);
40 for (auto const& child : this->children()) {
41 if (elementsInSpareModule.count(child->id()) == 0) {
42 elementsInSpareModule.insert(child->id());
43 child->extendSpareModule(elementsInSpareModule);
44 }
45 }
46 }
47 }
48
52 childrenDontCare(queues);
53 return true;
54 }
55 return false;
56 }
57
58 protected:
60 for (std::shared_ptr<DFTGate> parent : this->mParents) {
61 if (state.isOperational(parent->id())) {
62 queues.propagateFailure(parent);
63 }
64 }
65 for (std::shared_ptr<DFTRestriction<ValueType>> restr : this->mRestrictions) {
66 queues.checkRestrictionLater(restr);
67 }
68 state.setFailed(this->mId);
69 this->childrenDontCare(queues);
70 }
71
73 for (std::shared_ptr<DFTGate> parent : this->mParents) {
74 if (state.isOperational(parent->id())) {
75 queues.propagateFailsafe(parent);
76 }
77 }
78 state.setFailsafe(this->mId);
79 this->childrenDontCare(queues);
80 }
81
89};
90
91} // namespace elements
92} // namespace storage
93} // namespace storm::dft
bool isOperational(size_t id) const
Definition DFTState.cpp:150
void checkRestrictionLater(DFTRestrictionPointer const &restr)
Abstract base class for a DFT element with children.
Definition DFTChildren.h:13
DFTElementVector const & children() const
Get children.
Definition DFTChildren.h:45
Abstract base class for DFT elements.
Definition DFTElement.h:39
virtual size_t id() const
Get id.
Definition DFTElement.h:73
virtual std::string const & name() const
Get name.
Definition DFTElement.h:89
virtual bool isSpareGate() const
Check whether the element is a SPARE gate.
Definition DFTElement.h:176
virtual void extendSpareModule(std::set< size_t > &elementsInModule) const
Abstract base class for gates.
Definition DFTGate.h:13
void failsafe(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Definition DFTGate.h:72
DFTGate(size_t id, std::string const &name, DFTElementVector const &children)
Constructor.
Definition DFTGate.h:24
void childrenDontCare(storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const
Propagate Don't Care to children.
Definition DFTGate.h:86
virtual void extendSpareModule(std::set< size_t > &elementsInSpareModule) const override
Definition DFTGate.h:37
virtual bool isGate() const override
Check whether the element is a gate.
Definition DFTGate.h:33
virtual ~DFTGate()=default
Destructor.
virtual bool checkDontCareAnymore(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Definition DFTGate.h:49
void fail(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Definition DFTGate.h:59
Abstract base class for restrictions.