home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 12.ddi / CLASSINC.PAK / ARRAYS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  26.3 KB  |  843 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*  ARRAYS.H                                                              */
  4. /*                                                                        */
  5. /*  Copyright (c) 1991, 1993 Borland International                        */
  6. /*  All Rights Reserved                                                   */
  7. /*                                                                        */
  8. /*------------------------------------------------------------------------*/
  9.  
  10. #if !defined( __CLASSLIB_ARRAYS_H )
  11. #define __CLASSLIB_ARRAYS_H
  12.  
  13. //#define TEMPLATES
  14.  
  15. #if !defined( __MEM_H )
  16. #include <mem.h>
  17. #endif  // __MEM_H
  18.  
  19. #if !defined( __CLASSLIB_DEFS_H )
  20. #include "classlib\defs.h"
  21. #endif  // __CLASSLIB_DEFS_H
  22.  
  23. #if !defined( __CLASSLIB_SHDDEL_H )
  24. #include "classlib\shddel.h"
  25. #endif  // __CLASSLIB_SHDDEL_H
  26.  
  27. #if !defined( __CLASSLIB_ALLOCTR_H )
  28. #include "classlib\alloctr.h"
  29. #endif  // __CLASSLIB_ALLOCTR_H
  30.  
  31. #if !defined( __CLASSLIB_VECTIMP_H )
  32. #include "classlib\vectimp.h"
  33. #endif  // __CLASSLIB_VECTIMP_H
  34.  
  35. #pragma option -Vo-
  36. #if defined( BI_CLASSLIB_NO_po )
  37. #pragma option -po-
  38. #endif
  39.  
  40. /*------------------------------------------------------------------------*/
  41. /*                                                                        */
  42. /*  [INTERNAL USE ONLY]                                                   */
  43. /*                                                                        */
  44. /*  template <class Vect, class T> class TArrayAsVectorImp                */
  45. /*                                                                        */
  46. /*  Implements the type-independent array operations, using a vector      */
  47. /*  as the underlying implementation.  The type Vect specifies the        */
  48. /*  form of the vector, either a TCVectorImp<T0>, a TSVectorImp<T0>, a    */
  49. /*  TICVectorImp<T0>, or a TISVectorImp<T0>.  The type T specifies the    */
  50. /*  type of the objects to be put in the array.  When using               */
  51. /*  TCVectorImp<T0> or a TSVectorImp<T0> T should be the same as T0. When */
  52. /*  using TICVectorImp<T0> or TISVectorImp<T0> T should be of type        */
  53. /*  pointer to T0.  See TArrayAsVector and                                */
  54. /*  TIArrayAsVector for examples.                                         */
  55. /*                                                                        */
  56. /*------------------------------------------------------------------------*/
  57.  
  58. template <class Vect, class T> class TArrayAsVectorImp
  59. {
  60.  
  61. public:
  62.  
  63.     TArrayAsVectorImp( int upper, int lower, int delta ) :
  64.         Data( upper-lower+1,delta ),
  65.         Lowerbound( lower )
  66.         {
  67.         }
  68.  
  69.     int LowerBound() const
  70.         {
  71.         return Lowerbound;
  72.         }
  73.  
  74.     int UpperBound() const
  75.         {
  76.         return BoundBase( Data.Limit() )-1;
  77.         }
  78.  
  79.     unsigned ArraySize() const
  80.         {
  81.         return Data.Limit();
  82.         }
  83.  
  84.     int IsFull() const
  85.         {
  86.         return Data.GetDelta() == 0 && Data.Count() >= Data.Limit();
  87.         }
  88.  
  89.     int IsEmpty() const
  90.         {
  91.         return Data.Count() == 0;
  92.         }
  93.  
  94.     unsigned GetItemsInContainer() const
  95.         {
  96.         return Data.Count();
  97.         }
  98.  
  99. #if defined( BI_OLDNAMES )
  100.     int lowerBound() const { return LowerBound(); }
  101.     int upperBound() const { return UpperBound(); }
  102.     unsigned arraySize() const { return ArraySize(); }
  103.     int isFull() const { return IsFull(); }
  104.     int isEmpty() const { return IsEmpty(); }
  105.     unsigned getItemsInContainer() const { return GetItemsInContainer(); }
  106. #endif  // BI_OLDNAMES
  107.  
  108.     void Reallocate( unsigned sz, unsigned offset = 0 )
  109.         {
  110.         Data.Resize( sz, offset );
  111.         }
  112.  
  113.  
  114.     void SetData( int loc, const T& t )
  115.         {
  116.         PRECONDITION( loc >= Lowerbound && loc <= UpperBound() );
  117.         Data[ ZeroBase(loc) ] = t;
  118.         }
  119.  
  120.     void RemoveEntry( int loc )
  121.         {
  122.         SqueezeEntry( ZeroBase(loc) );
  123.         }
  124.  
  125.     void SqueezeEntry( unsigned loc )
  126.         {
  127.         PRECONDITION( loc < Data.Count() );
  128.         Data.Detach( loc );
  129.         }
  130.  
  131.     unsigned ZeroBase( int loc ) const
  132.         {
  133.         return loc - Lowerbound;
  134.         }
  135.  
  136.     int BoundBase( unsigned loc ) const
  137.         {
  138.         return loc == UINT_MAX ? INT_MAX : loc + Lowerbound;
  139.         }
  140.  
  141.     void Grow( int loc )
  142.         {
  143.         if( loc < LowerBound() )
  144.             Reallocate( ArraySize() + (loc - Lowerbound) );
  145.         else if( loc >= BoundBase( Data.Limit()) )
  146.             Reallocate( ZeroBase(loc) );
  147.         }
  148.  
  149.     int Lowerbound;
  150.  
  151.     Vect Data;
  152.  
  153. };
  154.  
  155. /*------------------------------------------------------------------------*/
  156. /*                                                                        */
  157. /*  [INTERNAL USE ONLY]                                                   */
  158. /*                                                                        */
  159. /*  template <class Vect, class T> class TDArrayAsVectorImp               */
  160. /*                                                                        */
  161. /*  Implements the fundamental array operations for direct arrays, using  */
  162. /*  a vector as the underlying implementation.                            */
  163. /*                                                                        */
  164. /*------------------------------------------------------------------------*/
  165.  
  166. template <class Vect, class T> class TDArrayAsVectorImp :
  167.     public TArrayAsVectorImp<Vect,T>
  168. {
  169.  
  170. public:
  171.  
  172.     typedef void (*IterFunc)(T&, void *);
  173.     typedef int  (*CondFunc)(const T&, void *);
  174.  
  175.     TDArrayAsVectorImp( int upper, int lower, int delta ) :
  176.         TArrayAsVectorImp<Vect,T>( upper, lower, delta )
  177.         {
  178.         }
  179.  
  180.     int Add( const T& t )
  181.         {
  182.         return Data.Add(t);
  183.         }
  184.  
  185.     int Detach( const T& t )
  186.         {
  187.         return Data.Detach(t);
  188.         }
  189.  
  190.     int Detach( int loc )
  191.         {
  192.         return Data.Detach( ZeroBase(loc) );
  193.         }
  194.  
  195.     int Destroy( const T& t )
  196.         {
  197.         return Detach(t);
  198.         }
  199.  
  200.     int Destroy( int loc )
  201.         {
  202.         return Detach(loc);
  203.         }
  204.  
  205.     int HasMember( const T& t ) const
  206.         {
  207.         return Data.Find(t) != UINT_MAX;
  208.         }
  209.  
  210.     int Find( const T& t ) const
  211.         {
  212.         return BoundBase( Data.Find( t ) );
  213.         }
  214.  
  215.     T& operator []( int loc )
  216.         {
  217.         Grow( loc+1 );
  218.         return Data[ZeroBase(loc)];
  219.         }
  220.  
  221.     T& operator []( int loc ) const
  222.         {
  223.         PRECONDITION( loc >= Lowerbound && ZeroBase(loc) < Data.Count() );
  224.         return Data[ZeroBase(loc)];
  225.         }
  226.  
  227.     void ForEach( IterFunc iter, void *args )
  228.         {
  229.         if( !IsEmpty() )
  230.             Data.ForEach( iter, args );
  231.         }
  232.  
  233.     T *FirstThat( CondFunc cond, void *args ) const
  234.         {
  235.         if( IsEmpty() )
  236.             return 0;
  237.         return Data.FirstThat( cond, args );
  238.         }
  239.  
  240.     T *LastThat( CondFunc cond, void *args ) const
  241.         {
  242.         if( IsEmpty() )
  243.             return 0;
  244.         return Data.LastThat( cond, args );
  245.         }
  246.  
  247.     void Flush()
  248.         {
  249.         Data.Flush();
  250.         }
  251.  
  252. #if defined( BI_OLDNAMES )
  253.     int add( const T& t ) { return Add(t); }
  254.     int detach( const T& t,TShouldDelete::DeleteType=TShouldDelete::NoDelete)
  255.         { return Detach(t); }
  256.     int detach( int loc,TShouldDelete::DeleteType=TShouldDelete::NoDelete)
  257.         { return Detach(loc); }
  258.     int destroy( const T& t ) { return Destroy(t); }
  259.     int destroy( int loc,TShouldDelete::DeleteType ) { return Destroy(loc); }
  260.     int hasMember( const T& t ) const { return HasMember(t); }
  261.     void forEach( IterFunc iter, void *args )
  262.         { ForEach( iter, args ); }
  263.     T *firstThat( CondFunc cond, void *args ) const
  264.         { return FirstThat( cond, args ); }
  265.     T *lastThat( CondFunc cond, void *args ) const
  266.         { return lastThat( cond, args ); }
  267.     void flush( TShouldDelete::DeleteType = TShouldDelete::DefDelete )
  268.         { Flush(); }
  269. #endif  // BI_OLDNAMES
  270.  
  271. protected:
  272.  
  273.     const T& ItemAt( int i ) const
  274.         {
  275.         return Data[ ZeroBase(i) ];
  276.         }
  277.  
  278. };
  279.  
  280. /*------------------------------------------------------------------------*/
  281. /*                                                                        */
  282. /*  [INTERNAL USE ONLY]                                                   */
  283. /*                                                                        */
  284. /*  template <class Vect, class T> class TIArrayAsVectorImp               */
  285. /*                                                                        */
  286. /*  Implements the fundamental array operations for indirect arrays,      */
  287. /*  using a vector as the underlying implementation.                      */
  288. /*                                                                        */
  289. /*------------------------------------------------------------------------*/
  290.  
  291. template <class Vect, class T> class TIArrayAsVectorImp :
  292.     public TArrayAsVectorImp<Vect,T *>, public TShouldDelete
  293. {
  294.  
  295. public:
  296.  
  297.     typedef void (*IterFunc)(T&, void *);
  298.     typedef int  (*CondFunc)(const T&, void *);
  299.  
  300.     TIArrayAsVectorImp( int upper, int lower, int delta ) :
  301.         TArrayAsVectorImp<Vect,T *>( upper, lower, delta )
  302.         {
  303.         }
  304.  
  305.     int Add( T *t )
  306.         {
  307.         return Data.Add(t);
  308.         }
  309.  
  310.     int Detach( T *t,
  311.                 TShouldDelete::DeleteType dt = TShouldDelete::NoDelete )
  312.         {
  313.         return Data.Detach(t,DelObj(dt));
  314.         }
  315.  
  316.     int Detach( int loc,
  317.                 TShouldDelete::DeleteType dt = TShouldDelete::NoDelete )
  318.         {
  319.         return Data.Detach( ZeroBase(loc), DelObj(dt) );
  320.         }
  321.  
  322.     int Destroy( T *t )
  323.         {
  324.         return Detach(t,TShouldDelete::Delete);
  325.         }
  326.  
  327.     int Destroy( int loc )
  328.         {
  329.         return Detach(loc,TShouldDelete::Delete);
  330.         }
  331.  
  332.     int HasMember( const T *t ) const
  333.         {
  334.         return Data.Find(t) != UINT_MAX;
  335.         }
  336.  
  337.     int Find( const T *t ) const
  338.         {
  339.         return BoundBase( Data.Find( t ) );
  340.         }
  341.  
  342.     T *& operator []( int loc )
  343.         {
  344.         Grow( loc+1 );
  345.         return Data[ZeroBase(loc)];
  346.         }
  347.  
  348.     T *& operator []( int loc ) const
  349.         {
  350.         PRECONDITION( loc >= Lowerbound && ZeroBase(loc) < Data.Count() );
  351.         return Data[ZeroBase(loc)];
  352.         }
  353.  
  354.     void ForEach( IterFunc iter, void *args )
  355.         {
  356.         if( !IsEmpty() )
  357.             Data.ForEach( iter, args );
  358.         }
  359.  
  360.     T *FirstThat( CondFunc cond, void *args ) const
  361.         {
  362.         if( IsEmpty() )
  363.             return 0;
  364.         return Data.FirstThat( cond, args );
  365.         }
  366.  
  367.     T *LastThat( CondFunc cond, void *args ) const
  368.         {
  369.         if( IsEmpty() )
  370.             return 0;
  371.         return Data.LastThat( cond, args );
  372.         }
  373.  
  374.     void Flush( DeleteType dt = DefDelete )
  375.         {
  376.         Data.Flush(DelObj(dt));
  377.         }
  378.  
  379. #if defined( BI_OLDNAMES )
  380.     int add( T *t ) { return Add(t); }
  381.     int detach( T *t,TShouldDelete::DeleteType dt =TShouldDelete::NoDelete)
  382.         { return Detach(t,dt); }
  383.     int detach( int loc,TShouldDelete::DeleteType dt =TShouldDelete::NoDelete)
  384.         { return Detach(loc,dt); }
  385.     int destroy( T *t ) { return Destroy(t); }
  386.     int destroy( int loc,TShouldDelete::DeleteType ) { return Destroy(loc); }
  387.     int hasMember( T *t ) const { return HasMember(t); }
  388.     void forEach( IterFunc iter, void *args )
  389.         { ForEach( iter, args ); }
  390.     T *firstThat( CondFunc cond, void *args ) const
  391.         { return FirstThat( cond, args ); }
  392.     T *lastThat( CondFunc cond, void *args ) const
  393.         { return lastThat( cond, args ); }
  394.     void flush( TShouldDelete::DeleteType = TShouldDelete::DefDelete )
  395.         { Flush(); }
  396. #endif  // BI_OLDNAMES
  397.  
  398. protected:
  399.  
  400.     T *& ItemAt( int i ) const
  401.         {
  402.         return Data[ ZeroBase(i) ];
  403.         }
  404.  
  405. };
  406.  
  407. /*------------------------------------------------------------------------*/
  408. /*                                                                        */
  409. /*  template <class T,class Alloc> class TMArrayAsVector                  */
  410. /*  template <class T,class Alloc> class TMArrayAsVectorIterator          */
  411. /*                                                                        */
  412. /*  Implements a managed array of objects of type T, using a vector as    */
  413. /*  the underlying implementation.                                        */
  414. /*                                                                        */
  415. /*------------------------------------------------------------------------*/
  416.  
  417. template <class T, class Alloc> class TMArrayAsVectorIterator;
  418.  
  419. template <class T, class Alloc> class TMArrayAsVector :
  420.     public TDArrayAsVectorImp<TMCVectorImp<T,Alloc>,T>
  421. {
  422.  
  423.     friend TMArrayAsVectorIterator<T,Alloc>;
  424.  
  425. public:
  426.  
  427.     TMArrayAsVector( int upper, int lower = 0, int delta = 0 ) :
  428.         TDArrayAsVectorImp<TMCVectorImp<T,Alloc>,T>( upper, lower, delta )
  429.         {
  430.         }
  431.  
  432.     int AddAt( const T& t, int loc )
  433.         {
  434.         return Data.AddAt( t, ZeroBase(loc) );
  435.         }
  436.  
  437. #if defined( BI_OLDNAMES )
  438.     int addAt( const T& t, int loc ) { return AddAt(t,loc); }
  439. #endif
  440.  
  441. };
  442.  
  443. template <class T, class Alloc> class TMArrayAsVectorIterator :
  444.     public TMCVectorIteratorImp<T,Alloc>
  445. {
  446.  
  447. public:
  448.  
  449.     TMArrayAsVectorIterator( const TMArrayAsVector<T,Alloc>& a ) :
  450.         TMCVectorIteratorImp<T,Alloc>( a.Data ) {}
  451.  
  452. };
  453.  
  454. #if defined( BI_OLDNAMES )
  455. #define BI_MArrayAsVector TMArrayAsVector
  456. #define BI_MArrayAsVectorIterator TMArrayAsVectorIterator
  457. #endif
  458.  
  459. /*------------------------------------------------------------------------*/
  460. /*                                                                        */
  461. /*  template <class T> class TArrayAsVector                               */
  462. /*  template <class T> class TArrayAsVectorIterator                       */
  463. /*                                                                        */
  464. /*  Implements an array of objects of type T, using a vector as the       */
  465. /*  underlying implementation and TStandardAllocator as its memory        */
  466. /*  manager.                                                              */
  467. /*                                                                        */
  468. /*------------------------------------------------------------------------*/
  469.  
  470. template <class T> class TArrayAsVector :
  471.     public TMArrayAsVector<T,TStandardAllocator>
  472. {
  473.  
  474. public:
  475.  
  476.     TArrayAsVector( int upper, int lower = 0, int delta = 0 ) :
  477.         TMArrayAsVector<T,TStandardAllocator>( upper, lower, delta )
  478.         {
  479.         }
  480.  
  481. };
  482.  
  483. template <class T> class TArrayAsVectorIterator :
  484.     public TMArrayAsVectorIterator<T,TStandardAllocator>
  485. {
  486.  
  487. public:
  488.  
  489.     TArrayAsVectorIterator( const TArrayAsVector<T>& a ) :
  490.         TMArrayAsVectorIterator<T,TStandardAllocator>(a)
  491.         {
  492.         }
  493.  
  494. };
  495.  
  496. #if defined( BI_OLDNAMES )
  497. #define BI_ArrayAsVector TArrayAsVector
  498. #define BI_ArrayAsVectorIterator TArrayAsVectorIterator
  499. #endif
  500.  
  501. /*------------------------------------------------------------------------*/
  502. /*                                                                        */
  503. /*  template <class T,class Alloc> class TMSArrayAsVector                 */
  504. /*  template <class T,class Alloc> class TMSArrayAsVectorIterator         */
  505. /*                                                                        */
  506. /*  Implements a managed, sorted array of objects of type T, using a      */
  507. /*  vector as the underlying implementation.                              */
  508. /*                                                                        */
  509. /*------------------------------------------------------------------------*/
  510.  
  511. template <class T, class Alloc> class TMSArrayAsVectorIterator;
  512.  
  513. template <class T, class Alloc> class TMSArrayAsVector :
  514.     public TDArrayAsVectorImp<TMSVectorImp<T,Alloc>,T>
  515. {
  516.  
  517.     friend TMSArrayAsVectorIterator<T,Alloc>;
  518.  
  519. public:
  520.  
  521.     TMSArrayAsVector( int upper, int lower = 0, int delta = 0 ) :
  522.         TDArrayAsVectorImp<TMSVectorImp<T,Alloc>,T>( upper, lower, delta )
  523.         {
  524.         }
  525.  
  526. };
  527.  
  528. template <class T, class Alloc> class TMSArrayAsVectorIterator :
  529.     public TMSVectorIteratorImp<T,Alloc>
  530. {
  531.  
  532. public:
  533.  
  534.     TMSArrayAsVectorIterator( const TMSArrayAsVector<T,Alloc>& a ) :
  535.         TMSVectorIteratorImp<T,Alloc>( a.Data ) {}
  536.  
  537. };
  538.  
  539. #if defined( BI_OLDNAMES )
  540. #define BI_MSArrayAsVector TMSArrayAsVector
  541. #define BI_MSArrayAsVectorIterator TMSArrayAsVectorIterator
  542. #endif
  543.  
  544. /*------------------------------------------------------------------------*/
  545. /*                                                                        */
  546. /*  template <class T> class TSArrayAsVector                              */
  547. /*  template <class T> class TSArrayAsVectorIterator                      */
  548. /*                                                                        */
  549. /*  Implements a sorted array of objects of type T, using a vector as     */
  550. /*  the underlying implementation and TStandardAllocator as its memory    */
  551. /*  manager.                                                              */
  552. /*                                                                        */
  553. /*------------------------------------------------------------------------*/
  554.  
  555. template <class T> class TSArrayAsVector :
  556.     public TMSArrayAsVector<T,TStandardAllocator>
  557. {
  558.  
  559. public:
  560.  
  561.     TSArrayAsVector( int upper, int lower = 0, int delta = 0 ) :
  562.         TMSArrayAsVector<T,TStandardAllocator>( upper, lower, delta )
  563.         {
  564.         }
  565.  
  566. };
  567.  
  568. template <class T> class TSArrayAsVectorIterator :
  569.     public TMSArrayAsVectorIterator<T,TStandardAllocator>
  570. {
  571.  
  572. public:
  573.  
  574.     TSArrayAsVectorIterator( const TSArrayAsVector<T>& a ) :
  575.         TMSArrayAsVectorIterator<T,TStandardAllocator>( a ) {}
  576.  
  577. }
  578.  
  579. #if defined( BI_OLDNAMES )
  580. #define BI_SArrayAsVector TSArrayAsVector
  581. #define BI_SArrayAsVectorIterator TArrayAsVectorIterator
  582. #endif
  583.  
  584. /*------------------------------------------------------------------------*/
  585. /*                                                                        */
  586. /*  template <class T,class Alloc> class TMIArrayAsVector                 */
  587. /*  template <class T,class Alloc> class TMIArrayAsVectorIterator         */
  588. /*                                                                        */
  589. /*  Implements a managed indirect array of objects of type T, using a     */
  590. /*  vector as the underlying implementation.                              */
  591. /*                                                                        */
  592. /*------------------------------------------------------------------------*/
  593.  
  594. template <class T, class Alloc> class TMIArrayAsVectorIterator;
  595.  
  596. template <class T, class Alloc> class TMIArrayAsVector :
  597.     public TIArrayAsVectorImp<TMICVectorImp<T,Alloc>,T>
  598. {
  599.  
  600.     friend TMIArrayAsVectorIterator<T,Alloc>;
  601.  
  602. public:
  603.  
  604.     TMIArrayAsVector( int upper, int lower = 0, int delta = 0 ) :
  605.         TIArrayAsVectorImp<TMICVectorImp<T,Alloc>,T>( upper, lower, delta )
  606.         {
  607.         }
  608.  
  609.     int AddAt( T *t, int loc )
  610.         {
  611.         return Data.AddAt( t, ZeroBase(loc) );
  612.         }
  613.  
  614. #if defined( BI_OLDNAMES )
  615.     int addAt( T *t, int loc ) { return AddAt(t,loc); }
  616. #endif
  617.  
  618. };
  619.  
  620. template <class T, class Alloc> class TMIArrayAsVectorIterator :
  621.     public TMICVectorIteratorImp<T,Alloc>
  622. {
  623.  
  624. public:
  625.  
  626.     TMIArrayAsVectorIterator( const TMIArrayAsVector<T,Alloc>& a ) :
  627.         TMICVectorIteratorImp<T,Alloc>( a.Data ) {}
  628.  
  629. };
  630.  
  631. #if defined( BI_OLDNAMES )
  632. #define BI_MIArrayAsVector TMIArrayAsVector
  633. #define BI_MIArrayAsVectorIterator TMIArrayAsVectorIterator
  634. #endif
  635.  
  636. /*------------------------------------------------------------------------*/
  637. /*                                                                        */
  638. /*  template <class T> class TIArrayAsVector                              */
  639. /*  template <class T> class TIArrayAsVectorIterator                      */
  640. /*                                                                        */
  641. /*  Implements an indirect array of objects of type T, using a vector as  */
  642. /*  the underlying implementation and TStandardAllocator as its memory    */
  643. /*  manager.                                                              */
  644. /*                                                                        */
  645. /*------------------------------------------------------------------------*/
  646.  
  647. template <class T> class TIArrayAsVector :
  648.     public TMIArrayAsVector<T,TStandardAllocator>
  649. {
  650.  
  651. public:
  652.  
  653.     TIArrayAsVector( int upper, int lower = 0, int delta = 0 ) :
  654.         TMIArrayAsVector<T,TStandardAllocator>( upper, lower, delta )
  655.         {
  656.         }
  657.  
  658. };
  659.  
  660. template <class T> class TIArrayAsVectorIterator :
  661.     public TMIArrayAsVectorIterator<T,TStandardAllocator>
  662. {
  663.  
  664. public:
  665.  
  666.     TIArrayAsVectorIterator( const TIArrayAsVector<T>& a ) :
  667.         TMIArrayAsVectorIterator<T,TStandardAllocator>(a)
  668.         {
  669.         }
  670.  
  671. };
  672.  
  673. #if defined( BI_OLDNAMES )
  674. #define BI_IArrayAsVector TIArrayAsVector
  675. #define BI_IArrayAsVectorIterator TIArrayAsVectorIterator
  676. #endif
  677.  
  678. /*------------------------------------------------------------------------*/
  679. /*                                                                        */
  680. /*  template <class T,class Alloc> class TMISArrayAsVector                */
  681. /*  template <class T,class Alloc> class TMISArrayAsVectorIterator        */
  682. /*                                                                        */
  683. /*  Implements a managed, indirect sorted array of objects of type T,     */
  684. /*  using a vector as the underlying implementation.                      */
  685. /*                                                                        */
  686. /*------------------------------------------------------------------------*/
  687.  
  688. template <class T, class Alloc> class TMISArrayAsVectorIterator;
  689.  
  690. template <class T, class Alloc> class TMISArrayAsVector :
  691.     public TIArrayAsVectorImp<TMISVectorImp<T,Alloc>,T>
  692. {
  693.  
  694.     friend TMISArrayAsVectorIterator<T,Alloc>;
  695.  
  696. public:
  697.  
  698.     TMISArrayAsVector( int upper, int lower = 0, int delta = 0 ) :
  699.         TIArrayAsVectorImp<TMISVectorImp<T,Alloc>,T>( upper, lower, delta )
  700.         {
  701.         }
  702.  
  703. };
  704.  
  705. template <class T, class Alloc> class TMISArrayAsVectorIterator :
  706.     public TMISVectorIteratorImp<T,Alloc>
  707. {
  708.  
  709. public:
  710.  
  711.     TMISArrayAsVectorIterator( const TMISArrayAsVector<T,Alloc>& a ) :
  712.         TMISVectorIteratorImp<T,Alloc>( a.Data ) {}
  713.  
  714. };
  715.  
  716. #if defined( BI_OLDNAMES )
  717. #define BI_MISArrayAsVector TMISArrayAsVector
  718. #define BI_MIArrayAsVectorIterator TMIArrayAsVectorIterator
  719. #endif
  720.  
  721. /*------------------------------------------------------------------------*/
  722. /*                                                                        */
  723. /*  template <class T> class TISArrayAsVector                             */
  724. /*  template <class T> class TISArrayAsVectorIterator                     */
  725. /*                                                                        */
  726. /*  Implements an indirect sorted array of objects of type T, using a     */
  727. /*  vector as the underlying implementation and TStandardAllocator as its */
  728. /*  memory manager.                                                       */
  729. /*                                                                        */
  730. /*------------------------------------------------------------------------*/
  731.  
  732. template <class T> class TISArrayAsVector :
  733.     public TMISArrayAsVector<T,TStandardAllocator>
  734. {
  735.  
  736. public:
  737.  
  738.     TISArrayAsVector( int upper, int lower = 0, int delta = 0 ) :
  739.         TMISArrayAsVector<T,TStandardAllocator>( upper, lower, delta )
  740.         {
  741.         }
  742.  
  743. };
  744.  
  745. template <class T> class TISArrayAsVectorIterator :
  746.     public TMISArrayAsVectorIterator<T,TStandardAllocator>
  747. {
  748.  
  749. public:
  750.  
  751.     TISArrayAsVectorIterator( const TISArrayAsVector<T>& a ) :
  752.         TMISArrayAsVectorIterator<T,TStandardAllocator>(a)
  753.         {
  754.         }
  755.  
  756. };
  757.  
  758. #if defined( BI_OLDNAMES )
  759. #define BI_ISArrayAsVector TISArrayAsVector
  760. #define BI_ISArrayAsVectorIterator TISArrayAsVectorIterator
  761. #endif
  762.  
  763. /*------------------------------------------------------------------------*/
  764. /*                                                                        */
  765. /*  template <class T> class TArray                                       */
  766. /*  template <class T> class TArrayIterator                               */
  767. /*                                                                        */
  768. /*  Easy names for TArrayAsVector and TArrayAsVectorIterator              */
  769. /*                                                                        */
  770. /*------------------------------------------------------------------------*/
  771.  
  772. template <class T> class TArray :
  773.     public TArrayAsVector<T>
  774. {
  775.  
  776. public:
  777.  
  778.     TArray( int upper, int lower = 0, int delta = 0 ) :
  779.         TArrayAsVector<T>( upper, lower, delta )
  780.         {
  781.         }
  782.  
  783. };
  784.  
  785. template <class T> class TArrayIterator :
  786.     public TArrayAsVectorIterator<T>
  787. {
  788.  
  789. public:
  790.  
  791.  
  792.     TArrayIterator( const TArray<T>& a ) :
  793.         TArrayAsVectorIterator<T>(a)
  794.         {
  795.         }
  796.  
  797. };
  798.  
  799. /*------------------------------------------------------------------------*/
  800. /*                                                                        */
  801. /*  template <class T> class TSArray                                      */
  802. /*  template <class T> class TSArrayIterator                              */
  803. /*                                                                        */
  804. /*  Easy names for TSArrayAsVector and TSArrayAsVectorIterator            */
  805. /*                                                                        */
  806. /*------------------------------------------------------------------------*/
  807.  
  808. template <class T> class TSArray :
  809.     public TSArrayAsVector<T>
  810. {
  811.  
  812. public:
  813.  
  814.     TSArray( int upper, int lower = 0, int delta = 0 ) :
  815.         TSArrayAsVector<T>( upper, lower, delta )
  816.         {
  817.         }
  818.  
  819. };
  820.  
  821. template <class T> class TSArrayIterator :
  822.     public TSArrayAsVectorIterator<T>
  823. {
  824.  
  825. public:
  826.  
  827.  
  828.     TSArrayIterator( const TSArray<T>& a ) :
  829.         TSArrayAsVectorIterator<T>(a)
  830.         {
  831.         }
  832.  
  833. };
  834.  
  835. #if defined( BI_CLASSLIB_NO_po )
  836. #pragma option -po.
  837. #endif
  838.  
  839. #pragma option -Vo.
  840.  
  841. #endif  // __CLASSLIB_ARRAYS_H
  842.  
  843.