X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..8d3e09e430e829b9d847847334cbfe37790baca3:/AbstractBlock.cpp diff --git a/AbstractBlock.cpp b/AbstractBlock.cpp index 6e9cc86..c71b2e0 100644 --- a/AbstractBlock.cpp +++ b/AbstractBlock.cpp @@ -16,18 +16,8 @@ AbstractBlock::AbstractBlock(const QString& _name) { AbstractBlock::~AbstractBlock() { - foreach(AbstractInterface* iface, inputs) { - delete iface; - } - foreach(AbstractInterface* iface, outputs) { - delete iface; - } - foreach(AbstractInterface* iface, bidirs) { - delete iface; - } - inputs.clear(); - outputs.clear(); - bidirs.clear(); + removeAllInterfaces(); + foreach(BlockParameter* p, params) { delete p; } @@ -54,6 +44,21 @@ bool AbstractBlock::isGroupBlock() { return false; } +bool AbstractBlock::isTopGroupBlock() { + return false; +} + +bool AbstractBlock::isSourceBlock() { + return false; +} + +bool AbstractBlock::isGeneratorBlock() { + foreach(AbstractInterface* iface, inputs) { + if (iface->getPurpose() == AbstractInterface::Data) return false; + } + return true; +} + void AbstractBlock::addParameter(BlockParameter *param) { params.append(param); } @@ -90,6 +95,23 @@ void AbstractBlock::removeInterface(AbstractInterface *inter) { delete inter; } +void AbstractBlock::removeAllInterfaces() { + + foreach(AbstractInterface* iface, inputs) { + delete iface; + } + foreach(AbstractInterface* iface, outputs) { + delete iface; + } + foreach(AbstractInterface* iface, bidirs) { + delete iface; + } + inputs.clear(); + outputs.clear(); + bidirs.clear(); + +} + void AbstractBlock::defineBlockParam(BlockParameter *param) { cout << "definition of param : " << param->getName().toStdString() << endl; @@ -112,6 +134,36 @@ QList AbstractBlock::getInterfaces() { return list; } +QList AbstractBlock::getDataInputs() { + QList list; + foreach(AbstractInterface* iface, inputs) { + if (iface->getPurpose() == AbstractInterface::Data) { + list.append(iface); + } + } + return list; +} + +QList AbstractBlock::getControlInputs() { + QList list; + foreach(AbstractInterface* iface, inputs) { + if (iface->getPurpose() == AbstractInterface::Control) { + list.append(iface); + } + } + return list; +} + +QList AbstractBlock::getControlOutputs() { + QList list; + foreach(AbstractInterface* iface, outputs) { + if (iface->getPurpose() == AbstractInterface::Control) { + list.append(iface); + } + } + return list; +} + AbstractInterface* AbstractBlock::getIfaceFromName(QString name) { foreach(AbstractInterface* iface, inputs) {