Fix snapshot code
[c11tester.git] / scfence / patch.h
1 #ifndef _PATCH_H
2 #define _PATCH_H
3
4 #include "fence_common.h"
5 #include "inference.h"
6
7 class PatchUnit;
8 class Patch;
9
10 class PatchUnit {
11         private:
12         const ModelAction *act;
13         memory_order mo;
14
15         public:
16         PatchUnit(const ModelAction *act, memory_order mo) {
17                 this->act= act;
18                 this->mo = mo;
19         }
20
21         const ModelAction* getAct() {
22                 return act;
23         }
24
25         memory_order getMO() {
26                 return mo;
27         }
28
29         SNAPSHOTALLOC
30 };
31
32 class Patch {
33         private:
34         SnapVector<PatchUnit*> *units;
35
36         public:
37         Patch(const ModelAction *act, memory_order mo);
38
39         Patch(const ModelAction *act1, memory_order mo1, const ModelAction *act2,
40                 memory_order mo2);
41
42         Patch();
43
44         bool canStrengthen(Inference *curInfer);
45
46         bool isApplicable();
47
48         void addPatchUnit(const ModelAction *act, memory_order mo);
49
50         int getSize();
51
52         PatchUnit* get(int i);
53
54         void print();
55
56         SNAPSHOTALLOC
57 };
58
59 #endif