hasCycles=false;
}
+CycleGraph::~CycleGraph() {
+}
+
/** Returns the CycleNode for a given ModelAction. */
-CycleNode * CycleGraph::getNode(ModelAction * action) {
+CycleNode * CycleGraph::getNode(const ModelAction * action) {
CycleNode *node=actionToNode.get(action);
if (node==NULL) {
node=new CycleNode(action);
}
/** Adds an edge between two ModelActions. */
-void CycleGraph::addEdge(ModelAction *from, ModelAction *to) {
+void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) {
CycleNode *fromnode=getNode(from);
CycleNode *tonode=getNode(to);
if (!hasCycles) {
}
/** Constructor for a CycleNode. */
-CycleNode::CycleNode(ModelAction *modelaction) {
+CycleNode::CycleNode(const ModelAction *modelaction) {
action=modelaction;
}
class CycleGraph {
public:
CycleGraph();
- void addEdge(ModelAction *from, ModelAction *to);
+ ~CycleGraph();
+ void addEdge(const ModelAction *from, const ModelAction *to);
bool checkForCycles();
private:
- CycleNode * getNode(ModelAction *);
- HashTable<ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
+ CycleNode * getNode(const ModelAction *);
+ HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
bool checkReachable(CycleNode *from, CycleNode *to);
bool hasCycles;
-
};
class CycleNode {
public:
- CycleNode(ModelAction *action);
+ CycleNode(const ModelAction *action);
void addEdge(CycleNode * node);
std::vector<CycleNode *> * getEdges();
private:
- ModelAction *action;
+ const ModelAction *action;
std::vector<CycleNode *> edges;
};