home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IRSRTBAG.H < prev    next >
Text File  |  1993-09-22  |  6KB  |  152 lines

  1. /*******************************************************************************
  2. *                                                                              *
  3. * COPYRIGHT:                                                                   *
  4. *   IBM C/C++ Tools Version 2.01 - Collection Class Library                    *
  5. *   Licensed Materials - Property of IBM                                       *
  6. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  7. *   All Rights Reserved                                                        *
  8. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  9. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  10. *                                                                              *
  11. *******************************************************************************/
  12. #ifndef _IRSRTBAG_H
  13. #define _IRSRTBAG_H
  14.  
  15. #include <iasrtbag.h>
  16.  
  17. template < class Element, class Base >
  18. class IRSortedBag : public virtual IASortedBag < Element > {
  19.   Base &ivBase;
  20. public:
  21.  
  22.        IRSortedBag (Base& base) : ivBase (base) {};
  23.  
  24.                  ~IRSortedBag             ();
  25.  
  26.    IBoolean       add                         (Element const&);
  27.  
  28.    IBoolean       add                         (Element const&,
  29.                                                ICursor&);
  30.  
  31.    Element const& elementAt                   (ICursor const&) const;
  32.  
  33.    Element&       elementAt                   (ICursor const&);
  34.  
  35.    Element const& anyElement                  () const;
  36.  
  37.    void           removeAt                    (ICursor const&);
  38.  
  39.    INumber        removeAll                   (IBoolean (*property)
  40.                                                (Element const&, void*),
  41.                                                void* additionalArgument = 0);
  42.  
  43.    void           replaceAt                   (ICursor const&,
  44.                                                Element const&);
  45.  
  46.    void           removeAll                   ();
  47.  
  48.    IBoolean       isBounded                   () const;
  49.  
  50.    INumber        maxNumberOfElements         () const;
  51.  
  52.    INumber        numberOfElements            () const;
  53.  
  54.    IBoolean       isEmpty                     () const;
  55.  
  56.    IBoolean       isFull                      () const;
  57.  
  58.    ICursor*       newCursor                   () const;
  59.  
  60.    IBoolean       setToFirst                  (ICursor&) const;
  61.  
  62.    IBoolean       setToNext                   (ICursor&) const;
  63.  
  64.    IBoolean       allElementsDo               (IBoolean (*function)
  65.                                                   (Element&, void*),
  66.                                                void* additionalArgument = 0);
  67.  
  68.    IBoolean       allElementsDo               (IIterator <Element>&);
  69.  
  70.    IBoolean       allElementsDo               (IBoolean (*function)
  71.                                                (Element const&, void*),
  72.                                                void* additionalArgument = 0)
  73.                                                const;
  74.  
  75.    IBoolean       allElementsDo               (IConstantIterator
  76.                                                   <Element>&) const;
  77.  
  78.    IBoolean       isConsistent                () const;
  79.  
  80.    IBoolean       contains                    (Element const&) const;
  81.  
  82.    IBoolean       locate                      (Element const&, ICursor&)
  83.                                                const;
  84.  
  85.    IBoolean       locateOrAdd                 (Element const&);
  86.  
  87.    IBoolean       locateOrAdd                 (Element const&,
  88.                                                ICursor&);
  89.  
  90.    IBoolean       remove                      (Element const&);
  91.  
  92.    INumber        numberOfOccurrences         (Element const&) const;
  93.  
  94.    IBoolean       locateNext                  (Element const&, ICursor&)
  95.                                                const;
  96.  
  97.    INumber        removeAllOccurrences        (Element const&);
  98.  
  99.    INumber        numberOfDifferentElements   () const;
  100.  
  101.    IBoolean       setToNextDifferentElement   (ICursor&) const;
  102.  
  103.    void           unionWith                   (IASortedBag < Element > const&);
  104.  
  105.    void           intersectionWith            (IASortedBag < Element > const&);
  106.  
  107.    void           differenceWith              (IASortedBag < Element > const&);
  108.  
  109.    void           addUnion                    (IASortedBag < Element > const&,
  110.                                                IASortedBag < Element > const&);
  111.  
  112.    void           addIntersection             (IASortedBag < Element > const&,
  113.                                                IASortedBag < Element > const&);
  114.  
  115.    void           addDifference               (IASortedBag < Element > const&,
  116.                                                IASortedBag < Element > const&);
  117.  
  118.    void           removeFirst                 ();
  119.  
  120.    void           removeLast                  ();
  121.  
  122.    void           removeAtPosition            (IPosition);
  123.  
  124.    Element const& firstElement                () const;
  125.  
  126.    Element const& lastElement                 () const;
  127.  
  128.    Element const& elementAtPosition           (IPosition) const;
  129.  
  130.    IBoolean       setToLast                   (ICursor&) const;
  131.  
  132.    IBoolean       setToPrevious               (ICursor&) const;
  133.  
  134.    void           setToPosition               (IPosition,
  135.                                                ICursor&) const;
  136.  
  137.    IBoolean       isFirst                     (ICursor const&) const;
  138.  
  139.    IBoolean       isLast                      (ICursor const&) const;
  140.  
  141. protected:
  142.   void* identity () const;
  143. };
  144.  
  145. #ifdef __IBMCPP__
  146. #ifndef __TEMPINC__
  147. #include <irsrtbag.c>
  148. #endif
  149. #endif
  150.  
  151. #endif
  152.