home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / g++ / gen / OSLBag.hP < prev    next >
Text File  |  1993-06-29  |  2KB  |  92 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 the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19.  
  20. #ifndef _<T>OSLBag_h
  21. #ifdef __GNUG__
  22. #pragma interface
  23. #endif
  24. #define _<T>OSLBag_h 1
  25.  
  26. #include "<T>.Bag.h"
  27. #include "<T>.SLList.h"
  28.  
  29. class <T>OSLBag : public <T>Bag
  30. {
  31. protected:
  32.   <T>SLList     p;
  33.  
  34. public:
  35.                 <T>OSLBag();
  36.                 <T>OSLBag(const <T>OSLBag&);
  37.  
  38.   Pix           add(<T&> item);
  39.   void          del(<T&> item);
  40.   void          remove(<T&>item);
  41.  
  42.   int           contains(<T&> item);
  43.   int           nof(<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, Pix from = 0);
  52.  
  53.   int           OK();
  54. };
  55.  
  56.  
  57. inline <T>OSLBag::<T>OSLBag() : p() { count = 0; }
  58.  
  59. inline <T>OSLBag::<T>OSLBag(const <T>OSLBag& s) : p(s.p) { count = s.count; }
  60.  
  61. inline Pix <T>OSLBag::first()
  62. {
  63.   return p.first();
  64. }
  65.  
  66. inline void <T>OSLBag::next(Pix  & idx)
  67. {
  68.   p.next(idx);
  69. }
  70.  
  71. inline <T>& <T>OSLBag::operator ()(Pix   idx)
  72. {
  73.   return p(idx);
  74. }
  75.  
  76. inline void <T>OSLBag::clear()
  77. {
  78.   count = 0;  p.clear();
  79. }
  80.  
  81. inline int <T>OSLBag::owns (Pix   idx)
  82. {
  83.   return p.owns(idx);
  84. }
  85.  
  86. inline int <T>OSLBag::contains(<T&> item)
  87. {
  88.   return seek(item) != 0;
  89. }
  90.  
  91. #endif
  92.