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

Private GIT Repository
clkconvert OP compute done
[blast.git] / Graph.cpp
index 4b22691ff97492ba3bf853d1f49563ccf2b08479..808dbda2f18486c8e247651e4290cea3fdebd109 100644 (file)
--- a/Graph.cpp
+++ b/Graph.cpp
@@ -4,10 +4,8 @@
 #include "FunctionalBlock.h"
 #include "SpecialBlock.h"
 
-Graph::Graph(bool createTopGroupIface) {
-  topGroup = new GroupBlock(NULL, createTopGroupIface);
-  topGroup->setName("top group");
-  groups.append(topGroup);
+Graph::Graph() {
+  topGroup = NULL;
 }
 
 Graph::~Graph() {
@@ -15,12 +13,18 @@ Graph::~Graph() {
   delete topGroup;
 }
 
+void Graph::createTopGroup(bool createTopGroupIfaces) {
+  topGroup = new GroupBlock(this, NULL, createTopGroupIfaces);
+  topGroup->setName("top group");
+  groups.append(topGroup);
+}
+
 QList<AbstractInterface *> Graph::getOutsideInterfaces() {
   return topGroup->getInterfaces();
 }
 
 GroupBlock* Graph::createChildGroupBlock(GroupBlock* parent, bool createGroupIface) {
-  GroupBlock* b = new GroupBlock(parent, createGroupIface);
+  GroupBlock* b = new GroupBlock(this, parent, createGroupIface);
   groups.append(b);
   return b;
 }
@@ -43,10 +47,12 @@ FunctionalBlock* Graph::createFunctionalBlock(GroupBlock* group, ReferenceBlock*
 
   FunctionalBlock* newBlock = NULL;
   if (ref->getSpecialType() != -1) {
-    newBlock = new SpecialBlock(ref->getSpecialType(), group,ref, createIfaces);
+    cout << "Graph: create special block from " << qPrintable(ref->getName()) << endl;
+    newBlock = new SpecialBlock(this, ref->getSpecialType(), group,ref, createIfaces);
   }
   else {
-    newBlock = new FunctionalBlock(group,ref, createIfaces);
+    cout << "Graph: create normal block from " << qPrintable(ref->getName()) << endl;
+    newBlock = new FunctionalBlock(this, group,ref, createIfaces);
   }
   group->addBlock(newBlock);
 
@@ -87,7 +93,7 @@ FunctionalBlock* Graph::getFunctionalBlockByName(QString name, GroupBlock* paren
 FunctionalBlock* Graph::createStimuliBlock(ReferenceBlock* ref, bool createIfaces) {
   /* A stimuli block is always a special block with idSpecial = 1 */
 
-  FunctionalBlock* newBlock = new SpecialBlock(AbstractBlock::Source, NULL,ref, createIfaces);
+  FunctionalBlock* newBlock = new SpecialBlock(this, AbstractBlock::Source, NULL,ref, createIfaces);
   stimulis.append(newBlock);
   return newBlock;
 }