systemc-clang 2.0.0
Parsing SystemC constructs
Loading...
Searching...
No Matches
Automata.h
Go to the documentation of this file.
1#ifndef _AUTOMATA_H_
2#define _AUTOMATA_H_
3
4#include "clang/AST/DeclCXX.h"
5#include "clang/AST/Expr.h"
6#include "clang/AST/ParentMap.h"
7#include "clang/AST/PrettyPrinter.h"
8#include "clang/Analysis/CFG.h"
9#include "clang/Analysis/CFGStmtMap.h"
10#include "llvm/Support/raw_ostream.h"
11#include <deque>
12#include <map>
13#include <stdio.h>
14#include <vector>
15namespace systemc_clang {
16using namespace clang;
17using namespace std;
18
19class Node {
20public:
21 typedef pair<int, Node *> connectPairType;
22 typedef map<int, Node *> connectMapType;
23
24 Node();
25 Node(int);
26
27 void addSuccessor(Node *);
28 void addPredecessor(Node *);
29
30 vector<int> getSuccessors(int);
31 vector<int> getPredecessors(int);
32 int getId();
33
34 void dump(raw_ostream &, int);
35
36protected:
37 int _id;
40};
41
42class Edge {
43public:
44 typedef pair<unsigned int, unsigned int> timePairType;
45 typedef vector<timePairType> timeAdvanceVectorType;
46
47 Edge(Node *, Node *);
48 Edge(Node *, Node *, int);
49
51
52 int getId();
53 int getToId();
54 int getFromId();
56
57 void dump(raw_ostream &, int);
58
59protected:
60 int _id;
64};
65
66class Graph {
67public:
68 typedef vector<int> nodeIDVector;
69 typedef vector<int> edgeIDVector;
70
71 typedef vector<Node *> nodeVector;
72 typedef vector<Edge *> edgeVector;
73
74 typedef map<int, Node *> nodeMapType;
75 typedef pair<int, Node *> nodePairType;
76
77 typedef map<int, Edge *> edgeMapType;
78 typedef pair<int, Edge *> edgePairType;
79
80 typedef pair<int, int> twoNodePairType;
81
82 typedef pair<twoNodePairType, Edge *> adjPairType;
83 typedef map<twoNodePairType, Edge *> adjMapType;
84
85 typedef pair<int, vector<Edge *>> adjEdgesPairType;
86 typedef map<int, vector<Edge *>> adjEdgesMapType;
87
88 Graph();
89 ~Graph();
90
91 Node *addNode();
92 Node *addNode(int);
93 Edge *addEdge(Node *, Node *);
94 Edge *addEdge(int, int);
95
96 int getEdgeID(Edge *);
97 int getEdgeID(Node *, Node *);
98 int getEdgeID(int, int);
99 int getNodeID(Node *);
100
101 Edge *getEdge(Node *, Node *);
102 Edge *getEdge(int, int);
103 Node *getNode(int);
104
105 vector<Edge *> getEdgesFromSource(int);
106 vector<Edge *> getEdgesFromSource(Node *);
107 vector<Edge *> getEdgesFromDest(int);
108 vector<Edge *> getEdgesFromDest(Node *);
109
117
118 void dump(raw_ostream &, int tabn = 0);
119 void dumpSauto(raw_ostream &, int tabn = 0);
120
121protected:
132};
133} // namespace systemc_clang
134#endif
Edge(Node *, Node *)
Edge class.
Definition Automata.cpp:63
timeAdvanceVectorType _timeAdvanceVector
Definition Automata.h:61
vector< timePairType > timeAdvanceVectorType
Definition Automata.h:45
void dump(raw_ostream &, int)
Definition Automata.cpp:73
void updateSuspensionTime(timePairType)
Definition Automata.cpp:67
timeAdvanceVectorType getTimeAdvanceVector()
Definition Automata.cpp:81
pair< unsigned int, unsigned int > timePairType
Definition Automata.h:44
void dump(raw_ostream &, int tabn=0)
Definition Automata.cpp:270
int getNodeID(Node *)
Definition Automata.cpp:162
edgeVector returnEdgeVector()
Definition Automata.cpp:395
edgeVector returnEdges()
vector< Edge * > getEdgesFromSource(int)
Definition Automata.cpp:226
Edge * addEdge(Node *, Node *)
Definition Automata.cpp:110
int getEdgeID(Edge *)
Definition Automata.cpp:172
edgeVector _edgeVector
Definition Automata.h:131
pair< int, vector< Edge * > > adjEdgesPairType
Definition Automata.h:85
pair< int, Node * > nodePairType
Definition Automata.h:75
vector< Node * > nodeVector
Definition Automata.h:71
void dumpSauto(raw_ostream &, int tabn=0)
Definition Automata.cpp:305
adjEdgesMapType _adjEdges
Definition Automata.h:125
edgeIDVector _edgeIDVector
Definition Automata.h:129
map< twoNodePairType, Edge * > adjMapType
Definition Automata.h:83
vector< int > nodeIDVector
Definition Automata.h:68
vector< Edge * > edgeVector
Definition Automata.h:72
map< int, vector< Edge * > > adjEdgesMapType
Definition Automata.h:86
pair< twoNodePairType, Edge * > adjPairType
Definition Automata.h:82
map< int, Node * > nodeMapType
Definition Automata.h:74
Node * getNode(int)
Definition Automata.cpp:218
Edge * getEdge(Node *, Node *)
Definition Automata.cpp:208
nodeVector returnNodes()
pair< int, int > twoNodePairType
Definition Automata.h:80
edgeMapType _edgeMap
Definition Automata.h:124
adjMapType returnAdjList()
Definition Automata.cpp:387
adjMapType _adjList
Definition Automata.h:122
vector< Edge * > getEdgesFromDest(int)
Definition Automata.cpp:239
map< int, Edge * > edgeMapType
Definition Automata.h:77
edgeIDVector returnEdgeIDs()
Definition Automata.cpp:391
nodeVector returnNodeVector()
Definition Automata.cpp:393
vector< int > edgeIDVector
Definition Automata.h:69
pair< int, Edge * > edgePairType
Definition Automata.h:78
Graph()
Graph class.
Definition Automata.cpp:88
nodeVector _nodeVector
Definition Automata.h:130
nodeIDVector returnNodeIDs()
Definition Automata.cpp:389
nodeIDVector _nodeIDVector
Definition Automata.h:128
nodeMapType _nodeMap
Definition Automata.h:123
void addPredecessor(Node *)
Definition Automata.cpp:18
pair< int, Node * > connectPairType
Definition Automata.h:21
connectMapType _preds
Definition Automata.h:38
connectMapType _succs
Definition Automata.h:39
vector< int > getSuccessors(int)
Definition Automata.cpp:22
void dump(raw_ostream &, int)
Definition Automata.cpp:46
map< int, Node * > connectMapType
Definition Automata.h:22
vector< int > getPredecessors(int)
Definition Automata.cpp:34
void addSuccessor(Node *)
Definition Automata.cpp:13
Node()
Node class.
Definition Automata.cpp:7
Clang forward declarations.
Definition FindArgument.h:6