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 / SLQueue.hP < prev    next >
Text File  |  1996-10-12  |  2KB  |  109 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. #ifndef _<T>SLQueue_h
  20. #ifdef __GNUG__
  21. #pragma interface
  22. #endif
  23. #define _<T>SLQueue_h
  24.  
  25. #include "<T>.SLList.h"
  26. #include "<T>.Queue.h"
  27.  
  28. class <T>SLQueue : public <T>Queue
  29. {
  30.   <T>SLList    p;
  31.  
  32. public:
  33.                <T>SLQueue();
  34.                <T>SLQueue(const <T>SLQueue& q);
  35.   inline              ~<T>SLQueue();
  36.  
  37.   void          operator = (const <T>SLQueue&);
  38.  
  39.   inline void          enq(<T&> item);
  40.   inline <T>           deq();
  41.   inline <T>&          front();
  42.   inline void          del_front();
  43.  
  44.   inline void          clear();
  45.   inline int           empty();
  46.   inline int           full();
  47.   inline int           length();
  48.                
  49.   inline int           OK();
  50. };
  51.  
  52. inline <T>SLQueue::<T>SLQueue() :p() {}
  53. inline <T>SLQueue::<T>SLQueue(const <T>SLQueue& q) : p(q.p) {}
  54.  
  55. inline <T>SLQueue::~<T>SLQueue() {}
  56.  
  57. inline void <T>SLQueue::enq(<T&>item)
  58. {
  59.   p.append(item);
  60. }
  61.  
  62. inline <T> <T>SLQueue::deq()
  63. {
  64.   return p.remove_front();
  65. }
  66.  
  67. inline <T>& <T>SLQueue::front()
  68. {
  69.   return p.front();
  70. }
  71.  
  72.  
  73. inline void <T>SLQueue::del_front()
  74. {
  75.   p.del_front();
  76. }
  77.  
  78. inline void <T>SLQueue::operator =(const <T>SLQueue& s)
  79. {
  80.   p = s.p;
  81. }
  82.  
  83. inline int <T>SLQueue::empty()
  84. {
  85.   return p.empty();
  86. }
  87.  
  88. inline int <T>SLQueue::full()
  89. {
  90.   return 0;
  91. }
  92.  
  93. inline int <T>SLQueue::length()
  94. {
  95.   return p.length();
  96. }
  97.  
  98. inline int <T>SLQueue::OK()
  99. {
  100.   return p.OK();
  101. }
  102.  
  103. inline void <T>SLQueue::clear()
  104. {
  105.   p.clear();
  106. }
  107.  
  108. #endif
  109.