741
|
1 // This may look like C code, but it is really -*- C++ -*- |
|
2 /* |
|
3 Copyright (C) 1988 Free Software Foundation |
|
4 written by Doug Lea (dl@rocky.oswego.edu) |
|
5 |
|
6 This file is part of the GNU C++ Library. This library is free |
|
7 software; you can redistribute it and/or modify it under the terms of |
|
8 the GNU Library General Public License as published by the Free |
|
9 Software Foundation; either version 2 of the License, or (at your |
|
10 option) any later version. This library is distributed in the hope |
|
11 that it will be useful, but WITHOUT ANY WARRANTY; without even the |
|
12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
13 PURPOSE. See the GNU Library General Public License for more details. |
|
14 You should have received a copy of the GNU Library General Public |
|
15 License along with this library; if not, write to the Free Software |
|
16 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
17 */ |
|
18 |
|
19 |
|
20 #if !defined (_SLQueue_h) |
|
21 #define _SLQueue_h 1 |
|
22 |
|
23 #include "SLList.h" |
|
24 #include "Queue.h" |
|
25 |
|
26 template <class T> |
|
27 class |
|
28 SLQueue : public Queue<T> |
|
29 { |
|
30 private: |
|
31 SLList<T> p; |
|
32 |
|
33 public: |
|
34 SLQueue (void) : p () { } |
|
35 |
|
36 SLQueue (const SLQueue<T>& q) : p (q.p) { } |
|
37 |
|
38 ~SLQueue (void) { } |
|
39 |
|
40 void operator = (const SLQueue<T>& s) { p = s.p; } |
|
41 |
|
42 void enq (const T& item) { p.append (item); } |
|
43 |
|
44 T deq (void) { return p.remove_front (); } |
|
45 |
|
46 T& front (void) { return p.front (); } |
|
47 |
|
48 void del_front (void) { p.del_front (); } |
|
49 |
|
50 void clear (void) { p.clear (); } |
|
51 |
|
52 int empty (void) const { return p.empty (); } |
|
53 |
|
54 int full (void) const { return 0; } |
|
55 |
|
56 int length (void) const { return p.length (); } |
|
57 |
|
58 int OK (void) { return p.OK (); } |
|
59 }; |
|
60 |
|
61 #endif |
|
62 |
|
63 /* |
|
64 ;;; Local Variables: *** |
|
65 ;;; mode: C++ *** |
|
66 ;;; page-delimiter: "^/\\*" *** |
|
67 ;;; End: *** |
|
68 */ |