home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / libg++-2.7.1-bin.lha / lib / g++-include / gen / SLStack.hP < prev    next >
Text File  |  1996-10-12  |  2KB  |  110 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.  
  6. This file is part of the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18.  
  19.  
  20. #ifndef _<T>SLStack_h
  21. #ifdef __GNUG__
  22. #pragma interface
  23. #endif
  24. #define _<T>SLStack_h 1
  25.  
  26. #include "<T>.SLList.h"
  27. #include "<T>.Stack.h"
  28.  
  29. class <T>SLStack : public <T>Stack
  30. {
  31.   <T>SLList     p;
  32.  
  33. public:
  34.                 <T>SLStack();
  35.                 <T>SLStack(const <T>SLStack& s);
  36.   inline               ~<T>SLStack();
  37.  
  38.   void          operator = (const <T>SLStack&);
  39.  
  40.   inline void          push(<T&> item);
  41.   inline <T>           pop();
  42.   inline <T>&          top();               
  43.   inline void          del_top();
  44.  
  45.   inline int           empty();
  46.   inline int           full();
  47.   inline int           length();
  48.  
  49.   inline void          clear();
  50.  
  51.   inline int           OK();
  52.  
  53. };
  54.  
  55. inline <T>SLStack::<T>SLStack() :p() {}
  56. inline <T>SLStack::<T>SLStack(const <T>SLStack& a) : p(a.p) {}
  57. inline <T>SLStack::~<T>SLStack() {}
  58.  
  59. inline void <T>SLStack::push(<T&> item)
  60. {
  61.   p.prepend(item);
  62. }
  63.  
  64. inline <T> <T>SLStack::pop()
  65. {
  66.   return p.remove_front();
  67. }
  68.  
  69. inline <T>& <T>SLStack::top()
  70. {
  71.   return p.front();
  72. }
  73.  
  74. inline void <T>SLStack::del_top()
  75. {
  76.   p.del_front();
  77. }
  78.  
  79. inline void <T>SLStack::operator =(const <T>SLStack& s)
  80. {
  81.   p = s.p;
  82. }
  83.  
  84. inline int <T>SLStack::empty() 
  85. {
  86.   return p.empty();
  87. }
  88.  
  89. inline int <T>SLStack::full() 
  90. {
  91.   return 0;
  92. }
  93.  
  94. inline int <T>SLStack::length() 
  95. {
  96.   return p.length();
  97. }
  98.  
  99. inline int <T>SLStack::OK() 
  100. {
  101.   return p.OK();
  102. }
  103.  
  104. inline void <T>SLStack::clear() 
  105. {
  106.   p.clear();
  107. }
  108.  
  109. #endif
  110.