12 changed files with 330 additions and 194 deletions
-
10src/storm-dft/builder/DFTBuilder.cpp
-
1src/storm-dft/storage/dft/DFT.cpp
-
3src/storm-dft/storage/dft/elements/BEConst.h
-
2src/storm-dft/storage/dft/elements/BEExponential.h
-
39src/storm-dft/storage/dft/elements/DFTAnd.h
-
16src/storm-dft/storage/dft/elements/DFTBE.h
-
139src/storm-dft/storage/dft/elements/DFTDependency.h
-
4src/storm-dft/storage/dft/elements/DFTGate.h
-
36src/storm-dft/storage/dft/elements/DFTOr.h
-
69src/storm-dft/storage/dft/elements/DFTPand.h
-
73src/storm-dft/storage/dft/elements/DFTPor.h
-
80src/storm-dft/storage/dft/elements/DFTVot.h
@ -1,43 +1,52 @@ |
|||||
#pragma once |
#pragma once |
||||
|
|
||||
#include "DFTGate.h" |
#include "DFTGate.h" |
||||
|
|
||||
namespace storm { |
namespace storm { |
||||
namespace storage { |
namespace storage { |
||||
|
|
||||
|
/*! |
||||
|
* AND gate. |
||||
|
* Fails if all children have failed. |
||||
|
*/ |
||||
template<typename ValueType> |
template<typename ValueType> |
||||
class DFTAnd : public DFTGate<ValueType> { |
class DFTAnd : public DFTGate<ValueType> { |
||||
|
|
||||
public: |
public: |
||||
DFTAnd(size_t id, std::string const& name, std::vector<std::shared_ptr<DFTElement<ValueType>>> const& children = {}) : |
|
||||
DFTGate<ValueType>(id, name, children) |
|
||||
{} |
|
||||
|
/*! |
||||
|
* Constructor. |
||||
|
* @param id Id. |
||||
|
* @param name Name. |
||||
|
* @param children Children. |
||||
|
*/ |
||||
|
DFTAnd(size_t id, std::string const& name, std::vector<std::shared_ptr<DFTElement<ValueType>>> const& children = {}) : DFTGate<ValueType>(id, name, children) { |
||||
|
// Intentionally empty |
||||
|
} |
||||
|
|
||||
|
DFTElementType type() const override { |
||||
|
return DFTElementType::AND; |
||||
|
} |
||||
|
|
||||
void checkFails(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
void checkFails(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
||||
if(state.isOperational(this->mId)) { |
|
||||
for(auto const& child : this->mChildren) |
|
||||
{ |
|
||||
if(!state.hasFailed(child->id())) { |
|
||||
|
if (state.isOperational(this->mId)) { |
||||
|
for (auto const& child : this->mChildren) { |
||||
|
if (!state.hasFailed(child->id())) { |
||||
return; |
return; |
||||
} |
} |
||||
} |
} |
||||
|
// All children have failed |
||||
this->fail(state, queues); |
this->fail(state, queues); |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
void checkFailsafe(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
void checkFailsafe(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
||||
STORM_LOG_ASSERT(this->hasFailsafeChild(state), "No failsafe child."); |
STORM_LOG_ASSERT(this->hasFailsafeChild(state), "No failsafe child."); |
||||
if(state.isOperational(this->mId)) { |
|
||||
|
if (state.isOperational(this->mId)) { |
||||
this->failsafe(state, queues); |
this->failsafe(state, queues); |
||||
this->childrenDontCare(state, queues); |
this->childrenDontCare(state, queues); |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
virtual DFTElementType type() const override { |
|
||||
return DFTElementType::AND; |
|
||||
} |
|
||||
|
|
||||
std::string typestring() const override { |
|
||||
return "AND"; |
|
||||
} |
|
||||
}; |
}; |
||||
|
|
||||
} |
} |
||||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue