model: add iteration routines for class Backtrack
authorBrian Norris <banorris@uci.edu>
Fri, 20 Apr 2012 17:35:16 +0000 (10:35 -0700)
committerBrian Norris <banorris@uci.edu>
Fri, 20 Apr 2012 17:35:16 +0000 (10:35 -0700)
model.h

diff --git a/model.h b/model.h
index 54144f38fc322df9a79edf2e8d0c542f25d027d8..db1360124eb9f6da159ac0182ea247a34f25dc6a 100644 (file)
--- a/model.h
+++ b/model.h
@@ -49,15 +49,19 @@ public:
        Backtrack(ModelAction *d, action_list_t *t) {
                diverge = d;
                actionTrace = t;
-               //currentIterator = actionTrace->getFirst();
+               iter = actionTrace->begin();
        }
        ModelAction *get_diverge() { return diverge; }
        action_list_t *get_trace() { return actionTrace; }
+       void advance_state() { iter++; }
+       ModelAction *get_state() {
+               return iter == actionTrace->end() ? NULL : *iter;
+       }
 private:
        ModelAction *diverge;
-       /* unused for now; will be used when re-exploring this path? */
-       //MyListElement *currentIterator;
        action_list_t *actionTrace;
+       /* points to position in actionTrace as we replay */
+       action_list_t::iterator iter;
 };
 
 class ModelChecker {