X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..cfe8322b50c9ef08ffbc3e52b0849bca4cd1d0bf:/GroupBlock.cpp diff --git a/GroupBlock.cpp b/GroupBlock.cpp index 4ec7f6b..716cea6 100644 --- a/GroupBlock.cpp +++ b/GroupBlock.cpp @@ -34,6 +34,10 @@ bool GroupBlock::isGroupBlock() { return true; } +bool GroupBlock::isTopGroupBlock() { + return topGroup; +} + void GroupBlock::setParent(AbstractBlock *_parent) { parent = _parent; if (parent != NULL) { @@ -41,8 +45,31 @@ void GroupBlock::setParent(AbstractBlock *_parent) { } } +void GroupBlock::removeAllBlocks() { + foreach(AbstractBlock* block, blocks) { + if (block->isGroupBlock()) { + GroupBlock* group = AB_TO_GRP(block); + group->removeAllBlocks(); + } + removeBlock(block); + } +} + void GroupBlock::removeBlock(AbstractBlock* block) { - blocks.removeAll(block); + /* CAUTION: no check is done if the block has connected interface + or not. Thus, they must be deleted elsewhere. + */ + blocks.removeAll(block); + delete block; +} + +AbstractBlock *GroupBlock::getFunctionalBlockByName(QString name) { + foreach(AbstractBlock* block, blocks) { + if (block->isFunctionalBlock()) { + if (block->getName() == name) return block; + } + } + return NULL; } void GroupBlock::parametersValidation(QList *checkedBlocks, QList *blocksToConfigure) { @@ -76,3 +103,20 @@ void GroupBlock::removeGenericParameter(QString name) { BlockParameter* p = getParameterFromName(name); if (p != NULL) params.removeAll(p); } + +void GroupBlock::initInputPattern() { + foreach(AbstractInterface* iface, getControlInputs()) { + iface->setOutputPattern(iface->getConnectedFrom()->getOutputPattern()); + } +} + +void GroupBlock::computeOutputPattern(int nbExec) { + + // get the input pattern on each inputs + initInputPattern(); + // find blocks that are connected to that inputs + + foreach(AbstractInterface* iface, getControlOutputs()) { + iface->setOutputPattern(iface->getConnectedFrom()->getOutputPattern()); + } +}