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, 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 void add_read_from(ModelAction *act);
40 void explore(thread_id_t tid);
44 std::vector< bool, MyAlloc<bool> > explored_children;
45 std::vector< bool, MyAlloc<bool> > backtrack;
48 /** The set of ModelActions that this the action at this Node may read
49 * from. Only meaningful if this Node represents a 'read' action. */
50 action_set_t may_read_from;
53 typedef std::list<class Node *, MyAlloc< class Node * > > node_list_t;
59 ModelAction * explore_action(ModelAction *act);
62 void reset_execution();
64 int get_total_nodes() { return total_nodes; }
70 node_list_t node_list;
71 node_list_t::iterator iter;
76 #endif /* __NODESTACK_H__ */