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

Private GIT Repository
adding save to gitignore
[blast.git] / Graph.cpp
1 #include "Graph.h"
2 #include "GroupBlock.h"
3 #include "ReferenceBlock.h"
4 #include "FunctionalBlock.h"
5
6 Graph::Graph() {
7   topGroup = new GroupBlock(NULL);
8   topGroup->setName("top group");
9 }
10
11 Graph::~Graph() {
12   delete topGroup;
13 }
14
15 QList<AbstractInterface *> Graph::getOutsideInterfaces() {
16   return topGroup->getInterfaces();
17 }
18
19 GroupBlock* Graph::createChildBlock(GroupBlock* parent) {
20   GroupBlock* b = new GroupBlock(parent);
21   return b;
22 }
23
24 FunctionalBlock* Graph::addFunctionalBlock(GroupBlock* group, ReferenceBlock* ref) {
25
26   FunctionalBlock* newBlock = new FunctionalBlock(group,ref);
27   newBlock->populate();
28   group->addBlock(newBlock);
29
30   return newBlock;
31 }
32
33 bool Graph::removeFunctionalBlock(FunctionalBlock* block, GroupBlock *group) {
34   group->removeBlock(block);
35 }
36
37 bool Graph::removeGroupBlock(GroupBlock *group) {
38   group->removeAllBlocks();
39   GroupBlock* parent = AB_TO_GRP(group->getParent());
40   parent->removeBlock(group);
41 }