if (tonode != rmwnode) {
rmwnode->addEdge(tonode);
}
+ tonode->refcount--;
}
fromnode->edges.clear();
CycleNode::CycleNode(const ModelAction *act) :
action(act),
hasRMW(NULL),
- cv(new ClockVector(NULL, act))
+ cv(new ClockVector(NULL, act)),
+ refcount(0)
{
}
return edges.size();
}
-/**
- * @brief Remove a (forward) edge from this CycleNode
- * @return The CycleNode which was popped, if one exists; otherwise NULL
- */
-CycleNode * CycleNode::removeEdge()
-{
- if (edges.empty())
- return NULL;
-
- CycleNode *ret = edges.back();
- edges.pop_back();
- return ret;
-}
-
/**
* Adds an edge from this CycleNode to another CycleNode.
* @param node The node to which we add a directed edge
if (edges[i] == node)
return;
edges.push_back(node);
+ node->refcount++;
}
/** @returns the RMW CycleNode that reads from the current CycleNode */
void addEdge(CycleNode *node);
CycleNode * getEdge(unsigned int i) const;
unsigned int getNumEdges() const;
- CycleNode * removeEdge();
bool setRMW(CycleNode *);
CycleNode * getRMW() const;
void clearRMW() { hasRMW = NULL; }
/** ClockVector for this Node. */
ClockVector *cv;
friend class CycleGraph;
+
+ /** @brief Reference count to node. */
+ int refcount;
};
#endif /* __CYCLEGRAPH_H__ */