Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DFTMutex.h
Go to the documentation of this file.
1#pragma once
2
3#include "DFTRestriction.h"
4
5namespace storm::dft {
6namespace storage {
7namespace elements {
8
14template<typename ValueType>
15class DFTMutex : public DFTRestriction<ValueType> {
16 public:
23 DFTMutex(size_t id, std::string const& name, std::vector<std::shared_ptr<DFTElement<ValueType>>> const& children = {})
24 : DFTRestriction<ValueType>(id, name, children) {
25 // Intentionally left empty.
26 }
27
28 std::shared_ptr<DFTElement<ValueType>> clone() const override {
29 return std::shared_ptr<DFTElement<ValueType>>(new DFTMutex<ValueType>(this->id(), this->name(), {}));
30 }
31
35
36 bool isMutex() const override {
37 return true;
38 }
39
41 STORM_LOG_ASSERT(queues.failurePropagationDone(), "Failure propagation not finished.");
42 bool childFailed = false;
43 for (auto const& child : this->children()) {
44 if (state.hasFailed(child->id())) {
45 if (childFailed) {
46 // Two children have failed
47 this->fail(state, queues);
48 return;
49 } else {
50 childFailed = true;
51 }
52 }
53 }
54 }
55
57
61};
62
63} // namespace elements
64} // namespace storage
65} // namespace storm::dft
bool hasFailed(size_t id) const
Definition DFTState.cpp:155
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
Mutex restriction (MUTEX).
Definition DFTMutex.h:15
bool checkDontCareAnymore(storm::dft::storage::DFTState< ValueType > &, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &) const override
Definition DFTMutex.h:58
storm::dft::storage::elements::DFTElementType type() const override
Get type.
Definition DFTMutex.h:32
bool isMutex() const override
Return whether the restriction is a mutex.
Definition DFTMutex.h:36
void checkFailsafe(storm::dft::storage::DFTState< ValueType > &, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &) const override
Check failsafe status.
Definition DFTMutex.h:56
std::shared_ptr< DFTElement< ValueType > > clone() const override
Create a shallow copy of the element.
Definition DFTMutex.h:28
void checkFails(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Check failed status.
Definition DFTMutex.h:40
DFTMutex(size_t id, std::string const &name, std::vector< std::shared_ptr< DFTElement< ValueType > > > const &children={})
Constructor.
Definition DFTMutex.h:23
Abstract base class for restrictions.
void fail(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &) const override
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
DFTElementType
Element types in a DFT.