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>SLSet_h 26#ifdef __GNUG__ 27#pragma once 28#pragma interface 29#endif 30#define _<T>SLSet_h 1 31 32#include "<T>.Set.h" 33#include "<T>.SLList.h" 34 35class <T>SLSet : public <T>Set 36{ 37protected: 38 <T>SLList p; 39 40public: 41 <T>SLSet(); 42 <T>SLSet(const <T>SLSet&); 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#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES) 60 61inline <T>SLSet::<T>SLSet() : p() { count = 0; } 62 63inline <T>SLSet::<T>SLSet(const <T>SLSet& s) : p(s.p) { count = s.count; } 64 65inline Pix <T>SLSet::first() 66{ 67 return p.first(); 68} 69 70inline void <T>SLSet::next(Pix & idx) 71{ 72 p.next(idx); 73} 74 75inline <T>& <T>SLSet::operator ()(Pix idx) 76{ 77 return p(idx); 78} 79 80inline void <T>SLSet::clear() 81{ 82 count = 0; p.clear(); 83} 84 85inline int <T>SLSet::contains (<T&> item) 86{ 87 return seek(item) != 0; 88} 89 90inline int <T>SLSet::owns (Pix idx) 91{ 92 return p.owns(idx); 93} 94 95 96#endif 97#endif 98