home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iiseqtab.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  11.9 KB  |  498 lines

  1. /**********************************************************************
  2. *                                                                     *
  3. *  IBM(R) VisualAge(TM) for C++ for Windows(R), Version 3.5           *
  4. *                                                                     *
  5. *  PID: 5622-880                                                      *
  6. *  - Licensed Material - Program-Property of IBM                      *
  7. *  (C) Copyright IBM Corp. 1991, 1995 - All Right Reserved.           *
  8. *                                                                     *
  9. *  US Government Users Restricted Rights - Use, duplication or        *
  10. *  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.  *
  11. *                                                                     *
  12. *  VisualAge, and IBM are trademarks or registered trademarks of      *
  13. *  International Business Machines Corporation.                       *
  14. *  Windows is a registered trademark of Microsoft Corporation.        *
  15. *                                                                     *
  16. **********************************************************************/
  17.  
  18. #ifndef _IISEQTAB_H
  19. #define _IISEQTAB_H
  20.  
  21. #include <iiaseq.h>
  22. #include <iitable.h>
  23.  
  24.  
  25. #pragma info (nocls, nocnd, nocns, nocnv, noext, nognr, novft)
  26. #pragma pack (4)
  27.  
  28. #pragma SOMAsDefault (off)
  29.  
  30. template <class Element>
  31. struct ISequenceAsTableNodeImpl {
  32.  
  33.   Element  ivElement;
  34.  
  35.            ISequenceAsTableNodeImpl
  36.                             (Element const&);
  37.  
  38.           ~ISequenceAsTableNodeImpl
  39.                             ();
  40.  
  41.  
  42. };
  43.  
  44. #pragma SOMAsDefault (pop)
  45. #pragma SOMAsDefault (off)
  46.  
  47. class ISequenceAsTableCursorImpl : public ICursorImpl {
  48.  
  49.   typedef  ICursorImpl Inherited;
  50.  
  51.   typedef  ISequenceAsTableCursorImpl Self;
  52.  
  53. public:
  54.  
  55.            ISequenceAsTableCursorImpl
  56.                             (IACollectionImpl const&);
  57.  
  58.            ISequenceAsTableCursorImpl
  59.                             (ISequenceAsTableCursorImpl const&);
  60.  
  61.           ~ISequenceAsTableCursorImpl
  62.                             ();
  63.  
  64.   ICursorImpl*
  65.            Clone            () const;
  66.  
  67.   void     Copy             (ICursorImpl const&);
  68.  
  69.   void     Invalidate       ();
  70.  
  71.   IBoolean IsInBetween      () const;
  72.  
  73.   IBoolean IsValid          () const;
  74.  
  75.   void     operator=        (ISequenceAsTableCursorImpl const&);
  76.  
  77.   IBoolean operator==       (ICursorImpl const&) const;
  78.  
  79. protected:
  80.  
  81. private:
  82.  
  83.   INumber  ivIndex;
  84.  
  85.   friend
  86.   class    ISequenceAsTableImpl;
  87.  
  88.  
  89. };
  90.  
  91.  
  92. class IASequenceAsTableOps;
  93.  
  94. class ISequenceAsTableImpl : public IASequenceImpl {
  95.  
  96.   typedef  IASequenceImpl Inherited;
  97.  
  98.   typedef  ISequenceAsTableImpl Self;
  99.  
  100. public:
  101.  
  102.   typedef  IASequenceAsTableOps Ops;
  103.  
  104.   typedef  ISequenceAsTableCursorImpl Cursor;
  105.  
  106.   typedef  ISequenceAsTableCursorImpl MngCursor;
  107.  
  108.            ISequenceAsTableImpl
  109.                             (Ops&, INumber);
  110.  
  111.            ISequenceAsTableImpl
  112.                             (Ops&,
  113.                              ISequenceAsTableImpl const&);
  114.  
  115.           ~ISequenceAsTableImpl
  116.                             ();
  117.  
  118.   IBoolean Add              (void const*, ICursorImpl&);
  119.  
  120.   void     AddAllFrom       (IACollectionImpl const&);
  121.  
  122.   void     AddAsFirst       (void const*, ICursorImpl&);
  123.  
  124.   void     AddAsLast        (void const*, ICursorImpl&);
  125.  
  126.   void     AddAsNext        (void const*, ICursorImpl&);
  127.  
  128.   void     AddAsPrevious    (void const*, ICursorImpl&);
  129.  
  130.   void     AddAtPosition    (IPosition, void const*, ICursorImpl&);
  131.  
  132.   IBoolean AllElementsDo    (IApplFunc, void*);
  133.  
  134.   void*    Any              () const;
  135.  
  136.   IBoolean CheckCursor      (ICursorImpl const&) const;
  137.  
  138.   char const*
  139.            ClassName        () const;
  140.  
  141.   IACollectionImpl*
  142.            Clone            () const;
  143.  
  144.   void     Copy             (IACollectionImpl const&);
  145.  
  146.   Cursor*  CreateCursor     () const;
  147.  
  148.   MngCursor*
  149.            CreateMngCursor  () const;
  150.  
  151.   void*    ElementAt        (ICursorImpl const&) const;
  152.  
  153.   void*    ElementAtPosition
  154.                             (IPosition) const;
  155.  
  156.   void*    First            () const;
  157.  
  158.   IBoolean IsBounded        () const;
  159.  
  160.   IBoolean IsConsistent     () const;
  161.  
  162.   IBoolean IsEmpty          () const;
  163.  
  164.   IBoolean IsFirstAt        (ICursorImpl const&) const;
  165.  
  166.   IBoolean IsFull           () const;
  167.  
  168.   IBoolean IsLastAt         (ICursorImpl const&) const;
  169.  
  170.   void*    Last             () const;
  171.  
  172.   INumber  NumberOfElements () const;
  173.  
  174.   IPosition
  175.            PositionAt       (ICursorImpl const&) const;
  176.  
  177.   INumber  RemoveAll        ();
  178.  
  179.   INumber  RemoveAll        (IPredFunc, void*);
  180.  
  181.   void     RemoveAt         (ICursorImpl&);
  182.  
  183.   void     RemoveAtPosition (IPosition);
  184.  
  185.   void     RemoveFirst      ();
  186.  
  187.   void     RemoveLast       ();
  188.  
  189.   void     ReplaceAt        (ICursorImpl const&, void const*);
  190.  
  191.   void     ReplaceAtPosition
  192.                             (IPosition, void const*);
  193.  
  194.   void     Reverse          ();
  195.  
  196.   IBoolean SetToFirst       (ICursorImpl&) const;
  197.  
  198.   IBoolean SetToLast        (ICursorImpl&) const;
  199.  
  200.   IBoolean SetToNext        (ICursorImpl&) const;
  201.  
  202.   void     SetToPosition    (IPosition, ICursorImpl&) const;
  203.  
  204.   IBoolean SetToPrevious    (ICursorImpl&) const;
  205.  
  206.   void     Sort             (ICompFunc, void*);
  207.  
  208.   void     operator=        (ISequenceAsTableImpl const&);
  209.  
  210.   TStream& operator<<=      (TStream&);
  211.  
  212.   TStream& operator>>=      (TStream&) const;
  213.  
  214. protected:
  215.  
  216.   void     Assign           (void*, void const*) const;
  217.  
  218.   void     BlockLeft        (INumber, INumber);
  219.  
  220.   void     BlockRight       (INumber, INumber);
  221.  
  222.   void     CopyFrom         (ITableImpl const&);
  223.  
  224.   void     ConstructNode    (void*, void const*) const;
  225.  
  226.   void*    CreateNodes      (INumber, size_t&);
  227.  
  228.   void     DeleteNodes      (void*);
  229.  
  230.   void     DestroyNodes     (void*, INumber = 1) const;
  231.  
  232.   void*    StreamIn         (TStream&) const;
  233.  
  234.   void     StreamOut        (void const*, TStream&) const;
  235.  
  236.   void     Swap             (INumber, INumber) const;
  237.  
  238. private:
  239.  
  240.   enum { kOriginalVersion };
  241.  
  242.   static
  243.   char const*
  244.            cvClassName;
  245.  
  246.   MngCursor*
  247.            ivMngCursors;
  248.  
  249.   ITableImpl
  250.            ivTable;
  251.  
  252.   void     GrowBy           (INumber);
  253.  
  254.   void*    ElementOf        (void const*) const;
  255.  
  256.   static
  257.   INumber& IndexOf          (ICursorImpl const&);
  258.  
  259.   void     Initialize       (INumber);
  260.  
  261.   static
  262.   IBoolean IsInBetween      (ICursorImpl const&);
  263.  
  264.   static
  265.   INumber& NextIndexOf      (ICursorImpl const&);
  266.  
  267.   static
  268.   Ops&     OpsOf            (ISequenceAsTableImpl const&);
  269.  
  270.   static
  271.   INumber& PreviousIndexOf  (ICursorImpl const&);
  272.  
  273.   void     RemoveAtIndex    (INumber);
  274.  
  275.   void     SetInBetween     (MngCursor&) const;
  276.  
  277.   void     Quicksort        (ICompFunc, void*, INumber, INumber);
  278.  
  279.   void     UpdateMngCursorsForAssign
  280.                             (INumber, INumber) const;
  281.  
  282.   void     UpdateMngCursorsForCopyFrom
  283.                             (INumber, INumber) const;
  284.  
  285.   void     UpdateMngCursorsForGrowBy
  286.                             () const;
  287.  
  288.   void     UpdateMngCursorsForPredRemove
  289.                             (INumber, INumber) const;
  290.  
  291.   void     UpdateMngCursorsForRemoveOf
  292.                             (INumber) const;
  293.  
  294.   void     UpdateMngCursorsForShiftLeftOf
  295.                             (INumber) const;
  296.  
  297.   void     UpdateMngCursorsForShiftRightOf
  298.                             (INumber) const;
  299.  
  300.   void     UpdateMngCursorsForSwap
  301.                             (INumber, INumber) const;
  302.  
  303.   friend
  304.   class    ISequenceAsTableMngCursorImpl;
  305.  
  306.   friend
  307.   class    IASequenceAsTableOps;
  308.  
  309.  
  310. };
  311.  
  312. class IASequenceAsTableOps {
  313. public:
  314.  
  315.   virtual ~IASequenceAsTableOps
  316.                             ();
  317.  
  318.   virtual
  319.   void     Assign           (void*, void const*) const = 0;
  320.  
  321.   virtual
  322.   void     BlockLeft        (INumber, INumber) = 0;
  323.  
  324.   virtual
  325.   void     BlockRight       (INumber, INumber) = 0;
  326.  
  327.   virtual
  328.   IACollectionImpl*
  329.            Clone            () const = 0;
  330.  
  331.   virtual
  332.   void     CopyFrom         (ITableImpl const&) = 0;
  333.  
  334.   virtual
  335.   void     ConstructNode    (void*, void const*) const = 0;
  336.  
  337.   virtual
  338.   void*    CreateNodes      (INumber, size_t&) = 0;
  339.  
  340.   virtual
  341.   void     DeleteNodes      (void*) = 0;
  342.  
  343.   virtual
  344.   void     DestroyNodes     (void*, INumber = 1) const = 0;
  345.  
  346.   virtual
  347.   void*    StreamIn         (TStream&) const = 0;
  348.  
  349.   virtual
  350.   void     StreamOut        (void const*, TStream&) const = 0;
  351.  
  352.   virtual
  353.   void     Swap             (INumber, INumber) const = 0;
  354.  
  355.   virtual
  356.   TStream& operator<<=      (TStream&) = 0;
  357.  
  358.   virtual
  359.   TStream& operator>>=      (TStream&) const = 0;
  360.  
  361. protected:
  362.  
  363.            IASequenceAsTableOps
  364.                             (IBoolean);
  365.  
  366.   static
  367.   ITableImpl&
  368.            TableOf          (ISequenceAsTableImpl const&);
  369.  
  370.   void     UpdateMngCursorsForAssign
  371.                             (ISequenceAsTableImpl const&,
  372.                              INumber, INumber) const;
  373.  
  374.   void     UpdateMngCursorsForCopyFrom
  375.                             (ISequenceAsTableImpl const&,
  376.                              INumber, INumber) const;
  377.  
  378.   void     UpdateMngCursorsForPredRemove
  379.                             (ISequenceAsTableImpl const&,
  380.                              INumber, INumber) const;
  381.  
  382.   void     UpdateMngCursorsForRemoveOf
  383.                             (ISequenceAsTableImpl const&,
  384.                              INumber) const;
  385.  
  386.   void     UpdateMngCursorsForShiftLeftOf
  387.                             (ISequenceAsTableImpl const&,
  388.                              INumber) const;
  389.  
  390.   void     UpdateMngCursorsForShiftRightOf
  391.                             (ISequenceAsTableImpl const&,
  392.                              INumber) const;
  393.  
  394.   void     UpdateMngCursorsForSwap
  395.                             (ISequenceAsTableImpl const&,
  396.                              INumber, INumber) const;
  397.  
  398. private:
  399.  
  400.   IBoolean ivContainsDTSObjects;
  401.  
  402.   friend
  403.   class    ISequenceAsTableImpl;
  404.  
  405.  
  406. };
  407.  
  408. template <class Element, class ElementOps, class Implementation>
  409. class ISequenceAsTableOps : public IASequenceAsTableOps {
  410.  
  411.   typedef  IASequenceAsTableOps Inherited;
  412.  
  413.   typedef  ISequenceAsTableOps
  414.             <Element, ElementOps, Implementation> Self;
  415.  
  416.   typedef  ISequenceAsTableNodeImpl <Element> Node;
  417.  
  418. public:
  419.  
  420.   typedef  Implementation ImplType;
  421.  
  422.   typedef  Element ElementType;
  423.  
  424.   typedef  void KeyType;
  425.  
  426.            ISequenceAsTableOps
  427.                             (INumber);
  428.  
  429.            ISequenceAsTableOps
  430.                             (INumber, void*);
  431.  
  432.            ISequenceAsTableOps
  433.                             (ISequenceAsTableOps
  434.                               <Element, ElementOps,
  435.                                Implementation> const&);
  436.  
  437.           ~ISequenceAsTableOps
  438.                             ();
  439.  
  440.   void     Assign           (void*, void const*) const;
  441.  
  442.   void     BlockLeft        (INumber, INumber);
  443.  
  444.   void     BlockRight       (INumber, INumber);
  445.  
  446.   IACollectionImpl*
  447.            Clone            () const;
  448.  
  449.   void     CopyFrom         (ITableImpl const&);
  450.  
  451.   void     ConstructNode    (void*, void const*) const;
  452.  
  453.   void*    CreateNodes      (INumber, size_t&);
  454.  
  455.   void     DeleteNodes      (void*);
  456.  
  457.   void     DestroyNodes     (void*, INumber) const;
  458.  
  459.   void*    StreamIn         (TStream&) const;
  460.  
  461.   void     StreamOut        (void const*, TStream&) const;
  462.  
  463.   void     Swap             (INumber, INumber) const;
  464.  
  465.   TStream& operator<<=      (TStream&);
  466.  
  467.   TStream& operator>>=      (TStream&) const;
  468.  
  469.            operator Implementation*
  470.                             ();
  471.  
  472.  
  473. protected:
  474.  
  475. private:
  476.  
  477.   ElementOps
  478.            ivElementOps;
  479.  
  480.   Implementation
  481.            ivImpl;
  482.  
  483.  
  484. };
  485.  
  486. #pragma SOMAsDefault (pop)
  487.  
  488. #include <iiseqtab.inl>
  489.  
  490. #if ! defined (__TEMPINC__)
  491. #include <iiseqtab.c>
  492. #endif
  493.  
  494. #pragma info (restore)
  495. #pragma pack ()
  496.  
  497. #endif
  498.