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