#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() {
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;
}
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);
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;
}