home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / BCCollec / Structs / Queues / BCQueU.cpp < prev    next >
Encoding:
Text File  |  1994-04-21  |  3.8 KB  |  153 lines  |  [TEXT/MPS ]

  1. //  The C++ Booch Components (Version 2.1)
  2. //  (C) Copyright 1990-1993 Grady Booch. All Rights Reserved.
  3. //
  4. //  Restricted Rights Legend
  5. //  Use, duplication, or disclosure is subject to restrictions as set forth 
  6. //  in subdivision (c)(1)(ii) of the Rights in Technical Data and Computer 
  7. //  Software clause at DFARS 252.227-7013. 
  8. //
  9. //  BCQueU.cpp
  10. //
  11. //  This file contains the definitions for the unbounded queue.
  12.  
  13. #include "BCQueU.h"
  14.  
  15. template<class Item, class StorageManager>
  16. BC_TUnboundedQueue<Item, StorageManager>::BC_TUnboundedQueue() {}
  17.  
  18. template<class Item, class StorageManager>
  19. BC_TUnboundedQueue<Item, StorageManager>::
  20.   BC_TUnboundedQueue(const BC_TUnboundedQueue<Item, StorageManager>& q)
  21.     : fRep(q.fRep) {}
  22.  
  23. template<class Item, class StorageManager>
  24. BC_TUnboundedQueue<Item, StorageManager>::~BC_TUnboundedQueue() {}
  25.  
  26. template<class Item, class StorageManager>
  27. BC_TQueue<Item>& BC_TUnboundedQueue<Item, StorageManager>::
  28.   operator=(const BC_TQueue<Item>& q)
  29. {
  30.   return BC_TQueue<Item>::operator=(q);
  31. }
  32.  
  33. template<class Item, class StorageManager>
  34. BC_TQueue<Item>& BC_TUnboundedQueue<Item, StorageManager>::
  35.   operator=(const BC_TUnboundedQueue<Item, StorageManager>& q)
  36. {
  37.   fRep = q.fRep;
  38.   return *this;
  39. }
  40.  
  41. template<class Item, class StorageManager>
  42. BC_Boolean BC_TUnboundedQueue<Item, StorageManager>::
  43.   operator==(const BC_TQueue<Item>& q) const
  44. {
  45.   return BC_TQueue<Item>::operator==(q);
  46. }
  47.  
  48. template<class Item, class StorageManager>
  49. BC_Boolean BC_TUnboundedQueue<Item, StorageManager>::
  50.   operator==(const BC_TUnboundedQueue<Item, StorageManager>& q) const
  51. {
  52.   return (fRep == q.fRep);
  53. }
  54.  
  55. template<class Item, class StorageManager>
  56. BC_Boolean BC_TUnboundedQueue<Item, StorageManager>::
  57.   operator!=(const BC_TUnboundedQueue<Item, StorageManager>& q) const
  58. {
  59.   return !operator==(q);
  60. }
  61.  
  62. template<class Item, class StorageManager>
  63. void BC_TUnboundedQueue<Item, StorageManager>::Clear()
  64. {
  65.   fRep.Clear();
  66. }
  67.  
  68. template<class Item, class StorageManager>
  69. void BC_TUnboundedQueue<Item, StorageManager>::Append(const Item& item)
  70. {
  71.   fRep.Append(item);
  72. }
  73.  
  74. template<class Item, class StorageManager>
  75. void BC_TUnboundedQueue<Item, StorageManager>::Pop()
  76. {
  77.   fRep.Remove(0);
  78. }
  79.     
  80. template<class Item, class StorageManager>
  81. void BC_TUnboundedQueue<Item, StorageManager>::Remove(BC_Index at)
  82. {
  83.   fRep.Remove(at);
  84. }
  85.  
  86. template<class Item, class StorageManager>
  87. BC_Index BC_TUnboundedQueue<Item, StorageManager>::Length() const
  88. {
  89.   return fRep.Length();
  90. }
  91.  
  92. template<class Item, class StorageManager>
  93. BC_Boolean BC_TUnboundedQueue<Item, StorageManager>::IsEmpty() const
  94. {
  95.   return (fRep.Length() == 0);
  96. }
  97.  
  98. template<class Item, class StorageManager>
  99. const Item& BC_TUnboundedQueue<Item, StorageManager>::Front() const
  100. {
  101.   return fRep.First();
  102. }
  103.  
  104. template<class Item, class StorageManager>
  105. Item& BC_TUnboundedQueue<Item, StorageManager>::Front()
  106. {
  107.   return fRep.First();
  108. }
  109.  
  110. template<class Item, class StorageManager>
  111. BC_ExtendedIndex BC_TUnboundedQueue<Item, StorageManager>::
  112.   Location(const Item& item) const
  113. {
  114.   return fRep.Location(item);
  115. }
  116.  
  117.  
  118. template<class Item, class StorageManager>
  119. void* BC_TUnboundedQueue<Item, StorageManager>::operator new(size_t s)
  120. {
  121.   return StorageManager::Allocate(s);
  122. }
  123.  
  124. template<class Item, class StorageManager>
  125. void BC_TUnboundedQueue<Item, StorageManager>::operator delete(void* p, size_t s)
  126. {
  127.   StorageManager::Deallocate(p, s);
  128. }
  129.  
  130. template<class Item, class StorageManager>
  131. void BC_TUnboundedQueue<Item, StorageManager>::Purge()
  132. {
  133.   fRep.Clear();
  134. }
  135.  
  136. template<class Item, class StorageManager>
  137. void BC_TUnboundedQueue<Item, StorageManager>::Add(const Item& item)
  138. {
  139.   fRep.Append(item);
  140. }
  141.  
  142. template<class Item, class StorageManager>
  143. BC_Index BC_TUnboundedQueue<Item, StorageManager>::Cardinality() const
  144. {
  145.   return fRep.Length();
  146. }
  147.  
  148. template<class Item, class StorageManager>
  149. const Item& BC_TUnboundedQueue<Item, StorageManager>::ItemAt(BC_Index index) const
  150. {
  151.   return fRep.ItemAt(index);
  152. }
  153.