home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iiseqdil.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  10.4 KB  |  455 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 _IISEQDIL_H
  19. #define _IISEQDIL_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 ISequenceAsDilTableNodeImpl {
  32.  
  33.   void*    ivPtr;
  34.  
  35.   Element  ivElement;
  36.  
  37.            ISequenceAsDilTableNodeImpl
  38.                             (Element const&);
  39.  
  40.           ~ISequenceAsDilTableNodeImpl
  41.                             ();
  42.  
  43.  
  44. };
  45.  
  46. struct IDilTableImpl : public ITableImpl {
  47.  
  48.   typedef  ISequenceAsDilTableNodeImpl <void*> Node;
  49.  
  50.   void*    ivUnused;
  51.  
  52.   void*    ElementAtIndex   (INumber) const;
  53.  
  54.   void     GetUnused        (INumber);
  55.  
  56.   void*&   PtrAtIndex       (INumber) const;
  57.  
  58.   void     PutUnused        (INumber);
  59.  
  60.   void     RemoveAtIndex    (INumber);
  61.  
  62. };
  63.  
  64. #pragma SOMAsDefault (pop)
  65. #pragma SOMAsDefault (off)
  66.  
  67. class ISequenceAsDilTableCursorImpl : public ICursorImpl {
  68.  
  69.   typedef  ICursorImpl Inherited;
  70.  
  71.   typedef  ISequenceAsDilTableCursorImpl Self;
  72.  
  73. public:
  74.  
  75.            ISequenceAsDilTableCursorImpl
  76.                             (IACollectionImpl const&);
  77.  
  78.            ISequenceAsDilTableCursorImpl
  79.                             (ISequenceAsDilTableCursorImpl const&);
  80.  
  81.           ~ISequenceAsDilTableCursorImpl
  82.                             ();
  83.  
  84.   ICursorImpl*
  85.            Clone            () const;
  86.  
  87.   void     Copy             (ICursorImpl const&);
  88.  
  89.   void     Invalidate       ();
  90.  
  91.   IBoolean IsInBetween      () const;
  92.  
  93.   IBoolean IsValid          () const;
  94.  
  95.   void     operator=        (ISequenceAsDilTableCursorImpl const&);
  96.  
  97.   IBoolean operator==       (ICursorImpl const&) const;
  98.  
  99. protected:
  100.  
  101. private:
  102.  
  103.   INumber  ivIndex;
  104.  
  105.   friend
  106.   class    ISequenceAsDilTableImpl;
  107.  
  108.  
  109. };
  110.  
  111.  
  112. class IASequenceAsDilTableOps;
  113.  
  114. class ISequenceAsDilTableImpl : public IASequenceImpl {
  115.  
  116.   typedef  IASequenceImpl Inherited;
  117.  
  118.   typedef  ISequenceAsDilTableImpl Self;
  119.  
  120. public:
  121.  
  122.   typedef  IASequenceAsDilTableOps Ops;
  123.  
  124.   typedef  ISequenceAsDilTableCursorImpl Cursor;
  125.  
  126.   typedef  ISequenceAsDilTableCursorImpl MngCursor;
  127.  
  128.            ISequenceAsDilTableImpl
  129.                             (Ops&, INumber);
  130.  
  131.            ISequenceAsDilTableImpl
  132.                             (Ops&, ISequenceAsDilTableImpl const&);
  133.  
  134.           ~ISequenceAsDilTableImpl
  135.                             ();
  136.  
  137.   IBoolean Add              (void const*, ICursorImpl&);
  138.  
  139.   void     AddAllFrom       (IACollectionImpl const&);
  140.  
  141.   void     AddAsFirst       (void const*, ICursorImpl&);
  142.  
  143.   void     AddAsLast        (void const*, ICursorImpl&);
  144.  
  145.   void     AddAsNext        (void const*, ICursorImpl&);
  146.  
  147.   void     AddAsPrevious    (void const*, ICursorImpl&);
  148.  
  149.   void     AddAtPosition    (IPosition, void const*, ICursorImpl&);
  150.  
  151.   IBoolean AllElementsDo    (IApplFunc, void*);
  152.  
  153.   void*    Any              () const;
  154.  
  155.   IBoolean CheckCursor      (ICursorImpl const&) const;
  156.  
  157.   char const*
  158.            ClassName        () const;
  159.  
  160.   IACollectionImpl*
  161.            Clone            () const;
  162.  
  163.   void     Copy             (IACollectionImpl const&);
  164.  
  165.   Cursor*  CreateCursor     () const;
  166.  
  167.   MngCursor*
  168.            CreateMngCursor  () const;
  169.  
  170.   void*    ElementAt        (ICursorImpl const&) const;
  171.  
  172.   void*    ElementAtPosition
  173.                             (IPosition) const;
  174.  
  175.   void*    First            () const;
  176.  
  177.   IBoolean IsBounded        () const;
  178.  
  179.   IBoolean IsConsistent     () const;
  180.  
  181.   IBoolean IsEmpty          () const;
  182.  
  183.   IBoolean IsFirstAt        (ICursorImpl const&) const;
  184.  
  185.   IBoolean IsFull           () const;
  186.  
  187.   IBoolean IsLastAt         (ICursorImpl const&) const;
  188.  
  189.   void*    Last             () const;
  190.  
  191.   INumber  NumberOfElements () const;
  192.  
  193.   IPosition
  194.            PositionAt       (ICursorImpl const&) const;
  195.  
  196.   INumber  RemoveAll        ();
  197.  
  198.   INumber  RemoveAll        (IPredFunc, void*);
  199.  
  200.   void     RemoveAt         (ICursorImpl&);
  201.  
  202.   void     RemoveAtPosition (IPosition);
  203.  
  204.   void     RemoveFirst      ();
  205.  
  206.   void     RemoveLast       ();
  207.  
  208.   void     ReplaceAt        (ICursorImpl const&, void const*);
  209.  
  210.   void     ReplaceAtPosition
  211.                             (IPosition position, void const*);
  212.  
  213.   void     Reverse          ();
  214.  
  215.   IBoolean SetToFirst       (ICursorImpl&) const;
  216.  
  217.   IBoolean SetToLast        (ICursorImpl&) const;
  218.  
  219.   IBoolean SetToNext        (ICursorImpl&) const;
  220.  
  221.   void     SetToPosition    (IPosition, ICursorImpl&) const;
  222.  
  223.   IBoolean SetToPrevious    (ICursorImpl&) const;
  224.  
  225.   void     Sort             (ICompFunc, void*);
  226.  
  227.   void     operator=        (ISequenceAsDilTableImpl const&);
  228.  
  229.   TStream& operator<<=      (TStream&);
  230.  
  231.   TStream& operator>>=      (TStream&) const;
  232.  
  233. protected:
  234.  
  235.   void     Assign           (void*, void const*) const;
  236.  
  237.   void*    CreateNodes      (INumber, size_t&) const;
  238.  
  239.   void     ConstructNode    (void*, void const*) const;
  240.  
  241.   void     DeleteNodes      (void*) const;
  242.  
  243.   void     DestroyNode      (void*) const;
  244.  
  245.   void*    StreamIn         (TStream&) const;
  246.  
  247.   void     StreamOut        (void const*, TStream&) const;
  248.  
  249. private:
  250.  
  251.   enum { kOriginalVersion };
  252.  
  253.   static
  254.   char const*
  255.            cvClassName;
  256.  
  257.   MngCursor*
  258.            ivMngCursors;
  259.  
  260.   IDilTableImpl
  261.            ivTable;
  262.  
  263.   virtual
  264.   void     CopyFrom         (ISequenceAsDilTableImpl const&);
  265.  
  266.   void*    ElementOf        (void const*) const;
  267.  
  268.   void     GrowBy           (INumber);
  269.  
  270.   static
  271.   INumber& IndexOf          (ICursorImpl const&);
  272.  
  273.   void     Initialize       (INumber);
  274.  
  275.   static
  276.   IBoolean IsInBetween      (ICursorImpl const&);
  277.  
  278.   IBoolean IsRemoved        (INumber) const;
  279.  
  280.   void     MakeFree         (INumber&);
  281.  
  282.   static
  283.   INumber& NextIndexOf      (ICursorImpl const&);
  284.  
  285.   static
  286.   Ops&     OpsOf            (ISequenceAsDilTableImpl const&);
  287.  
  288.   IPosition
  289.            PositionAtIndex  (INumber) const;
  290.  
  291.   static
  292.   INumber& PreviousIndexOf  (ICursorImpl const&);
  293.  
  294.   void     RemoveAtIndex    (INumber);
  295.  
  296.   void     SetInBetween     (MngCursor&) const;
  297.  
  298.   IBoolean SetToNextIndex   (INumber&) const;
  299.  
  300.   IBoolean SetToPreviousIndex
  301.                             (INumber&) const;
  302.  
  303.   void     UpdateMngCursorsForCopyFrom
  304.                             (INumber, INumber) const;
  305.  
  306.   void     UpdateMngCursorsForGrowBy
  307.                             () const;
  308.  
  309.   void     UpdateMngCursorsForRemoveOf
  310.                             (INumber) const;
  311.  
  312.   void     UpdateMngCursorsForSwap
  313.                             (INumber, INumber) const;
  314.  
  315.   friend
  316.   class    ISequenceAsDilTableMngCursorImpl;
  317.  
  318.  
  319. };
  320.  
  321. class IASequenceAsDilTableOps {
  322. public:
  323.  
  324.   virtual ~IASequenceAsDilTableOps
  325.                             ();
  326.  
  327.   virtual
  328.   void     Assign           (void*, void const*) const = 0;
  329.  
  330.   virtual
  331.   IACollectionImpl*
  332.            Clone            () const = 0;
  333.  
  334.   virtual
  335.   void*    CreateNodes      (INumber, size_t&) const = 0;
  336.  
  337.   virtual
  338.   void     ConstructNode    (void*, void const*) const = 0;
  339.  
  340.   virtual
  341.   void     DeleteNodes      (void*) const = 0;
  342.  
  343.   virtual
  344.   void     DestroyNode      (void*) 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.   TStream& operator<<=      (TStream&) = 0;
  354.  
  355.   virtual
  356.   TStream& operator>>=      (TStream&) const = 0;
  357.  
  358. protected:
  359.  
  360.            IASequenceAsDilTableOps
  361.                             (IBoolean);
  362.  
  363. private:
  364.  
  365.   IBoolean ivContainsDTSObjects;
  366.  
  367.   friend
  368.   class    ISequenceAsDilTableImpl;
  369.  
  370.  
  371. };
  372.  
  373. template <class Element, class ElementOps, class Implementation>
  374. class ISequenceAsDilTableOps : public IASequenceAsDilTableOps {
  375.  
  376.   typedef  IASequenceAsDilTableOps Inherited;
  377.  
  378.   typedef  ISequenceAsDilTableOps
  379.             <Element, ElementOps, Implementation> Self;
  380.  
  381.   typedef  ISequenceAsDilTableNodeImpl <Element> Node;
  382.  
  383. public:
  384.  
  385.   typedef  Implementation ImplType;
  386.  
  387.   typedef  Element ElementType;
  388.  
  389.   typedef  void KeyType;
  390.  
  391.            ISequenceAsDilTableOps
  392.                             (INumber);
  393.  
  394.            ISequenceAsDilTableOps
  395.                             (INumber, void*);
  396.  
  397.            ISequenceAsDilTableOps
  398.                             (ISequenceAsDilTableOps
  399.                               <Element, ElementOps,
  400.                                Implementation> const&);
  401.  
  402.           ~ISequenceAsDilTableOps
  403.                             ();
  404.  
  405.   void     Assign           (void*, void const*) const;
  406.  
  407.   IACollectionImpl*
  408.            Clone            () const;
  409.  
  410.   void*    CreateNodes      (INumber, size_t&) const;
  411.  
  412.   void     ConstructNode    (void*, void const*) const;
  413.  
  414.   void     DeleteNodes      (void*) const;
  415.  
  416.   void     DestroyNode      (void*) const;
  417.  
  418.   void*    StreamIn         (TStream&) const;
  419.  
  420.   void     StreamOut        (void const*, TStream&) const;
  421.  
  422.   TStream& operator<<=      (TStream&);
  423.  
  424.   TStream& operator>>=      (TStream&) const;
  425.  
  426.            operator Implementation*
  427.                             ();
  428.  
  429.  
  430. protected:
  431.  
  432. private:
  433.  
  434.   ElementOps
  435.            ivElementOps;
  436.  
  437.   Implementation
  438.            ivImpl;
  439.  
  440.  
  441. };
  442.  
  443. #pragma SOMAsDefault (pop)
  444.  
  445. #include <iiseqdil.inl>
  446.  
  447. #if ! defined (__TEMPINC__)
  448. #include <iiseqdil.c>
  449. #endif
  450.  
  451. #pragma info (restore)
  452. #pragma pack ()
  453.  
  454. #endif
  455.