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 GNU CC. 7 8GNU CC is distributed in the hope that it will be useful, 9but WITHOUT ANY WARRANTY. No author or distributor 10accepts responsibility to anyone for the consequences of using it 11or for whether it serves any particular purpose or works at all, 12unless he says so in writing. Refer to the GNU CC General Public 13License for full details. 14 15Everyone is granted permission to copy, modify and redistribute 16GNU CC, but only under the conditions described in the 17GNU CC General Public License. A copy of this license is 18supposed to have been given to you along with GNU CC so you 19can know your rights and responsibilities. It should be in a 20file named COPYING. Among other things, the copyright notice 21and this notice must be preserved on all copies. 22*/ 23 24 25#ifndef _<T>XPSet_h 26#ifdef __GNUG__ 27#pragma once 28#pragma interface 29#endif 30#define _<T>XPSet_h 1 31 32#include "<T>.Set.h" 33#include "<T>.XPlex.h" 34 35class <T>XPSet : public <T>Set 36{ 37protected: 38 <T>XPlex p; 39 40public: 41 <T>XPSet(int chunksize = DEFAULT_INITIAL_CAPACITY); 42 <T>XPSet(const <T>XPSet&); 43 44 Pix add(<T&> item); 45 void del(<T&> item); 46 int contains(<T&> item); 47 48 void clear(); 49 50 Pix first(); 51 void next(Pix& i); 52 <T>& operator () (Pix i); 53 int owns(Pix i); 54 Pix seek(<T&> item); 55 56 int OK(); 57}; 58 59 60#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) 61 62inline <T>XPSet::<T>XPSet(int chunksize) 63 : p(chunksize) { count = 0; } 64 65inline <T>XPSet::<T>XPSet(const <T>XPSet& s) : p(s.p) { count = s.count; } 66 67inline Pix <T>XPSet::first() 68{ 69 return p.first(); 70} 71 72inline void <T>XPSet::next(Pix & idx) 73{ 74 p.next(idx); 75} 76 77inline <T>& <T>XPSet::operator ()(Pix idx) 78{ 79 return p(idx); 80} 81 82inline void <T>XPSet::clear() 83{ 84 count = 0; p.clear(); 85} 86 87inline int <T>XPSet::contains (<T&> item) 88{ 89 return seek(item) != 0; 90} 91 92inline int <T>XPSet::owns (Pix idx) 93{ 94 return p.owns(idx); 95} 96 97 98#endif 99#endif 100