Diffstat (limited to 'noncore/apps/opie-reader/Queue.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/Queue.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/Queue.h b/noncore/apps/opie-reader/Queue.h new file mode 100644 index 0000000..f1bd4b4 --- a/dev/null +++ b/noncore/apps/opie-reader/Queue.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef __QUEUE_H | ||
2 | #define __QUEUE_H | ||
3 | |||
4 | #include "my_list.h" | ||
5 | |||
6 | template<class T> | ||
7 | class CQueue : public CList<T> | ||
8 | { | ||
9 | public: | ||
10 | bool empty() { return (front == NULL); } | ||
11 | void push(const T& t) { push_back(t); } | ||
12 | T pop() | ||
13 | { | ||
14 | T data = front->data; | ||
15 | node* n = front; | ||
16 | front = front->next; | ||
17 | delete n; | ||
18 | return data; | ||
19 | } | ||
20 | }; | ||
21 | #endif | ||