]> AND Private Git Repository - blast.git/blobdiff - GroupBlock.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
removed level attribute from interface
[blast.git] / GroupBlock.cpp
index 4ec7f6bbe45d717fc51620a545a9a3d6dc21d51e..74ec197086d458f9e7e0ddb3f2033c6aaba1bb8e 100644 (file)
@@ -40,9 +40,22 @@ void GroupBlock::setParent(AbstractBlock *_parent) {
     topGroup = false;
   }
 }
     topGroup = false;
   }
 }
+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) {
 
 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;
 }
 
 void GroupBlock::parametersValidation(QList<AbstractBlock *> *checkedBlocks, QList<AbstractBlock *> *blocksToConfigure) {
 }
 
 void GroupBlock::parametersValidation(QList<AbstractBlock *> *checkedBlocks, QList<AbstractBlock *> *blocksToConfigure) {