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

  1. #ifndef  __RWSTACKCOL_H__
  2. #define  __RWSTACKCOL_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * Declarations for a Stack of RWCollectables, implemented as a Singly-linked list.
  7.  *
  8.  * $Header:   E:/vcs/rw/stackcol.h_v   1.3   04 Mar 1992 09:04:48   KEFFER  $
  9.  *
  10.  ****************************************************************************
  11.  *
  12.  * Rogue Wave 
  13.  * P.O. Box 2328
  14.  * Corvallis, OR 97339
  15.  * Voice: (503) 754-3010    FAX: (503) 757-6650
  16.  *
  17.  * Copyright (C) 1989, 1990, 1991. This software is subject to copyright 
  18.  * protection under the laws of the United States and other countries.
  19.  *
  20.  ***************************************************************************
  21.  *
  22.  * $Log:   E:/vcs/rw/stackcol.h_v  $
  23.  * 
  24.  *    Rev 1.3   04 Mar 1992 09:04:48   KEFFER
  25.  * nil changed to rwnil
  26.  * 
  27.  *    Rev 1.2   18 Feb 1992 09:54:48   KEFFER
  28.  * 
  29.  *    Rev 1.1   28 Oct 1991 09:08:24   keffer
  30.  * Changed inclusions to <rw/xxx.h>
  31.  * 
  32.  *    Rev 1.0   28 Jul 1991 08:17:26   keffer
  33.  * Tools.h++ V4.0.5 PVCS baseline version
  34.  *
  35.  */
  36.  
  37. /*
  38.  * Restricted interface to class RWSlistCollectables to implement a
  39.  * last in first out (LIFO) stack.
  40.  */
  41.  
  42. #include "rw/slistcol.h"
  43.  
  44. class RWExport RWSlistCollectablesStack : public RWSlistCollectables {
  45. public:
  46.   RWSlistCollectablesStack();
  47.   RWSlistCollectablesStack(RWCollectable* a) : RWSlistCollectables(a) { }
  48.  
  49.   /************* Virtual functions inherited from RWSlistCollectables ***********/
  50. //virtual void            apply(RWapplyCollectable ap, void* x) 
  51. //virtual void             clear();
  52. //virtual void            clearAndDestroy();
  53. //virtual RWBoolean         contains(const RWCollectable* a) const;
  54. //RWBoolean            containsReference(const RWCollectable* a) const'
  55. //virtual unsigned        entries() const;
  56. //virtual RWCollectable*     first() const    // Same as top()
  57. //virtual RWCollectable*    get()        // Same as pop()
  58.   virtual RWCollectable*    insert(RWCollectable* a)    // Same as push()
  59.     { return prepend(a); }
  60.   virtual ClassID        isA() const {return __RWSLISTCOLLECTABLESSTACK;}
  61. //virtual RWBoolean        isEmpty() const 
  62. //virtual RWCollectable*    last() const    // Return value at bottom of stack
  63.   virtual RWCollectable*    newSpecies() const;
  64. //virtual unsigned        occurrencesOf(const RWCollectable* a) const
  65. //unsigned            occurrencesOfReference(const RWCollectable* a) const
  66. //virtual RWCollectable*    prepend(RWCollectable*);
  67.   virtual void            restoreGuts(RWvistream&);
  68.   virtual void            restoreGuts(RWFile&);
  69.   virtual RWCollectable*    remove(const RWCollectable*) // Treated as pop(); argument ignored
  70.     {return RWSlistCollectables::get();}
  71.  
  72.   /********************* Special functions **************************/
  73.   void                push(RWCollectable* a)    {RWSlistCollectables::prepend(a);}
  74.   RWCollectable*        pop()               {return RWSlistCollectables::get();}
  75.   RWCollectable*        top() const         {return RWSlistCollectables::first();}
  76.  
  77. private:
  78.   /******************** Disallowed functions ************************/
  79.   virtual RWCollectable*    append(RWCollectable*)        {return rwnil;}
  80.   virtual RWCollectable*&    at(int i)            {return RWSlistCollectables::at(i);}
  81. #ifdef CONST_OVERLOADS
  82.   virtual const RWCollectable*    at(int) const            {return rwnil;}
  83. #endif
  84.   virtual RWCollectable*    find(const RWCollectable*) const        {return rwnil;}
  85.   RWCollectable*        findReference(const RWCollectable*) const    {return rwnil;}
  86.   virtual int            index(const RWCollectable*) const        {return -1;}
  87.   RWCollectable*        removeReference(const RWCollectable*)    {return rwnil;}
  88.   virtual void            removeAndDestroy(const RWCollectable*)    { }
  89. };                                                              
  90.  
  91. pragma pop_align_members();
  92. #endif /* __RWSTACKCOL_H__ */
  93.