2 * @brief Stack of operations for use in backtracking.
5 #ifndef __NODESTACK_H__
6 #define __NODESTACK_H__
17 typedef std::set< ModelAction *, std::less< ModelAction *>, MyAlloc< ModelAction * > > action_set_t;
21 Node(ModelAction *act = NULL, Node *par = NULL, int nthreads = 1);
23 /* return true = thread choice has already been explored */
24 bool has_been_explored(thread_id_t tid);
25 /* return true = backtrack set is empty */
26 bool backtrack_empty();
27 void explore_child(ModelAction *act);
28 /* return false = thread was already in backtrack */
29 bool set_backtrack(thread_id_t id);
30 thread_id_t get_next_backtrack();
31 bool is_enabled(Thread *t);
32 ModelAction * get_action() { return action; }
34 /** @return the parent Node to this Node; that is, the action that
35 * occurred previously in the stack. */
36 Node * get_parent() const { return parent; }
38 void add_read_from(ModelAction *act);
44 void explore(thread_id_t tid);
49 std::vector< bool, MyAlloc<bool> > explored_children;
50 std::vector< bool, MyAlloc<bool> > backtrack;
53 /** The set of ModelActions that this the action at this Node may read
54 * from. Only meaningful if this Node represents a 'read' action. */
55 action_set_t *may_read_from;
58 typedef std::list<class Node *, MyAlloc< class Node * > > node_list_t;
64 ModelAction * explore_action(ModelAction *act);
67 void reset_execution();
69 int get_total_nodes() { return total_nodes; }
75 node_list_t node_list;
76 node_list_t::iterator iter;
81 #endif /* __NODESTACK_H__ */