From: Brian Norris Date: Tue, 5 Feb 2013 00:24:36 +0000 (-0800) Subject: cyclegraph: edit template for checkReachable X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=ff29187c639cdb032debdb036d2c9062f77879b0;ds=sidebyside cyclegraph: edit template for checkReachable --- diff --git a/cyclegraph.cc b/cyclegraph.cc index 16990b90..d2a032ef 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -265,24 +265,6 @@ void CycleGraph::dumpGraphToFile(const char *filename) const } #endif -/** - * 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 -bool CycleGraph::checkReachable(const ModelAction *from, const T *to) const -{ - CycleNode *fromnode = actionToNode.get(from); - CycleNode *tonode = actionToNode.get(to); - - if (!fromnode || !tonode) - return false; - - return checkReachable(fromnode, tonode); -} - /** * Checks whether one CycleNode can reach another. * @param from The CycleNode from which to begin exploration diff --git a/cyclegraph.h b/cyclegraph.h index 9fc789c1..83d3db21 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -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 +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__ */