X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/8fb3c55ee009a11db5e1c08a4cfb286979412745..4327c2b8817b627249d98d889835726217c81a4e:/Graph.cpp diff --git a/Graph.cpp b/Graph.cpp index 4b22691..808dbda 100644 --- 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 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; }