aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_pmp/LinkedQueue.h
blob: 84310efcced51a5e4ab4f09fbdb9252221c636d9 (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
32
33
34
35
36
37
38
39
40
41
#ifndef _LINKEDQUEUE_H_
#define _LINKEDQUEUE_H_

#include <windows.h>

class LinkedQueue;
class QueueElement;

class QueueElement {
public:
  QueueElement * next;
  QueueElement * prev;
  void * elem;
  QueueElement(void * e) { next=NULL; prev=NULL; elem=e; }
};


class LinkedQueue {
protected:
  QueueElement * head;
  QueueElement * tail;
  QueueElement * bm;
  int bmpos;
  int size;
  QueueElement * Find(int pos);
  CRITICAL_SECTION cs;
public:
  LinkedQueue();
  ~LinkedQueue();
  int GetSize();
  void Offer(void * e);
  void *Poll();
  void *Peek();
  void *Get(int pos);
  void Set(int pos, void * val);
  void *Del(int pos);
  void lock();
  void unlock();
};

#endif //_LINKEDQUEUE_H_