modules/up/src/rpsl/gnu/SymID.VHSet.h
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- SymIDVHSet
- SymIDVHSet
- capacity
- contains
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19
20 #ifndef _SymIDVHSet_h
21 #ifdef __GNUG__
22 #pragma interface
23 #endif
24 #define _SymIDVHSet_h 1
25
26 #include "SymID.Set.h"
27
28
29
30 class SymIDVHSet : public SymIDSet
/* [<][>][^][v][top][bottom][index][help] */
31 {
32 protected:
33 SymID* tab;
34 char* status;
35 unsigned int size;
36
37 public:
38 SymIDVHSet(unsigned int sz = DEFAULT_INITIAL_CAPACITY);
39 SymIDVHSet(const SymIDVHSet& a);
40 inline ~SymIDVHSet();
41
42 Pix add(SymID item);
43 void del(SymID item);
44 inline int contains(SymID item);
45
46 void clear();
47
48 Pix first() const;
49 void next(Pix& i) const;
50 inline SymID& operator () (Pix i) const;
51 Pix seek(SymID item) const;
52
53 void operator |= (SymIDVHSet& b);
54 void operator -= (SymIDVHSet& b);
55 void operator &= (SymIDVHSet& b);
56
57 int operator == (const SymIDVHSet& b) const;
58 int operator != (const SymIDVHSet& b) const;
59 int operator <= (const SymIDVHSet& b) const;
60
61 int capacity();
62 void resize(unsigned int newsize = 0);
63
64 int OK();
65 };
66
67
68 inline SymIDVHSet::~SymIDVHSet()
/* [<][>][^][v][top][bottom][index][help] */
69 {
70 delete [] tab;
71 // Fixed by wlee@isi.edu
72 // delete status;
73 delete [] status;
74 }
75
76
77 inline int SymIDVHSet::capacity()
/* [<][>][^][v][top][bottom][index][help] */
78 {
79 return size;
80 }
81
82 inline int SymIDVHSet::contains(SymID key)
/* [<][>][^][v][top][bottom][index][help] */
83 {
84 return seek(key) != 0;
85 }
86
87 inline SymID& SymIDVHSet::operator () (Pix i) const
88 {
89 if (i == 0) error("null Pix");
90 return *((SymID*)i);
91 }
92
93 inline int SymIDVHSet::operator != (const SymIDVHSet& b) const
94 {
95 return ! ((*this) == b);
96 }
97
98 #endif