home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / libg++-2.5.3-bin.lha / lib / g++-include / gen / VOHSet.hP < prev    next >
Text File  |  1994-02-21  |  2KB  |  89 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.      based on code by Doug Schmidt
  6.  
  7. This file is part of the GNU C++ Library.  This library is free
  8. software; you can redistribute it and/or modify it under the terms of
  9. the GNU Library General Public License as published by the Free
  10. Software Foundation; either version 2 of the License, or (at your
  11. option) any later version.  This library is distributed in the hope
  12. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  13. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  14. PURPOSE.  See the GNU Library General Public License for more details.
  15. You should have received a copy of the GNU Library General Public
  16. License along with this library; if not, write to the Free Software
  17. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20.  
  21. #ifndef _<T>VOHSet_h
  22. #ifdef __GNUG__
  23. #pragma interface
  24. #endif
  25. #define _<T>VOHSet_h 1
  26.  
  27. #include "<T>.Set.h"
  28.  
  29.  
  30.  
  31. class <T>VOHSet : public <T>Set
  32. {
  33.   <T>*                  tab;
  34.   char*                 status;
  35.   int                   size;
  36.   int                   cnt; // keeps track of VALIDCELLs and DELETEDCELLs
  37.  
  38. public:
  39.                         <T>VOHSet(int sz = DEFAULT_INITIAL_CAPACITY);
  40.                         <T>VOHSet(<T>VOHSet&);
  41.                         ~<T>VOHSet();
  42.  
  43.   Pix           add(<T&> item);
  44.   void          del(<T&> item);
  45.   int           contains(<T&> item);
  46.  
  47.   void          clear();
  48.  
  49.   Pix           first();
  50.   void          next(Pix& i);
  51.   <T>&          operator () (Pix i);
  52.   Pix           seek(<T&> item);
  53.  
  54.   void          operator |= (<T>VOHSet& b);
  55.   void          operator -= (<T>VOHSet& b);
  56.   void          operator &= (<T>VOHSet& b);
  57.  
  58.   int           operator == (<T>VOHSet& b);
  59.   int           operator != (<T>VOHSet& b);
  60.   int           operator <= (<T>VOHSet& b); 
  61.  
  62.   int           capacity();
  63.   void          resize(int newsize = 0);
  64.  
  65.   int           OK();
  66. };
  67.  
  68.  
  69. inline <T>VOHSet::~<T>VOHSet()
  70. {
  71.   delete [] tab;
  72.   delete status;
  73. }
  74.  
  75.  
  76. inline int <T>VOHSet::contains(<T&>  key)
  77. {
  78.   return seek(key) != 0;
  79. }
  80.  
  81.  
  82. inline <T>& <T>VOHSet::operator () (Pix p)
  83. {
  84.   if (p == 0) error("null Pix");
  85.   return *((<T>*)p);
  86. }
  87.  
  88. #endif
  89.