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

Private GIT Repository
58690c9761def608401ec1b8ccc80ce6ef4e9e89
[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(bool createTopGroupIface = true);
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, bool createGroupIface = true);
31   void removeGroupBlock(GroupBlock *group);
32   GroupBlock* getGroupBlockByName(QString name);
33   
34   // methods for functional blocks
35   FunctionalBlock* createFunctionalBlock(GroupBlock *group, ReferenceBlock *ref, bool createIfaces = true);
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 stimulis blocks
41   FunctionalBlock* createStimuliBlock(ReferenceBlock *ref, bool createIfaces = true);
42   FunctionalBlock* duplicateStimuliBlock(FunctionalBlock *block);
43   FunctionalBlock* getStimuliBlockByName(QString name);
44   bool removeStimuliBlock(FunctionalBlock* block);
45   
46   // others
47   QList<AbstractInterface *> getOutsideInterfaces();
48   QList<QString> getExternalResources(); // returns the list of all external files needed for VHDL generation
49
50   /*!
51    * \brief createPatterns
52    * createPatterns() crosses the graph and for each functional block, it computes
53    * the consumptionPattern, the productionPattern, the production counter and delta
54    * using the parameters fo the block.
55    */
56   void createPatterns() throw(Exception);
57   void resetPatternComputed();
58   void computeOutputPatterns(int nbExec) throw(Exception);
59   
60   void generateVHDL(const QString& path) throw(Exception);
61
62 private:  
63   GroupBlock* topGroup;
64   QList<GroupBlock *> groups; //! usefull to avoid recursive methods to find a particular group.
65   QList<FunctionalBlock*> stimulis; //! source for the top group
66
67 };
68
69 #endif // __GRAPH_H__