Add directories per analysis
[satune.git] / src / ASTAnalyses / Order / ordergraph.h
1 /*
2  * File:   ordergraph.h
3  * Author: hamed
4  *
5  * Created on August 7, 2017, 3:42 PM
6  */
7
8 #ifndef ORDERGRAPH_H
9 #define ORDERGRAPH_H
10 #include "classlist.h"
11 #include "structs.h"
12 #include "mymemory.h"
13
14 class OrderGraph {
15 public:
16         OrderGraph(Order *order);
17         ~OrderGraph();
18         void addOrderConstraintToOrderGraph(BooleanOrder *bOrder);
19         void addMustOrderConstraintToOrderGraph(BooleanOrder *bOrder);
20         OrderNode *getOrderNodeFromOrderGraph(uint64_t id);
21         OrderEdge *getOrderEdgeFromOrderGraph(OrderNode *begin, OrderNode *end);
22         OrderNode *lookupOrderNodeFromOrderGraph(uint64_t id);
23         OrderEdge *lookupOrderEdgeFromOrderGraph(OrderNode *begin, OrderNode *end);
24         void addOrderEdge(OrderNode *node1, OrderNode *node2, BooleanOrder *constr);
25         void addMustOrderEdge(OrderNode *node1, OrderNode *node2, BooleanOrder *constr);
26         OrderEdge *getInverseOrderEdge(OrderEdge *edge);
27         Order *getOrder() {return order;} 
28         bool isTherePath(OrderNode* source, OrderNode* destination);
29         bool isTherePathVisit(HashsetOrderNode &visited, OrderNode* current, OrderNode* destination);
30         SetIteratorOrderNode *getNodes() {return nodes->iterator();}
31         SetIteratorOrderEdge *getEdges() {return edges->iterator();}
32
33         CMEMALLOC;
34 private:
35         HashsetOrderNode *nodes;
36         HashsetOrderEdge *edges;
37         Order *order;
38 };
39
40 OrderGraph *buildOrderGraph(Order *order);
41 OrderGraph *buildMustOrderGraph(Order *order);
42 #endif/* ORDERGRAPH_H */
43