|
|
@ -1,24 +1,28 @@ |
|
|
|
#pragma once |
|
|
|
|
|
|
|
|
|
|
|
#include "DFTGate.h" |
|
|
|
|
|
|
|
namespace storm { |
|
|
|
namespace storage { |
|
|
|
|
|
|
|
|
|
|
|
/*! |
|
|
|
* SPARE gate. |
|
|
|
*/ |
|
|
|
template<typename ValueType> |
|
|
|
class DFTSpare : public DFTGate<ValueType> { |
|
|
|
|
|
|
|
public: |
|
|
|
DFTSpare(size_t id, std::string const& name, std::vector<std::shared_ptr<DFTElement<ValueType>>> const& children = {}) : |
|
|
|
DFTGate<ValueType>(id, name, children) |
|
|
|
{} |
|
|
|
|
|
|
|
std::string typestring() const override { |
|
|
|
return "SPARE"; |
|
|
|
/*! |
|
|
|
* Constructor. |
|
|
|
* @param id Id. |
|
|
|
* @param name Name. |
|
|
|
* @param children Children. |
|
|
|
*/ |
|
|
|
DFTSpare(size_t id, std::string const& name, std::vector<std::shared_ptr<DFTElement<ValueType>>> const& children = {}) : DFTGate<ValueType>(id, name, children) { |
|
|
|
// Intentionally left empty. |
|
|
|
} |
|
|
|
|
|
|
|
virtual DFTElementType type() const override { |
|
|
|
DFTElementType type() const override { |
|
|
|
return DFTElementType::SPARE; |
|
|
|
} |
|
|
|
|
|
|
@ -26,12 +30,12 @@ namespace storm { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
void fail(DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const { |
|
|
|
void fail(DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
|
|
|
DFTGate<ValueType>::fail(state, queues); |
|
|
|
state.finalizeUses(this->mId); |
|
|
|
} |
|
|
|
|
|
|
|
void failsafe(DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const { |
|
|
|
void failsafe(DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const override { |
|
|
|
DFTGate<ValueType>::failsafe(state, queues); |
|
|
|
state.finalizeUses(this->mId); |
|
|
|
} |
|
|
@ -48,7 +52,7 @@ namespace storm { |
|
|
|
if (state.isOperational(this->mId)) { |
|
|
|
size_t uses = state.uses(this->mId); |
|
|
|
if (!state.isOperational(uses)) { |
|
|
|
bool claimingSuccessful = state.claimNew(this->mId, uses, this->mChildren); |
|
|
|
bool claimingSuccessful = state.claimNew(this->mId, uses, this->children()); |
|
|
|
if (!claimingSuccessful) { |
|
|
|
this->fail(state, queues); |
|
|
|
} |
|
|
@ -74,7 +78,7 @@ namespace storm { |
|
|
|
std::set<size_t> unit(prelRes.begin(), prelRes.end()); |
|
|
|
std::vector<size_t> pids = this->parentIds(); |
|
|
|
if (!sparesAsLeaves) { |
|
|
|
for(auto const& child : this->mChildren) { |
|
|
|
for (auto const& child : this->children()) { |
|
|
|
child->extendSubDft(unit, pids, blockParents, sparesAsLeaves); |
|
|
|
if (unit.empty()) { |
|
|
|
// Parent in the subdft, ie it is *not* a subdft |
|
|
@ -93,7 +97,7 @@ namespace storm { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!sparesAsLeaves) { |
|
|
|
for(auto const& child : this->mChildren) { |
|
|
|
for (auto const& child : this->children()) { |
|
|
|
child->extendSubDft(elemsInSubtree, parentsOfSubRoot, blockParents, sparesAsLeaves); |
|
|
|
if (elemsInSubtree.empty()) { |
|
|
|
// Parent in the subdft, ie it is *not* a subdft |
|
|
@ -102,8 +106,6 @@ namespace storm { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|