home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / g__lib / fpqueue.hp < prev    next >
Text File  |  1993-07-23  |  2KB  |  117 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 GNU CC.
  8.  
  9. GNU CC is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY.  No author or distributor
  11. accepts responsibility to anyone for the consequences of using it
  12. or for whether it serves any particular purpose or works at all,
  13. unless he says so in writing.  Refer to the GNU CC General Public
  14. License for full details.
  15.  
  16. Everyone is granted permission to copy, modify and redistribute
  17. GNU CC, but only under the conditions described in the
  18. GNU CC General Public License.   A copy of this license is
  19. supposed to have been given to you along with GNU CC so you
  20. can know your rights and responsibilities.  It should be in a
  21. file named COPYING.  Among other things, the copyright notice
  22. and this notice must be preserved on all copies.  
  23. */
  24.  
  25.  
  26. #ifndef _<T>FPQueue_h
  27. #pragma once
  28. #define _<T>FPQueue_h
  29.  
  30. #include "<T>.FPlex.h"
  31. #include "<T>.Queue.h"
  32.  
  33. class <T>FPQueue : public <T>Queue
  34. {
  35.   <T>FPlex     p;
  36.  
  37. public:
  38.                <T>FPQueue(int chunksize = DEFAULT_<T>PLEX_CHUNK_SIZE);
  39.                <T>FPQueue(const <T>FPQueue& q);
  40.                ~<T>FPQueue();
  41.  
  42.   void          operator = (const <T>FPQueue&);
  43.  
  44.   void          enq(<T&> item);
  45.   <T>           deq();
  46.   <T>&          front();
  47.   void          del_front();
  48.  
  49.   void          clear();
  50.   int           empty();
  51.   int           full();
  52.   int           length();
  53.                
  54.   int           OK();
  55. };
  56.  
  57. inline <T>FPQueue::<T>FPQueue(int chunksize = DEFAULT_<T>PLEX_CHUNK_SIZE) 
  58.      : p(chunksize) {}
  59. inline <T>FPQueue::<T>FPQueue(const <T>FPQueue& q) : p(q.p) {}
  60.  
  61. inline <T>FPQueue::~<T>FPQueue() {}
  62.  
  63. inline void <T>FPQueue::enq(<T&>item)
  64. {
  65.   p.add_high(item);
  66. }
  67.  
  68. inline <T> <T>FPQueue::deq()
  69. {
  70.   <T> res = p.low_element();
  71.   p.del_low();
  72.   return res;
  73. }
  74.  
  75. inline <T>& <T>FPQueue::front()
  76. {
  77.   return p.low_element();
  78. }
  79.  
  80.  
  81. inline void <T>FPQueue::del_front()
  82. {
  83.   p.del_low();
  84. }
  85.  
  86. inline void <T>FPQueue::operator =(const <T>FPQueue& s)
  87. {
  88.   p = s.p;
  89. }
  90.  
  91. inline int <T>FPQueue::empty()
  92. {
  93.   return p.empty();
  94. }
  95.  
  96. inline int <T>FPQueue::full()
  97. {
  98.   return p.full();
  99. }
  100.  
  101. inline int <T>FPQueue::length()
  102. {
  103.   return p.length();
  104. }
  105.  
  106. inline int <T>FPQueue::OK()
  107. {
  108.   return p.OK();
  109. }
  110.  
  111. inline void <T>FPQueue::clear()
  112. {
  113.   p.clear();
  114. }
  115.  
  116. #endif
  117.