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 / DEQUE.H < prev    next >
C/C++ Source or Header  |  1990-09-26  |  4KB  |  187 lines

  1. #ifndef __DEQUE_H
  2. #define __DEQUE_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. //      Deque
  18. //
  19. // Description
  20. //
  21. //      Defines the class Deque.
  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 Deque:  public Container
  53. {
  54. public:
  55.     virtual ~Deque();
  56.  
  57.             Object&         peekLeft() const { return theDeque.peekAtHead(); }
  58.             Object&         peekRight() const { return theDeque.peekAtTail(); }
  59.             Object&         getLeft();
  60.             Object&         getRight();
  61.             void            putLeft( Object& o )
  62.                                 { theDeque.addAtHead( o ); itemsInContainer++; }
  63.             void            putRight( Object& o )
  64.                                 { theDeque.addAtTail( o ); itemsInContainer++; }
  65.  
  66.     virtual ContainerIterator& initIterator() const;
  67.             ContainerIterator& initReverseIterator() const;
  68.  
  69.     virtual classType       isA() const;
  70.     virtual char           *nameOf() const;
  71.     virtual hashValueType   hashValue() const;
  72.  
  73. private:
  74.     DoubleList    theDeque;
  75. };
  76.  
  77. // Description -------------------------------------------------------------
  78. //
  79. //         Defines the container class Deque.  A deque is a double-ended queue.
  80. //      You may inspect, add, and remove elements at either end of the 
  81. //      deque.
  82. //
  83. // Public Members
  84. //
  85. //      peekLeft
  86. //
  87. //      Returns a reference to the object at the left end of the deque.
  88. //      The object is still owned by the deque.
  89. //
  90. //      peekRight
  91. //
  92. //      Returns a reference to the object at the right end of the deque.
  93. //      The object is still owned by the deque.
  94. //
  95. //      putLeft
  96. //
  97. //      Enqueues an object at the left end.
  98. //
  99. //      putRight
  100. //
  101. //      Enqueues an object at the right end.
  102. //
  103. //      getLeft
  104. //
  105. //      Dequeues an object from the left end.
  106. //
  107. //      getRight
  108. //
  109. //      Dequeues an object from the right end.
  110. //
  111. //      initIterator
  112. //
  113. //      Left-to-right Deque iterator initializer.
  114. //
  115. //      initReverseIterator
  116. //
  117. //      Right-to-left Deque iterator initializer.
  118. //
  119. //         isA
  120. //
  121. //         Returns the class type for a deque.
  122. //
  123. //         nameOf
  124. //
  125. //         Returns a pointer to the character string "Deque."
  126. //     
  127. //         hashValue
  128. //
  129. //         Returns a pre-defined value for deques.
  130. //
  131. // Inherited Members
  132. //
  133. //      Deque( Deque& )
  134. //
  135. //      Copy constructor.  Inherited from Container.
  136. //
  137. //      isEmpty
  138. //
  139. //         Inherited from Container.
  140. //
  141. //         isEqual
  142. //
  143. //         Inherited from Container.
  144. //
  145. //      forEach
  146. //
  147. //         Inherited from Container.
  148. //
  149. //      firstThat
  150. //
  151. //         Inherited from Container.
  152. //
  153. //      lastThat
  154. //
  155. //         Inherited from Container.
  156. //
  157. //      getItemsInContainer
  158. //
  159. //         Inherited from Container.
  160. //
  161. //      printOn
  162. //
  163. //         Inherited from Container.
  164. //
  165. //      printHeader
  166. //
  167. //         Inherited from Container.
  168. //
  169. //      printSeparator
  170. //
  171. //         Inherited from Container.
  172. //
  173. //      printTrailer
  174. //
  175. //         Inherited from Container.
  176. //
  177. // Private Members
  178. //
  179. //      theDeque
  180. //
  181. //      The implementation of the deque.
  182. //
  183. // End ---------------------------------------------------------------------
  184.  
  185.  
  186. #endif // ifndef __DEQUE_H //
  187.