home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / ISSKSS.H < prev    next >
Text File  |  1993-09-22  |  8KB  |  197 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 _ISSKSS_H
  13. #define _ISSKSS_H
  14.  
  15. #include <iglobals.h>
  16. #include <icursor.h>
  17.  
  18. template < class Element, class ElementOps, class Base >
  19. class IWSrtSetOnKSSet {
  20.   Base ivBase;
  21.   class Cursor;
  22.   friend class Cursor;
  23. public:
  24.  
  25.   class Cursor : public Base::Cursor {
  26.   protected:
  27.     IBoolean isFor (IWSrtSetOnKSSet < Element, ElementOps, Base > const& c) const
  28.     { return Base::Cursor::isFor (c.ivBase); }
  29.   public:
  30.     Cursor (IWSrtSetOnKSSet < Element, ElementOps, Base > const& c)
  31.     : Base::Cursor (c.ivBase) {}
  32.   };
  33.  
  34.                   IWSrtSetOnKSSet             (INumber
  35.                                                numberOfElements = 100);
  36.  
  37.                   IWSrtSetOnKSSet             (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
  38.  
  39.    IWSrtSetOnKSSet < Element, ElementOps, Base >&
  40.                   operator =                  (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
  41.  
  42.                  ~IWSrtSetOnKSSet             ();
  43.  
  44.    IBoolean       add                         (Element const&);
  45.  
  46.    IBoolean       add                         (Element const&,
  47.                                                ICursor&);
  48.  
  49.    void           addAllFrom                  (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
  50.  
  51.    Element const& elementAt                   (ICursor const&) const;
  52.  
  53.    Element&       elementAt                   (ICursor const&);
  54.  
  55.    Element const& anyElement                  () const;
  56.  
  57.    void           removeAt                    (ICursor const&);
  58.  
  59.    INumber        removeAll                   (IBoolean (*property)
  60.                                                (Element const&, void*),
  61.                                                void* additionalArgument = 0);
  62.  
  63.    void           replaceAt                   (ICursor const&,
  64.                                                Element const&);
  65.  
  66.    void           removeAll                   ();
  67.  
  68.    IBoolean       isBounded                   () const;
  69.  
  70.    INumber        maxNumberOfElements         () const;
  71.  
  72.    INumber        numberOfElements            () const;
  73.  
  74.    IBoolean       isEmpty                     () const;
  75.  
  76.    IBoolean       isFull                      () const;
  77.  
  78.    ICursor*       newCursor                   () const;
  79.  
  80.    IBoolean       setToFirst                  (ICursor&) const;
  81.  
  82.    IBoolean       setToNext                   (ICursor&) const;
  83.  
  84.    IBoolean       allElementsDo               (IBoolean (*function)
  85.                                                   (Element&, void*),
  86.                                                void* additionalArgument = 0);
  87.  
  88.    IBoolean       allElementsDo               (IIterator <Element>&);
  89.  
  90.    IBoolean       allElementsDo               (IBoolean (*function)
  91.                                                (Element const&, void*),
  92.                                                void* additionalArgument = 0)
  93.                                                const;
  94.  
  95.    IBoolean       allElementsDo               (IConstantIterator
  96.                                                   <Element>&) const;
  97.  
  98.    IBoolean       isConsistent                () const;
  99.  
  100.    IBoolean       contains                    (Element const&) const;
  101.  
  102.    IBoolean       containsAllFrom             (IWSrtSetOnKSSet < Element, ElementOps, Base > const&) const;
  103.  
  104.    IBoolean       locate                      (Element const&, ICursor&)
  105.                                                const;
  106.  
  107.    IBoolean       locateOrAdd                 (Element const&);
  108.  
  109.    IBoolean       locateOrAdd                 (Element const&,
  110.                                                ICursor&);
  111.  
  112.    IBoolean       remove                      (Element const&);
  113.  
  114.    IBoolean       operator ==                 (IWSrtSetOnKSSet < Element, ElementOps, Base > const&) const;
  115.  
  116.    IBoolean       operator !=                 (IWSrtSetOnKSSet < Element, ElementOps, Base > const&) const;
  117.  
  118.    void           unionWith                   (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
  119.  
  120.    void           intersectionWith            (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
  121.  
  122.    void           differenceWith              (IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
  123.  
  124.    void           addUnion                    (IWSrtSetOnKSSet < Element, ElementOps, Base > const&,
  125.                                                IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
  126.  
  127.    void           addIntersection             (IWSrtSetOnKSSet < Element, ElementOps, Base > const&,
  128.                                                IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
  129.  
  130.    void           addDifference               (IWSrtSetOnKSSet < Element, ElementOps, Base > const&,
  131.                                                IWSrtSetOnKSSet < Element, ElementOps, Base > const&);
  132.  
  133.    void           removeFirst                 ();
  134.  
  135.    void           removeLast                  ();
  136.  
  137.    void           removeAtPosition            (IPosition);
  138.  
  139.    Element const& firstElement                () const;
  140.  
  141.    Element const& lastElement                 () const;
  142.  
  143.    Element const& elementAtPosition           (IPosition) const;
  144.  
  145.    IBoolean       setToLast                   (ICursor&) const;
  146.  
  147.    IBoolean       setToPrevious               (ICursor&) const;
  148.  
  149.    void           setToPosition               (IPosition,
  150.                                                ICursor&) const;
  151.  
  152.    IBoolean       isFirst                     (ICursor const&) const;
  153.  
  154.    IBoolean       isLast                      (ICursor const&) const;
  155.  
  156.    long           compare                     (IWSrtSetOnKSSet < Element, ElementOps, Base > const&,
  157.                                                long (*comparisonFunction)
  158.                                                   (Element const&,
  159.                                                   Element const&)) const;
  160.  
  161. protected:
  162.  
  163.   static IBoolean  isContained    (Element const&, void* env);
  164.   static IBoolean  isNotContained (Element const&, void* env);
  165.  
  166. };
  167.  
  168. #define IDefineGSortedSetOnGKeySortedSet(GKSSet, GSSet) \
  169. template < class Element, class ElementOps > \
  170. class GKSSet ## ForGSSet : \
  171.   public GKSSet < Element, Element, \
  172.                   IOpsWithKey < Element, ElementOps > > { \
  173. public: \
  174.   GKSSet ## ForGSSet (INumber n = 100) : \
  175.     GKSSet < Element, Element, \
  176.              IOpsWithKey < Element, ElementOps > > (n) {} \
  177. }; \
  178. template < class Element, class ElementOps > \
  179. class GSSet : \
  180.   public IWSrtSetOnKSSet < Element, ElementOps, \
  181.                            GKSSet ## ForGSSet < Element, ElementOps > > { \
  182. public: \
  183.   GSSet (INumber n = 100) : \
  184.     IWSrtSetOnKSSet < Element, ElementOps, \
  185.                       GKSSet ## ForGSSet < Element, ElementOps > > (n) {} \
  186. };
  187.  
  188. #include <isskss.if>
  189.  
  190. #ifdef __IBMCPP__
  191. #ifndef __TEMPINC__
  192. #include <isskss.c>
  193. #endif
  194. #endif
  195.  
  196. #endif
  197.