summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/Queue.h
blob: 4571272b3b7f4daea7f6b9c7beae034f3039a004 (plain) (blame)
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
#pragma once

template<class T>
class cDeleter 
{
	public:
		static void Delete(T) {};
};

template<class T, class D = cDeleter<T>>
class cQueue
{
public:
	cQueue(int warnsize);
	cQueue(cQueue<T>& queue);
	~cQueue();

	void EnqueueItem(T item);
	bool TryDequeueItem(T& item);
	T    DequeueItem();
	void BlockTillEmpty(cEvent CancelationEvent);
	void Clear();
	int  Size();
	
private:
	int warnsize;
	std::list<T> contents;
};

//template classes must be implemented in the header
#include "Queue.inc"