#pragma once #include "DFTGate.h" namespace storm { namespace storage { /*! * AND gate. * Fails if all children have failed. */ template class DFTAnd : public DFTGate { public: /*! * Constructor. * @param id Id. * @param name Name. * @param children Children. */ DFTAnd(size_t id, std::string const& name, std::vector>> const& children = {}) : DFTGate(id, name, children) { // Intentionally empty } DFTElementType type() const override { return DFTElementType::AND; } void checkFails(storm::storage::DFTState& state, DFTStateSpaceGenerationQueues& queues) const override { 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& state, DFTStateSpaceGenerationQueues& queues) const override { STORM_LOG_ASSERT(this->hasFailsafeChild(state), "No failsafe child."); if (state.isOperational(this->mId)) { this->failsafe(state, queues); this->childrenDontCare(state, queues); } } }; } }