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

  1. #ifndef  __RWGSTACK_H__
  2. #define  __RWGSTACK_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * Declarations for a Generic Stack, implemented as a Singly-linked list.
  7.  *
  8.  * $Header:   E:/vcs/rw/gstack.h_v   1.3   18 Feb 1992 19:23:02   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/gstack.h_v  $
  23.  * 
  24.  *    Rev 1.3   18 Feb 1992 19:23:02   KEFFER
  25.  * Now includes "rw/generic.h".
  26.  * Class tag is now RWExport instead of huge.
  27.  * 
  28.  *    Rev 1.2   28 Oct 1991 09:08:16   keffer
  29.  * Changed inclusions to <rw/xxx.h>
  30.  * 
  31.  *    Rev 1.1   09 Oct 1991 18:34:36   keffer
  32.  * Ported to Zortech V3.0
  33.  * 
  34.  *    Rev 1.0   28 Jul 1991 08:11:22   keffer
  35.  * Tools.h++ V4.0.5 PVCS baseline version
  36.  *
  37.  */
  38.  
  39. #include "rw/slist.h"
  40. #include "rw/generic.h"
  41.  
  42. #define GStack(type) name2(type,GStack)
  43.  
  44. #ifdef NO_ACCESS_ADJUSTMENT
  45.  
  46. #define GStackdeclare(type)                            \
  47. class RWExport GStack(type) : private RWSlist {                    \
  48. public:                                        \
  49.   GStack(type)() { }                                \
  50.   GStack(type)(type* a) : RWSlist(a) { }                    \
  51.   GStack(type)(const GStack(type)& q) : RWSlist(q) { }                \
  52.   void operator=(const GStack(type)& q) { RWSlist::operator=(q);}        \
  53.                                         \
  54.   void push(type* a)         {RWSlist::prepend(a);}                \
  55.   type* pop()                {return (type*)RWSlist::get();}            \
  56.   type* top() const          {return (type*)RWSlist::first();}            \
  57.   void clear() {RWSlist::clear();}                        \
  58.   RWBoolean contains(RWBoolean (*t)(const type*, const void*), const void* a) const    \
  59.     {return RWSlist::contains((RWtestGeneric)t, a);}                \
  60.   RWBoolean containsReference(const type* a) const                \
  61.     {return RWSlist::containsReference(a);}                    \
  62.   unsigned entries() const { return RWSlist::entries(); }            \
  63.   type* insert(type* a)        {return (type*)RWSlist::insert(a);}        \
  64.   RWBoolean isEmpty() const { return RWSlist::isEmpty(); }            \
  65.   unsigned occurrencesOf(RWBoolean (*t)(const type*, const void*), const void* a) const \
  66.     {return RWSlist::occurrencesOf((RWtestGeneric)t, a);}            \
  67.   unsigned occurrencesOfReference(const type* a) const                \
  68.     {return RWSlist::occurrencesOfReference(a);}                \
  69. };                                                              
  70.  
  71. #else
  72.  
  73. #define GStackdeclare(type)                            \
  74. class RWExport GStack(type) : private RWSlist {                    \
  75. public:                                        \
  76.   GStack(type)() { }                                \
  77.   GStack(type)(type* a) : RWSlist(a) { }                    \
  78.   GStack(type)(const GStack(type)& q) : RWSlist(q) { }                \
  79.   void operator=(const GStack(type)& q) { RWSlist::operator=(q);}        \
  80.                                         \
  81.   void push(type* a)         {RWSlist::prepend(a);}                \
  82.   type* pop()                {return (type*)RWSlist::get();}            \
  83.   type* top() const          {return (type*)RWSlist::first();}            \
  84.   RWSlist::clear;                                \
  85.   RWBoolean contains(RWBoolean (*t)(const type*, const void*), const void* a) const    \
  86.     {return RWSlist::contains((RWtestGeneric)t, a);}                \
  87.   RWBoolean containsReference(const type* a) const                \
  88.     {return RWSlist::containsReference(a);}                    \
  89.   RWSlist::entries;                                \
  90.   type* insert(type* a)        {return (type*)RWSlist::insert(a);}        \
  91.   RWSlist::isEmpty;                                \
  92.   unsigned occurrencesOf(RWBoolean (*t)(const type*, const void*), const void* a) const \
  93.     {return RWSlist::occurrencesOf((RWtestGeneric)t, a);}            \
  94.   unsigned occurrencesOfReference(const type* a) const                \
  95.     {return RWSlist::occurrencesOfReference(a);}                \
  96. };                                                              
  97.  
  98. #endif /* NO_ACCESS_ADJUSTMENT */
  99.  
  100. pragma pop_align_members();
  101. #endif /* __RWGSTACK_H__ */
  102.