home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ssvpar.zip / SSREF.INL < prev    next >
Text File  |  1994-11-13  |  2KB  |  74 lines

  1. /*---------------------------------------------------------------------------
  2.  
  3.                Copyright (c) 1994 SandStone Software Inc.
  4.                           All rights reserved
  5.  
  6. ----------------------------------------------------------------------------*/
  7.    SSInline SSRefCount::SSRefCount( void) : olCount( 1)
  8.       {
  9.       }
  10.  
  11.    template< class T> SSRef< T>::SSRef( void) : opType( 0)
  12.       {
  13.       }
  14.  
  15.    template< class T> SSRef< T>::SSRef( T* qpT) : opType( qpT)
  16.       {
  17.       if ( opType) opType->refInc();
  18.       }
  19.  
  20.    template< class T> SSRef< T>::SSRef( T& qT) : opType( &qT)
  21.       {
  22.       opType->refInc();
  23.       }
  24.  
  25.    template< class T> SSRef< T>::SSRef( SSRef< T>& qRef) : 
  26.       opType( qRef.opType)
  27.       {
  28.       if ( opType) opType->refInc();
  29.       }
  30.  
  31.    template< class T> SSRef< T>& SSRef< T>::operator=( SSRef< T>& qRef)
  32.       {
  33.       if ( qRef) qRef->refInc();
  34.       if ( opType) opType->refDec();
  35.       opType = qRef.opType;
  36.       return *this;
  37.       }
  38.  
  39.    template< class T> SSRef< T>& SSRef< T>::operator=( T* qpT)
  40.       {
  41.       if ( qpT) qpT->refInc();
  42.       if ( opType) opType->refDec();
  43.       opType = qpT;
  44.       return *this;
  45.       }
  46.  
  47.    template< class T> SSRef< T>& SSRef< T>::operator=( T& qT)
  48.       {
  49.       qT.refInc();
  50.       if ( opType) opType->refDec();
  51.       opType = &qT;
  52.       return *this;
  53.       }
  54.  
  55.    template< class T> SSRef< T>::operator T*( void)
  56.       {
  57.       return opType;
  58.       }
  59.  
  60.    template< class T> T& SSRef< T>::operator*( void)
  61.       {
  62.       return *opType;
  63.       }
  64.  
  65.    template< class T> T* SSRef< T>::operator->( void)
  66.       {
  67.       return opType;
  68.       }
  69.  
  70.    template< class T> SSRef< T>::~SSRef( void)
  71.       {
  72.       if ( opType) opType->refDec();
  73.       }
  74.