xref: /386bsd/usr/include/nonstd/gnu/g++/gen/FPQueue.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    based on code by Marc Shapiro (shapiro@sor.inria.fr)
6
7This file is part of GNU CC.
8
9GNU CC is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY.  No author or distributor
11accepts responsibility to anyone for the consequences of using it
12or for whether it serves any particular purpose or works at all,
13unless he says so in writing.  Refer to the GNU CC General Public
14License for full details.
15
16Everyone is granted permission to copy, modify and redistribute
17GNU CC, but only under the conditions described in the
18GNU CC General Public License.   A copy of this license is
19supposed to have been given to you along with GNU CC so you
20can know your rights and responsibilities.  It should be in a
21file named COPYING.  Among other things, the copyright notice
22and this notice must be preserved on all copies.
23*/
24
25
26#ifndef _<T>FPQueue_h
27#ifdef __GNUG__
28#pragma once
29#pragma interface
30#endif
31#define _<T>FPQueue_h
32
33#include "<T>.FPlex.h"
34#include "<T>.Queue.h"
35
36class <T>FPQueue : public <T>Queue
37{
38  <T>FPlex     p;
39
40public:
41               <T>FPQueue(int chunksize = DEFAULT_<T>PLEX_CHUNK_SIZE);
42               <T>FPQueue(const <T>FPQueue& q);
43               ~<T>FPQueue();
44
45  void          operator = (const <T>FPQueue&);
46
47  void          enq(<T&> item);
48  <T>           deq();
49  <T>&          front();
50  void          del_front();
51
52  void          clear();
53  int           empty();
54  int           full();
55  int           length();
56
57  int           OK();
58};
59
60#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES)
61
62inline <T>FPQueue::<T>FPQueue(int chunksize) : p(chunksize) {}
63inline <T>FPQueue::<T>FPQueue(const <T>FPQueue& q) : p(q.p) {}
64
65inline <T>FPQueue::~<T>FPQueue() {}
66
67inline void <T>FPQueue::enq(<T&>item)
68{
69  p.add_high(item);
70}
71
72inline <T> <T>FPQueue::deq()
73{
74  <T> res = p.low_element();
75  p.del_low();
76  return res;
77}
78
79inline <T>& <T>FPQueue::front()
80{
81  return p.low_element();
82}
83
84
85inline void <T>FPQueue::del_front()
86{
87  p.del_low();
88}
89
90inline void <T>FPQueue::operator =(const <T>FPQueue& s)
91{
92  p = s.p;
93}
94
95inline int <T>FPQueue::empty()
96{
97  return p.empty();
98}
99
100inline int <T>FPQueue::full()
101{
102  return p.full();
103}
104
105inline int <T>FPQueue::length()
106{
107  return p.length();
108}
109
110inline int <T>FPQueue::OK()
111{
112  return p.OK();
113}
114
115inline void <T>FPQueue::clear()
116{
117  p.clear();
118}
119
120#endif
121#endif
122