home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / TCPP10-8.ZIP / CLASSINC.ZIP / QUEUE.H < prev    next >
C/C++ Source or Header  |  1990-09-26  |  4KB  |  176 lines

  1. #ifndef __QUEUE_H
  2. #define __QUEUE_H
  3.  
  4. //
  5. // This file contains proprietary information of Borland International.
  6. // Copying or reproduction without prior written approval is prohibited.
  7. //
  8. // Copyright (c) 1990
  9. // Borland International
  10. // 1800 Scotts Valley Dr.
  11. // Scotts Valley, CA 95066
  12. // (408) 438-8400
  13. //
  14.  
  15. // Contents ----------------------------------------------------------------
  16. //
  17. //      Queue
  18. //
  19. // Description
  20. //
  21. //      Defines the class Queue.
  22. //
  23. // End ---------------------------------------------------------------------
  24.  
  25. // Interface Dependencies ---------------------------------------------------
  26.  
  27. #ifndef __IOSTREAM_H
  28. #include <iostream.h>
  29. #define __IOSTREAM_H
  30. #endif
  31.  
  32. #ifndef __CLSTYPES_H
  33. #include "clstypes.h"
  34. #endif
  35.  
  36. #ifndef __OBJECT_H
  37. #include "object.h"
  38. #endif
  39.  
  40. #ifndef __CONTAIN_H
  41. #include "contain.h"
  42. #endif
  43.  
  44. #ifndef __DBLLIST_H
  45. #include "dbllist.h"
  46. #endif
  47.  
  48. // End Interface Dependencies ------------------------------------------------
  49.  
  50. // Class //
  51.  
  52. class Queue:  public Container
  53. {
  54. public:
  55.     virtual ~Queue();
  56.  
  57.             Object&         peekLeft() const { return theQueue.peekAtHead(); }
  58.             Object&         peekRight() const { return theQueue.peekAtTail(); }
  59.             Object&         get();
  60.             void            put( Object& o ) { theQueue.addAtHead( o ); itemsInContainer++; }
  61.  
  62.     virtual ContainerIterator& initIterator() const;
  63.  
  64.     virtual classType       isA() const;
  65.     virtual char           *nameOf() const;
  66.     virtual hashValueType   hashValue() const;
  67.  
  68. private:
  69.     DoubleList    theQueue;
  70. };
  71.  
  72. // Description -------------------------------------------------------------
  73. //
  74. //     Defines the container class Queue.  A queue is a FIFO object.
  75. //      You may inspect elements at either end of the queue, however,
  76. //      you may only remove objects at one end and add objects at the
  77. //      other.  The left end is the end at which objects are enqueued.
  78. //      The right end is where objects may be retrieved.
  79. //
  80. // Public Members
  81. //
  82. //      peekLeft
  83. //
  84. //      Returns a reference to the object at the left end of the queue.
  85. //      The object is still owned by the queue.
  86. //
  87. //      peekRight
  88. //
  89. //      Returns a reference to the object at the right end of the queue.
  90. //      The object is still owned by the queue.
  91. //
  92. //      put
  93. //
  94. //      Enqueues an object.
  95. //
  96. //      get
  97. //
  98. //      Dequeues an object.
  99. //
  100. //      initIterator
  101. //
  102. //      Left-to-right Queue iterator initializer.
  103. //
  104. //     isA
  105. //
  106. //     Returns the class type for a queue.
  107. //
  108. //     nameOf
  109. //
  110. //     Returns a pointer to the character string "Queue."
  111. //     
  112. //     hashValue
  113. //
  114. //     Returns a pre-defined value for queues.
  115. //
  116. // Inherited Members
  117. //
  118. //      Queue( Queue& )
  119. //
  120. //      Copy constructor.  Inherited from Container.
  121. //
  122. //      isEmpty
  123. //
  124. //     Inherited from Container.
  125. //
  126. //     operator ==
  127. //
  128. //     Inherited from Container.
  129. //
  130. //      forEach
  131. //
  132. //     Inherited from Container.
  133. //
  134. //      firstThat
  135. //
  136. //     Inherited from Container.
  137. //
  138. //      lastThat
  139. //
  140. //     Inherited from Container.
  141. //
  142. //      getItemsInContainer
  143. //
  144. //     Inherited from Container.
  145. //
  146. //      itemsInContainer
  147. //
  148. //     Inherited from Container.
  149. //
  150. //      printOn
  151. //
  152. //     Inherited from Container.
  153. //
  154. //      printHeader
  155. //
  156. //     Inherited from Container.
  157. //
  158. //      printSeparator
  159. //
  160. //     Inherited from Container.
  161. //
  162. //      printTrailer
  163. //
  164. //     Inherited from Container.
  165. //
  166. // Private Members
  167. //
  168. //      theQueue
  169. //
  170. //      The implementation of the queue.
  171. //
  172. // End ---------------------------------------------------------------------
  173.  
  174.  
  175. #endif // ifndef __QUEUE_H //
  176.