12 std::list<size_t>::const_iterator
const& iterDependency, std::list<size_t>::const_iterator nonConflictEnd,
13 std::list<size_t>::const_iterator conflictBegin)
14 : dependency(dependency), conflicting(conflicting), itBE(iterBE), itDep(iterDependency), nonConflictEnd(nonConflictEnd), conflictBegin(conflictBegin) {
15 STORM_LOG_ASSERT(conflicting || itDep != nonConflictEnd,
"No non-conflicting dependencies present.");
21 if (!conflicting && itDep == nonConflictEnd) {
24 itDep = conflictBegin;
41 if (dependency != other.dependency) {
45 if (conflicting != other.conflicting) {
48 return itDep != other.itDep;
51 return itBE != other.itBE;
56 return !(*
this != other);
67template<
typename ValueType>
70 size_t nextFailId = **
this;
72 return dft.getBasicElement(nextFailId);
75template<
typename ValueType>
78 size_t nextFailId = **
this;
80 return dft.getDependency(nextFailId);
84 currentlyFailableBE.set(
id);
88 std::list<size_t>& failableList = (isConflicting ? failableConflictingDependencies : failableNonconflictingDependencies);
89 for (
auto it = failableList.begin(); it != failableList.end(); ++it) {
91 failableList.insert(it,
id);
93 }
else if (*it ==
id) {
98 failableList.push_back(
id);
102 currentlyFailableBE.set(
id,
false);
106 auto iter = std::find(failableConflictingDependencies.begin(), failableConflictingDependencies.end(),
id);
107 if (iter != failableConflictingDependencies.end()) {
108 failableConflictingDependencies.erase(iter);
111 iter = std::find(failableNonconflictingDependencies.begin(), failableNonconflictingDependencies.end(),
id);
112 if (iter != failableNonconflictingDependencies.end()) {
113 failableNonconflictingDependencies.erase(iter);
118 currentlyFailableBE.clear();
119 failableConflictingDependencies.clear();
120 failableNonconflictingDependencies.clear();
125 bool conflicting = failableNonconflictingDependencies.empty();
126 auto itDep = conflicting ? failableConflictingDependencies.begin() : failableNonconflictingDependencies.begin();
128 failableConflictingDependencies.begin());
134 failableNonconflictingDependencies.end(), failableConflictingDependencies.begin());
138 return !failableConflictingDependencies.empty() || !failableNonconflictingDependencies.empty();
142 return !currentlyFailableBE.empty();
146 std::stringstream stream;
149 stream <<
"Dependencies: ";
151 for (
auto it =
begin(forceBE); it !=
end(forceBE); ++it) {
152 stream << *it <<
", ";
Represents a Dynamic Fault Tree.
Iterator for failable elements.
uint_fast64_t operator*() const
Returns the id of the current failable element.
std::shared_ptr< storm::dft::storage::elements::DFTBE< ValueType > const > asBE(storm::dft::storage::DFT< ValueType > const &dft) const
Return the current iterator as a BE which fails next.
const_iterator & operator++()
Increment the iterator.
bool operator==(const_iterator const &other) const
Compares the iterator with another iterator for equality.
bool isConflictingDependency() const
Return whether the current dependency failure is conflicting.
bool isFailureDueToDependency() const
Return whether the current failure is due to a dependency (or the BE itself).
const_iterator(bool dependency, bool conflicting, storm::storage::BitVector::const_iterator const &iterBE, std::list< size_t >::const_iterator const &iterDependency, std::list< size_t >::const_iterator nonConflictEnd, std::list< size_t >::const_iterator conflictBegin)
Construct a new iterator.
std::shared_ptr< storm::dft::storage::elements::DFTDependency< ValueType > const > asDependency(storm::dft::storage::DFT< ValueType > const &dft) const
Return the current iterator as a dependency which triggers next.
bool operator!=(const_iterator const &other) const
Compares the iterator with another iterator for inequality.
void removeBE(size_t id)
Remove BE from list of failable elements.
void removeDependency(size_t id)
Remove dependency from list of failable elements.
bool hasDependencies() const
Whether failable dependencies are present.
FailableElements::const_iterator end(bool forceBE=false) const
Iterator after last failable element.
std::string getCurrentlyFailableString(bool forceBE=false) const
Get a string representation of the currently failable elements.
void addBE(size_t id)
Add failable BE.
void addDependency(size_t id, bool isConflicting)
Add failable dependency.
void clear()
Clear list of currently failable elements.
FailableElements::const_iterator begin(bool forceBE=false) const
Iterator to first failable element.
bool hasBEs() const
Whether failable BEs are present.
A class that enables iterating over the indices of the bit vector whose corresponding bits are set to...
#define STORM_LOG_ASSERT(cond, message)