home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / g++ / gen / FPQueue.hP < prev    next >
Text File  |  1993-06-29  |  2KB  |  113 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.     based on code by Marc Shapiro (shapiro@sor.inria.fr)
  6.  
  7. This file is part of the GNU C++ Library.  This library is free
  8. software; you can redistribute it and/or modify it under the terms of
  9. the GNU Library General Public License as published by the Free
  10. Software Foundation; either version 2 of the License, or (at your
  11. option) any later version.  This library is distributed in the hope
  12. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  13. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  14. PURPOSE.  See the GNU Library General Public License for more details.
  15. You should have received a copy of the GNU Library General Public
  16. License along with this library; if not, write to the Free Software
  17. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20.  
  21. #ifndef _<T>FPQueue_h
  22. #ifdef __GNUG__
  23. #pragma interface
  24. #endif
  25. #define _<T>FPQueue_h
  26.  
  27. #include "<T>.FPlex.h"
  28. #include "<T>.Queue.h"
  29.  
  30. class <T>FPQueue : public <T>Queue
  31. {
  32.   <T>FPlex     p;
  33.  
  34. public:
  35.                <T>FPQueue(int chunksize = DEFAULT_INITIAL_CAPACITY);
  36.                <T>FPQueue(const <T>FPQueue& q);
  37.                ~<T>FPQueue();
  38.  
  39.   void          operator = (const <T>FPQueue&);
  40.  
  41.   void          enq(<T&> item);
  42.   <T>           deq();
  43.   <T>&          front();
  44.   void          del_front();
  45.  
  46.   void          clear();
  47.   int           empty();
  48.   int           full();
  49.   int           length();
  50.                
  51.   int           OK();
  52. };
  53.  
  54. inline <T>FPQueue::<T>FPQueue(int chunksize) : p(chunksize) {}
  55. inline <T>FPQueue::<T>FPQueue(const <T>FPQueue& q) : p(q.p) {}
  56.  
  57. inline <T>FPQueue::~<T>FPQueue() {}
  58.  
  59. inline void <T>FPQueue::enq(<T&>item)
  60. {
  61.   p.add_high(item);
  62. }
  63.  
  64. inline <T> <T>FPQueue::deq()
  65. {
  66.   <T> res = p.low_element();
  67.   p.del_low();
  68.   return res;
  69. }
  70.  
  71. inline <T>& <T>FPQueue::front()
  72. {
  73.   return p.low_element();
  74. }
  75.  
  76.  
  77. inline void <T>FPQueue::del_front()
  78. {
  79.   p.del_low();
  80. }
  81.  
  82. inline void <T>FPQueue::operator =(const <T>FPQueue& s)
  83. {
  84.   p = s.p;
  85. }
  86.  
  87. inline int <T>FPQueue::empty()
  88. {
  89.   return p.empty();
  90. }
  91.  
  92. inline int <T>FPQueue::full()
  93. {
  94.   return p.full();
  95. }
  96.  
  97. inline int <T>FPQueue::length()
  98. {
  99.   return p.length();
  100. }
  101.  
  102. inline int <T>FPQueue::OK()
  103. {
  104.   return p.OK();
  105. }
  106.  
  107. inline void <T>FPQueue::clear()
  108. {
  109.   p.clear();
  110. }
  111.  
  112. #endif
  113.