From: Brian Norris Date: Sat, 2 Feb 2013 01:47:57 +0000 (-0800) Subject: cyclegraph: template-ize checkReachable() X-Git-Tag: oopsla2013~298 X-Git-Url: http://demsky.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=776fc7207dec4959b4fa3e4bd7cb71cc38a19353 cyclegraph: template-ize checkReachable() ModelChecker will need to query the mo_graph regarding the modification order of promised future writes. --- diff --git a/cyclegraph.cc b/cyclegraph.cc index 46b0d4a..54b9123 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -275,12 +275,13 @@ void CycleGraph::dumpGraphToFile(const char *filename) const #endif /** - * Checks whether one ModelAction can reach another. + * Checks whether one ModelAction can reach another ModelAction/Promise * @param from The ModelAction from which to begin exploration - * @param to The ModelAction to reach + * @param to The ModelAction or Promise to reach * @return True, @a from can reach @a to; otherwise, false */ -bool CycleGraph::checkReachable(const ModelAction *from, const ModelAction *to) const +template +bool CycleGraph::checkReachable(const ModelAction *from, const T *to) const { CycleNode *fromnode = actionToNode.get(from); CycleNode *tonode = actionToNode.get(to); diff --git a/cyclegraph.h b/cyclegraph.h index c0bd7d6..c9c575a 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -33,7 +33,10 @@ class CycleGraph { bool checkForCycles() const; void addRMWEdge(const ModelAction *from, const ModelAction *rmw); bool checkPromise(const ModelAction *from, Promise *p) const; - bool checkReachable(const ModelAction *from, const ModelAction *to) const; + + template + bool checkReachable(const ModelAction *from, const T *to) const; + void startChanges(); void commitChanges(); void rollbackChanges();