home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 6.ddi / MWHC.006 / T1 < prev    next >
Encoding:
Text File  |  1992-06-07  |  1.2 KB  |  48 lines

  1. #ifndef __RWREF_H__
  2. #define __RWREF_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * Base class for reference counted objects.  Inherits from RWMemoryPool.
  7.  *
  8.  * $Header:   E:/vcs/rw/ref.h_v   1.0   11 Mar 1992 14:09:58   KEFFER  $
  9.  *
  10.  ****************************************************************************
  11.  *
  12.  * Rogue Wave Software, Inc.
  13.  * P.O. Box 2328
  14.  * Corvallis, OR 97339
  15.  *
  16.  * Copyright (C) 1992. This software is subject to copyright 
  17.  * protection under the laws of the United States and other countries.
  18.  *
  19.  ***************************************************************************
  20.  *
  21.  * $Log:   E:/vcs/rw/ref.h_v  $
  22.  * 
  23.  *    Rev 1.0   11 Mar 1992 14:09:58   KEFFER
  24.  * Initial revision.
  25.  */
  26.  
  27. #ifndef __RWMEMPOOL_H__
  28. #  include "rw/mempool.h"
  29. #endif
  30.  
  31. class RWExport RWReference : public RWMemoryPool {
  32.  
  33. public:
  34.  
  35.   RWReference() : _refs(1) { }    // Start w. one reference
  36.   void            addReference()        {_refs++;}
  37.   unsigned short    references()        {return _refs;}
  38.   unsigned short    removeReference()    {return --_refs;}
  39.  
  40. private:
  41.  
  42.   unsigned short    _refs;        // Number of references to this block
  43.  
  44. };
  45.  
  46. pragma pop_align_members();
  47. #endif    /* __RWREF_H__ */
  48.