Matthias Volk
6 years ago
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
-
44src/storm-dft/storage/dft/elements/DFTOr.h
-
75src/storm-dft/storage/dft/elements/DFTPand.h
-
79src/storm-dft/storage/dft/elements/DFTPor.h
-
82src/storm-dft/storage/dft/elements/DFTVot.h
@ -1,43 +1,52 @@ |
|||
#pragma once |
|||
|
|||
#include "DFTGate.h" |
|||
|
|||
namespace storm { |
|||
namespace storage { |
|||
|
|||
/*! |
|||
* AND gate. |
|||
* Fails if all children have failed. |
|||
*/ |
|||
template<typename ValueType> |
|||
class DFTAnd : public DFTGate<ValueType> { |
|||
|
|||
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 { |
|||
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; |
|||
} |
|||
} |
|||
// All children have failed |
|||
this->fail(state, queues); |
|||
} |
|||
} |
|||
|
|||
void checkFailsafe(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
|||
STORM_LOG_ASSERT(this->hasFailsafeChild(state), "No failsafe child."); |
|||
if(state.isOperational(this->mId)) { |
|||
if (state.isOperational(this->mId)) { |
|||
this->failsafe(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