Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DFTAnd.h
Go to the documentation of this file.
1#pragma once
2
3#include "DFTGate.h"
4
5namespace storm::dft {
6namespace storage {
7namespace elements {
8
13template<typename ValueType>
14class DFTAnd : public DFTGate<ValueType> {
15 public:
22 DFTAnd(size_t id, std::string const& name, std::vector<std::shared_ptr<DFTElement<ValueType>>> const& children = {})
23 : DFTGate<ValueType>(id, name, children) {
24 // Intentionally empty
25 }
26
27 std::shared_ptr<DFTElement<ValueType>> clone() const override {
28 return std::shared_ptr<DFTElement<ValueType>>(new DFTAnd<ValueType>(this->id(), this->name(), {}));
29 }
30
34
35 bool isStaticElement() const override {
36 return true;
37 }
38
40 if (state.isOperational(this->mId)) {
41 for (auto const& child : this->children()) {
42 if (!state.hasFailed(child->id())) {
43 return;
44 }
45 }
46 // All children have failed
47 this->fail(state, queues);
48 }
49 }
50
52 STORM_LOG_ASSERT(this->hasFailsafeChild(state), "No failsafe child.");
53 if (state.isOperational(this->mId)) {
54 this->failsafe(state, queues);
55 this->childrenDontCare(queues);
56 }
57 }
58};
59
60} // namespace elements
61} // namespace storage
62} // namespace storm::dft
bool hasFailed(size_t id) const
Definition DFTState.cpp:155
bool isOperational(size_t id) const
Definition DFTState.cpp:150
void checkFailsafe(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Check failsafe status.
Definition DFTAnd.h:51
DFTAnd(size_t id, std::string const &name, std::vector< std::shared_ptr< DFTElement< ValueType > > > const &children={})
Constructor.
Definition DFTAnd.h:22
std::shared_ptr< DFTElement< ValueType > > clone() const override
Create a shallow copy of the element.
Definition DFTAnd.h:27
void checkFails(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Check failed status.
Definition DFTAnd.h:39
storm::dft::storage::elements::DFTElementType type() const override
Get type.
Definition DFTAnd.h:31
bool isStaticElement() const override
Check whether the element is static, ie a BE or a static gate (AND, OR, VOT).
Definition DFTAnd.h:35
bool hasFailsafeChild(storm::dft::storage::DFTState< ValueType > &state) const
Check whether it has a failsafe child.
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
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
void childrenDontCare(storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const
Propagate Don't Care to children.
Definition DFTGate.h:86
void fail(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Definition DFTGate.h:59
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
DFTElementType
Element types in a DFT.