Oh GACK! src-clean doesn't quite work that easily since cleandist rebuilds the
[unix-history] / gnu / lib / libg++ / g++-include / gen / VHBag.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>VHBag_h
21#ifdef __GNUG__
22#pragma interface
23#endif
24#define _<T>VHBag_h 1
25
26#include "<T>.Bag.h"
27
28
29class <T>VHBag : public <T>Bag
30{
31protected:
32 <T>* tab;
33 char* status;
34 unsigned int size;
35
36public:
37 <T>VHBag(unsigned int sz = DEFAULT_INITIAL_CAPACITY);
38 <T>VHBag(<T>VHBag& a);
39 ~<T>VHBag();
40
41 Pix add(<T&> item);
42 void del(<T&> item);
43 void remove(<T&>item);
44 int nof(<T&> item);
45 int contains(<T&> item);
46
47 void clear();
48
49 Pix first();
50 void next(Pix& i);
51 <T>& operator () (Pix i);
52 Pix seek(<T&> item, Pix from = 0);
53
54 int capacity();
55 void resize(unsigned int newsize = 0);
56
57 int OK();
58};
59
60
61inline <T>VHBag::~<T>VHBag()
62{
63 delete [] tab;
64 delete status;
65}
66
67
68inline int <T>VHBag::capacity()
69{
70 return size;
71}
72
73inline int <T>VHBag::contains(<T&> key)
74{
75 return seek(key) != 0;
76}
77
78inline <T>& <T>VHBag::operator () (Pix i)
79{
80 if (i == 0) error("null Pix");
81 return *((<T>*)i);
82}
83
84#endif