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

Private GIT Repository
b9c598ae3c294d0dbe613552f5b69facb863184d
[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 #include "Exception.h"
14 class Exception;
15 using namespace std;
16 using namespace Qt;
17
18
19 class Graph {
20
21 public:
22   Graph();
23   ~Graph();
24
25   // getters  
26   inline GroupBlock* getTopGroup() { return topGroup; }
27   inline QList<GroupBlock*> getAllGroups() { return groups; }
28   
29   // methods for group blocks
30   GroupBlock* createChildGroupBlock(GroupBlock* parent);
31   void removeGroupBlock(GroupBlock *group);
32   GroupBlock* getGroupBlockByName(QString name);
33   
34   // methods for functional blocks
35   FunctionalBlock* createFunctionalBlock(GroupBlock *group, ReferenceBlock *ref);
36   FunctionalBlock* duplicateFunctionalBlock(FunctionalBlock *block);
37   bool removeFunctionalBlock(FunctionalBlock* block);
38   FunctionalBlock* getFunctionalBlockByName(QString name, GroupBlock* parent = NULL); //! if parent = NULL, search in the whole graph
39
40   // methods for source blocks
41   FunctionalBlock* createSourceBlock(ReferenceBlock *ref);
42   FunctionalBlock* duplicateSourceBlock(FunctionalBlock *block);
43   FunctionalBlock* getSourceBlockByName(QString name);
44   bool removeSourceBlock(FunctionalBlock* block);
45   
46   // others
47   QList<AbstractInterface *> getOutsideInterfaces();
48   /*!
49    * \brief createPatterns
50    * createPatterns() crosses the graph and for each functional block, it computes
51    * the consumptionPattern, the productionPattern, the production counter and delta
52    * using the parameters fo the block.
53    */
54   void createPatterns() throw(Exception);
55   void resetPatternComputed();
56   void computeOutputPatterns(int nbExec) throw(Exception);
57   
58   
59 private:  
60   GroupBlock* topGroup;
61   QList<GroupBlock *> groups; //! usefull to avoid recursive methods to find a particular group.
62   QList<FunctionalBlock*> sources; //! source for the top group
63
64 };
65
66 #endif // __GRAPH_H__