cyclegraph: edit template for checkReachable
[model-checker.git] / cyclegraph.h
index 9fc789c1913edd590f59c497f6cee1ff0b59eff2..83d3db21d77cdfc192f0bd286d21fee188de7fac 100644 (file)
@@ -154,4 +154,22 @@ void CycleGraph::addEdge(const T from, const U to)
        addNodeEdge(fromnode, tonode);
 }
 
+/**
+ * Checks whether one ModelAction can reach another ModelAction/Promise
+ * @param from The ModelAction from which to begin exploration
+ * @param to The ModelAction or Promise to reach
+ * @return True, @a from can reach @a to; otherwise, false
+ */
+template <typename T>
+bool CycleGraph::checkReachable(const ModelAction *from, const T *to) const
+{
+       CycleNode *fromnode = getNode_noCreate(from);
+       CycleNode *tonode = getNode_noCreate(to);
+
+       if (!fromnode || !tonode)
+               return false;
+
+       return checkReachable(fromnode, tonode);
+}
+
 #endif /* __CYCLEGRAPH_H__ */