-
Notifications
You must be signed in to change notification settings - Fork 0
/
actionlist.h
55 lines (45 loc) · 1019 Bytes
/
actionlist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef ACTIONLIST_H
#define ACTIONLIST_H
#include "classlist.h"
#include "stl-model.h"
#define ISACT ((uintptr_t) 1ULL)
#define ACTMASK (~ISACT)
#define ALLBITS 4
#define ALLNODESIZE (1 << ALLBITS)
#define ALLMASK ((1 << ALLBITS)-1)
#define MODELCLOCKBITS 32
class allnode;
void decrementCount(allnode *);
class allnode {
public:
allnode();
~allnode();
SNAPSHOTALLOC;
private:
allnode * parent;
allnode * children[ALLNODESIZE];
int count;
sllnode<ModelAction *> * findPrev(modelclock_t index);
friend class actionlist;
friend void decrementCount(allnode *);
};
class actionlist {
public:
actionlist();
~actionlist();
void addAction(ModelAction * act);
void removeAction(ModelAction * act);
void clear();
bool isEmpty();
uint size() {return _size;}
sllnode<ModelAction *> * begin() {return head;}
sllnode<ModelAction *> * end() {return tail;}
void fixupParent();
SNAPSHOTALLOC;
private:
allnode root;
sllnode<ModelAction *> * head;
sllnode<ModelAction* > * tail;
uint _size;
};
#endif