xref: /386bsd/usr/include/nonstd/gnu/g++/gen/DLDeque.hP (revision a2142627)
1// This may look like C code, but it is really -*- C++ -*-
2/*
3Copyright (C) 1988 Free Software Foundation
4    written by Doug Lea (dl@rocky.oswego.edu)
5
6This file is part of GNU CC.
7
8GNU CC is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY.  No author or distributor
10accepts responsibility to anyone for the consequences of using it
11or for whether it serves any particular purpose or works at all,
12unless he says so in writing.  Refer to the GNU CC General Public
13License for full details.
14
15Everyone is granted permission to copy, modify and redistribute
16GNU CC, but only under the conditions described in the
17GNU CC General Public License.   A copy of this license is
18supposed to have been given to you along with GNU CC so you
19can know your rights and responsibilities.  It should be in a
20file named COPYING.  Among other things, the copyright notice
21and this notice must be preserved on all copies.
22*/
23
24
25#ifndef _<T>DLDeque_h
26#ifdef __GNUG__
27#pragma once
28#pragma interface
29#endif
30#define _<T>DLDeque_h
31
32#include "<T>.DLList.h"
33#include "<T>.Deque.h"
34
35class <T>DLDeque : public <T>Deque
36{
37  <T>DLList    p;
38
39public:
40               <T>DLDeque();
41               <T>DLDeque(const <T>DLDeque& d);
42               ~<T>DLDeque();
43
44  void          operator = (const <T>DLDeque&);
45
46  void          push(<T&> item); // insert at front
47  void          enq(<T&> item);  // insert at rear
48
49  <T>&          front();
50  <T>&          rear();
51
52  <T>           deq();
53  void          del_front();
54  void          del_rear();
55
56  void          clear();
57  int           empty();
58  int           full();
59  int           length();
60
61  int           OK();
62};
63
64#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES)
65
66inline <T>DLDeque::<T>DLDeque() : p() {}
67inline <T>DLDeque::<T>DLDeque(const <T>DLDeque& d) : p(d.p) {}
68
69inline <T>DLDeque::~<T>DLDeque() {}
70
71inline void <T>DLDeque::push(<T&>item)
72{
73  p.prepend(item);
74}
75
76inline void <T>DLDeque::enq(<T&>item)
77{
78  p.append(item);
79}
80
81inline <T> <T>DLDeque::deq()
82{
83  return p.remove_front();
84}
85
86inline <T>& <T>DLDeque::front()
87{
88  return p.front();
89}
90
91inline <T>& <T>DLDeque::rear()
92{
93  return p.rear();
94}
95
96inline void <T>DLDeque::del_front()
97{
98  p.del_front();
99}
100
101inline void <T>DLDeque::del_rear()
102{
103  p.del_rear();
104}
105
106inline void <T>DLDeque::operator =(const <T>DLDeque& s)
107{
108  p.operator = (s.p);
109}
110
111
112inline int <T>DLDeque::empty()
113{
114  return p.empty();
115}
116
117inline int <T>DLDeque::full()
118{
119  return 0;
120}
121
122inline int <T>DLDeque::length()
123{
124  return p.length();
125}
126
127inline int <T>DLDeque::OK()
128{
129  return p.OK();
130}
131
132inline void <T>DLDeque::clear()
133{
134  p.clear();
135}
136
137#endif
138#endif
139