Oh GACK! src-clean doesn't quite work that easily since cleandist rebuilds the
[unix-history] / gnu / lib / libg++ / g++-include / gen / XPPQ.hP
CommitLineData
e87b4ac1
PR
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 the GNU C++ Library. This library is free
7software; you can redistribute it and/or modify it under the terms of
8the GNU Library General Public License as published by the Free
9Software Foundation; either version 2 of the License, or (at your
10option) any later version. This library is distributed in the hope
11that it will be useful, but WITHOUT ANY WARRANTY; without even the
12implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the GNU Library General Public License for more details.
14You should have received a copy of the GNU Library General Public
15License along with this library; if not, write to the Free Software
16Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17*/
18
19
20#ifndef _<T>XPPQ_h
21#ifdef __GNUG__
22#pragma interface
23#endif
24#define _<T>XPPQ_h 1
25
26#include "<T>.PQ.h"
27#include "<T>.XPlex.h"
28
29class <T>XPPQ : public <T>PQ
30{
31protected:
32 <T>XPlex p;
33
34public:
35 <T>XPPQ(int chunksize = DEFAULT_INITIAL_CAPACITY);
36 <T>XPPQ(const <T>XPPQ&);
37
38 Pix enq(<T&> item);
39 <T> deq();
40
41 <T>& front();
42 void del_front();
43
44 int contains(<T&> item);
45
46 void clear();
47
48 Pix first();
49 void next(Pix& i);
50 <T>& operator () (Pix i);
51 void del(Pix i);
52 int owns(Pix i);
53 Pix seek(<T&> item);
54
55 int OK(); // rep invariant
56};
57
58inline <T>XPPQ::<T>XPPQ(int chunksize)
59 : p(1, chunksize) { count = 0; }
60
61inline <T>XPPQ::<T>XPPQ(const <T>XPPQ& s) : p(s.p) { count = s.count; }
62
63inline Pix <T>XPPQ::first()
64{
65 return p.first();
66}
67
68inline void <T>XPPQ::next(Pix & idx)
69{
70 p.next(idx);
71}
72
73inline <T>& <T>XPPQ::operator ()(Pix idx)
74{
75 return p(idx);
76}
77
78inline <T>& <T>XPPQ::front ()
79{
80 return p.low_element();
81}
82
83inline <T> <T>XPPQ::deq ()
84{
85 <T> x = p.low_element();
86 del_front();
87 return x;
88}
89
90inline void <T>XPPQ::clear()
91{
92 count = 0; p.clear();
93}
94
95inline int <T>XPPQ::contains (<T&> item)
96{
97 return seek(item) != 0;
98}
99
100inline int <T>XPPQ::owns (Pix idx)
101{
102 return p.owns(idx);
103}
104
105#endif