straighten out header includes, comment on Forward declarations
[model-checker.git] / action.h
1 #ifndef __ACTION_H__
2 #define __ACTION_H__
3
4 #include <list>
5
6 #include "threads.h"
7 #include "libatomic.h"
8
9 #define VALUE_NONE -1
10
11 typedef enum action_type {
12         THREAD_CREATE,
13         THREAD_YIELD,
14         THREAD_JOIN,
15         ATOMIC_READ,
16         ATOMIC_WRITE
17 } action_type_t;
18
19 /* Forward declaration */
20 class TreeNode;
21
22 class ModelAction {
23 public:
24         ModelAction(action_type_t type, memory_order order, void *loc, int value);
25         void print(void);
26
27         thread_id_t get_tid() { return tid; }
28         action_type get_type() { return type; }
29         memory_order get_mo() { return order; }
30         void * get_location() { return location; }
31         int get_seq_number() { return seq_number; }
32
33         TreeNode * get_node() { return node; }
34         void set_node(TreeNode *n) { node = n; }
35
36         bool is_read();
37         bool is_write();
38         bool is_acquire();
39         bool is_release();
40         bool same_var(ModelAction *act);
41         bool same_thread(ModelAction *act);
42         bool is_dependent(ModelAction *act);
43 private:
44         action_type type;
45         memory_order order;
46         void *location;
47         thread_id_t tid;
48         int value;
49         TreeNode *node;
50         int seq_number;
51 };
52
53 typedef std::list<class ModelAction *> action_list_t;
54
55 #endif /* __ACTION_H__ */