modules/up/src/gnug++/unsigned.OXPSet.h
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- unsignedOXPSet
- unsignedOXPSet
- unsignedOXPSet
- first
- next
- clear
- contains
- owns
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 _unsignedOXPSet_h
21 #ifdef __GNUG__
22 #pragma interface
23 #endif
24 #define _unsignedOXPSet_h 1
25
26 #include "unsigned.Set.h"
27 #include "unsigned.XPlex.h"
28
29 class unsignedOXPSet : public unsignedSet
/* [<][>][^][v][top][bottom][index][help] */
30 {
31 protected:
32 unsignedXPlex p;
33
34 public:
35 unsignedOXPSet(int chunksize = DEFAULT_INITIAL_CAPACITY);
36 unsignedOXPSet(const unsignedOXPSet&);
37
38 Pix add(unsigned item);
39 void del(unsigned item);
40 inline int contains(unsigned item);
41
42 inline void clear();
43
44 inline Pix first() const;
45 inline void next(Pix& i) const;
46 inline const unsigned& operator () (Pix i) const;
47 inline int owns(Pix i);
48 Pix seek(unsigned item);
49
50 void operator |= (const unsignedOXPSet& b);
51 void operator -= (const unsignedOXPSet& b);
52 void operator &= (const unsignedOXPSet& b);
53
54 int operator == (const unsignedOXPSet& b);
55 int operator != (const unsignedOXPSet& b);
56 int operator <= (const unsignedOXPSet& b);
57
58 int OK();
59 };
60
61
62 inline unsignedOXPSet::unsignedOXPSet(int chunksize)
/* [<][>][^][v][top][bottom][index][help] */
63 : p(chunksize) { count = 0; }
64
65 inline unsignedOXPSet::unsignedOXPSet(const unsignedOXPSet& s) : p(s.p) { count = s.count; }
/* [<][>][^][v][top][bottom][index][help] */
66
67 inline Pix unsignedOXPSet::first() const
/* [<][>][^][v][top][bottom][index][help] */
68 {
69 return p.first();
70 }
71
72 inline void unsignedOXPSet::next(Pix & idx) const
/* [<][>][^][v][top][bottom][index][help] */
73 {
74 p.next(idx);
75 }
76
77 inline const unsigned& unsignedOXPSet::operator ()(Pix idx) const
78 {
79 return p(idx);
80 }
81
82 inline void unsignedOXPSet::clear()
/* [<][>][^][v][top][bottom][index][help] */
83 {
84 count = 0; p.clear();
85 }
86
87 inline int unsignedOXPSet::contains (unsigned item)
/* [<][>][^][v][top][bottom][index][help] */
88 {
89 return seek(item) != 0;
90 }
91
92 inline int unsignedOXPSet::owns (Pix idx)
/* [<][>][^][v][top][bottom][index][help] */
93 {
94 return p.owns(idx);
95 }
96
97 inline int unsignedOXPSet::operator != (const unsignedOXPSet& b)
98 {
99 return !(*this == b);
100 }
101
102 #endif