summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/quicklist.h
blob: 66bb070c6ca16c552d68172c7a9d6e35ca546e12 (plain)
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
template <class T>
class QuickList
{
private:
	struct Item
	{
		T data;
		Item *prev, *next;
	};
	struct CacheItem
	{
		CacheItem(): item(0), no(0) {}
		Item *item;
		int no;
	};
	Item *head, *tail;
	int cacheSize, cacheStep, cacheUsed;
	CacheItem *cache;
	CacheItem last;

public:
	QuickList(int theCacheSize = 100, int theCacheStep = )
	{
		head = tail = 0;
		cacheSize = theCacheSize;
		cacheStep = theCacheStep;
		cacheUsed = 0;
		cache = new CacheItem[cacheSize];
	}
	~QuickList()
	{
		delete [] cache;
	}
};