cyclegraph: edit template for addEdge
[model-checker.git] / cyclegraph.h
index f03c4ecf33496314387d99c28f19dc80f3839e27..9fc789c1913edd590f59c497f6cee1ff0b59eff2 100644 (file)
@@ -130,4 +130,28 @@ class CycleNode {
        CycleNode *hasRMW;
 };
 
+/*
+ * @brief Adds an edge between objects
+ *
+ * This function will add an edge between any two objects which can be
+ * associated with a CycleNode. That is, if they have a CycleGraph::getNode
+ * implementation.
+ *
+ * The object to is ordered after the object from.
+ *
+ * @param to The edge points to this object, of type T
+ * @param from The edge comes from this object, of type U
+ */
+template <typename T, typename U>
+void CycleGraph::addEdge(const T from, const U to)
+{
+       ASSERT(from);
+       ASSERT(to);
+
+       CycleNode *fromnode = getNode(from);
+       CycleNode *tonode = getNode(to);
+
+       addNodeEdge(fromnode, tonode);
+}
+
 #endif /* __CYCLEGRAPH_H__ */