home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / g__lib / oslset.hp < prev    next >
Encoding:
Text File  |  1993-07-23  |  2.3 KB  |  105 lines

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