Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DFTOr.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 DFTOr : public DFTGate<ValueType> {
15 public:
22 DFTOr(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 DFTOr<ValueType>(this->id(), this->name(), {}));
29 }
30
34
35 bool isStaticElement() const override {
36 return true;
37 }
38
40 STORM_LOG_ASSERT(this->hasFailedChild(state), "No failed child.");
41 if (state.isOperational(this->mId)) {
42 this->fail(state, queues);
43 }
44 }
45
47 for (auto const& child : this->children()) {
48 if (!state.isFailsafe(child->id())) {
49 return;
50 }
51 }
52 // All chidren are failsafe
53 this->failsafe(state, queues);
54 }
55};
56
57} // namespace elements
58} // namespace storage
59} // namespace storm::dft
bool isOperational(size_t id) const
Definition DFTState.cpp:150
bool isFailsafe(size_t id) const
Definition DFTState.cpp:165
DFTElementVector const & children() const
Get children.
Definition DFTChildren.h:45
bool hasFailedChild(storm::dft::storage::DFTState< ValueType > &state) const
Check whether it has a failed child.
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 fail(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Definition DFTGate.h:59
void checkFails(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Check failed status.
Definition DFTOr.h:39
std::shared_ptr< DFTElement< ValueType > > clone() const override
Create a shallow copy of the element.
Definition DFTOr.h:27
bool isStaticElement() const override
Check whether the element is static, ie a BE or a static gate (AND, OR, VOT).
Definition DFTOr.h:35
void checkFailsafe(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Check failsafe status.
Definition DFTOr.h:46
DFTOr(size_t id, std::string const &name, std::vector< std::shared_ptr< DFTElement< ValueType > > > const &children={})
Constructor.
Definition DFTOr.h:22
storm::dft::storage::elements::DFTElementType type() const override
Get type.
Definition DFTOr.h:31
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
DFTElementType
Element types in a DFT.