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

Private GIT Repository
added admittance computation
[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    * \brief initPatterns
49    * initPatterns() crosses the graph and for each functional block, it computes
50    * the consumptionPattern, the productionPattern, the production counter and delta
51    * using the parameters fo the block.
52    */
53   bool createPatterns();
54   void resetPatternComputed();
55   bool computeOutputPatterns(int nbExec);
56   
57   
58 private:  
59   GroupBlock* topGroup;
60   QList<GroupBlock *> groups; //! usefull to avoid recursive methods to find a particular group.
61   QList<FunctionalBlock*> sources; //! source for the top group
62
63 };
64
65 #endif // __GRAPH_H__