home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tlx501.zip / TEMPLATE / PTRVECT.CPP < prev    next >
C/C++ Source or Header  |  1996-01-05  |  3KB  |  98 lines

  1. /****************************************************************************
  2.     $Id: ptrvect.cpp 501.0 1995/03/07 12:27:00 RON Exp $
  3.  
  4.     Copyright (c) 1991-95 Tarma Software Research. All rights reserved.
  5.  
  6.     Project:    Tarma Library for C++ V5.0
  7.     Author:    Ron van der Wal
  8.  
  9.     Implementation of class TLPtrVector<T>.
  10.  
  11.     $Log: ptrvect.cpp $
  12.     Revision 501.0  1995/03/07 12:27:00  RON
  13.     Updated for TLX 5.01
  14.     Revision 1.5  1995/01/31 16:30:46  RON
  15.     Update for release 012
  16.     Added partial support for SunPro C++ compiler
  17.     Revision 1.4  1994/09/28  14:41:27  ron
  18.     Removed Macintosh-style #include references
  19.  
  20.     Revision 1.3  1994/09/27  20:27:27  ron
  21.     Changed path separator from / to \
  22.  
  23.     Revision 1.2  1994/09/26  15:33:40  ron
  24.     Changed include file references
  25.  
  26.     Revision 1.1  1994/08/16  18:15:29  ron
  27.     Initial revision
  28.  
  29. ****************************************************************************/
  30.  
  31. #ifndef _TLX_PTRVECT_CPP
  32. #define _TLX_PTRVECT_CPP
  33.  
  34. //----- System headers
  35.  
  36. //----- Project headers
  37.  
  38. #ifndef _TLX_PTRARRAY_H
  39. #include <tlx\501\ptrarray.h>    // Class declaration
  40. #endif
  41.  
  42. /*-------------------------------------------------------------------------*/
  43.     template<class T> TLPtrVector<T>::TLPtrVector(size_t aSize)
  44.  
  45. /*  Constructor to create vector of specified size; also doubles as default
  46.     constructor.
  47. ---------------------------------------------------------------------------*/
  48. : TLVPVector(aSize)
  49. {
  50.     SetDelete(DeleteT);
  51. }
  52.  
  53. /*-------------------------------------------------------------------------*/
  54.     template<class T> TLPtrVector<T>::TLPtrVector(T *aPtr)
  55.  
  56. /*  Constructor that initializes a vector of 1 element.
  57. ---------------------------------------------------------------------------*/
  58. : TLVPVector(aPtr)
  59. {
  60.     SetDelete(DeleteT);
  61. }
  62.  
  63. /*-------------------------------------------------------------------------*/
  64.     template<class T> TLPtrVector<T>::TLPtrVector(T **aVector, size_t aSize)
  65.  
  66. /*  Constructor that initializes a vector from a corresponding C-style
  67.     vector.
  68. ---------------------------------------------------------------------------*/
  69. : TLVPVector((void **)aVector, aSize)
  70. {
  71.     SetDelete(DeleteT);
  72. }
  73.  
  74. /*-------------------------------------------------------------------------*/
  75.     template<class T> TLPtrVector<T>::TLPtrVector
  76.     (
  77.         const TLPtrVector<T> &    aVector
  78.     )
  79.  
  80. /*  Copy constructor.
  81. ---------------------------------------------------------------------------*/
  82. : TLVPVector(aVector)
  83. {
  84.     SetDelete(DeleteT);
  85. }
  86.  
  87. /*-------------------------------------------------------------------------*/
  88.     template<class T> void TLPtrVector<T>::DeleteT(void *aPtr)
  89.  
  90. /*  Static member function that is used for deletion of T * elements
  91.     in vectors and the like.
  92. ---------------------------------------------------------------------------*/
  93. {
  94.     delete (T *)aPtr;
  95. }
  96.  
  97. #endif    // _TLX_PTRVECT_CPP
  98.