-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.h
More file actions
39 lines (36 loc) · 747 Bytes
/
queue.h
File metadata and controls
39 lines (36 loc) · 747 Bytes
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
// queue.h -- interface for a queue
#ifndef QUEUE_H_
#define QUEUE_H_
class Customer
{
private:
long arrive;
int processtime;
public:
Customer() { arrive = processtime = 0; }
void set (long when);
long when() const { return arrive; };
int ptime() const { return processtime; };
};
typedef Customer Item;
class Queue
{
private:
struct Node { Item item; struct Node * next; };
enum {Q_SIZE = 10};
Node * front;
Node * rear;
int items;
const int qsize;
Queue (const Queue & q): qsize(0) { }
Queue & operator= (const Queue & q) { return *this; }
public:
Queue (int qs = Q_SIZE);
~Queue();
bool isempty() const;
bool isfull() const;
int queuecount() const;
bool enqueue (const Item & item);
bool dequeue (Item & item);
};
#endif