clean up header #includes
[c11tester.git] / action.h
1 #ifndef __ACTION_H__
2 #define __ACTION_H__
3
4 #include <list>
5
6 #include "libthreads.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 (tree.h) */
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
32         TreeNode * get_node() { return node; }
33         void set_node(TreeNode *n) { node = n; }
34
35         bool is_read();
36         bool is_write();
37         bool is_acquire();
38         bool is_release();
39         bool same_var(ModelAction *act);
40         bool same_thread(ModelAction *act);
41         bool is_dependent(ModelAction *act);
42 private:
43         action_type type;
44         memory_order order;
45         void *location;
46         thread_id_t tid;
47         int value;
48         TreeNode *node;
49 };
50
51 typedef std::list<class ModelAction *> action_list_t;
52
53 #endif /* __ACTION_H__ */