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

Private GIT Repository
started to include patterns in implementation
[blast.git] / Graph.h
1 #ifndef __GRAPH_H__
2 #define __GRAPH_H__
3
4 #include <iostream>
5
6 #include <QtCore>
7 #include <QtGui>
8
9 class GroupBlock;
10 class ReferenceBlock;
11 class FunctionalBlock;
12 class AbstractInterface;
13
14 using namespace std;
15 using namespace Qt;
16
17
18 class Graph {
19
20 public:
21   Graph();
22   ~Graph();
23
24   // getters  
25   inline GroupBlock* getTopGroup() { return topGroup; }
26   inline QList<GroupBlock*> getAllGroups() { return groups; }
27   
28   // methods for group blocks
29   GroupBlock* createChildGroupBlock(GroupBlock* parent);
30   bool removeGroupBlock(GroupBlock *group);
31   GroupBlock* getGroupBlockByName(QString name);
32   
33   // methods for functional blocks
34   FunctionalBlock* createFunctionalBlock(GroupBlock *group, ReferenceBlock *ref);
35   FunctionalBlock* duplicateFunctionalBlock(FunctionalBlock *block);
36   bool removeFunctionalBlock(FunctionalBlock* block);
37   FunctionalBlock* getFunctionalBlockByName(QString name, GroupBlock* parent = NULL); //! if parent = NULL, search in the whole graph
38
39   // methods for source blocks
40   FunctionalBlock* createSourceBlock(ReferenceBlock *ref);
41   FunctionalBlock* duplicateSourceBlock(FunctionalBlock *block);
42   FunctionalBlock* getSourceBlockByName(QString name);
43   bool removeSourceBlock(FunctionalBlock* block);
44   
45   // others
46   QList<AbstractInterface *> getOutsideInterfaces();  
47   
48   
49 private:  
50   GroupBlock* topGroup;
51   QList<GroupBlock *> groups; //! usefull to avoid recursive methods to find a particular group.
52   QList<FunctionalBlock*> sources; //! source for the top group
53
54 };
55
56 #endif // __GRAPH_H__