home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / BCCollec / Structs / Collects / BCCollU.cpp < prev    next >
Encoding:
Text File  |  1994-04-21  |  5.2 KB  |  198 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. //  BCCollU.cpp
  10. //
  11. //  This file contains the definitions for the unbounded collection.
  12.  
  13. #include "BCCollU.h"
  14.  
  15. template<class Item, class StorageManager>
  16. BC_TUnboundedCollection<Item, StorageManager>::BC_TUnboundedCollection() {}
  17.  
  18. template<class Item, class StorageManager>
  19. BC_TUnboundedCollection<Item, StorageManager>::
  20.   BC_TUnboundedCollection(const BC_TUnboundedCollection<Item, StorageManager>& c)
  21.     : fRep(c.fRep) {}
  22.  
  23. template<class Item, class StorageManager>
  24. BC_TUnboundedCollection<Item, StorageManager>::~BC_TUnboundedCollection() {}
  25.  
  26. template<class Item, class StorageManager>
  27. BC_TCollection<Item>& BC_TUnboundedCollection<Item, StorageManager>::
  28.   operator=(const BC_TCollection<Item>& c)
  29. {
  30.   return BC_TCollection<Item>::operator=(c);
  31. }
  32.  
  33. template<class Item, class StorageManager>
  34. BC_TCollection<Item>& BC_TUnboundedCollection<Item, StorageManager>::
  35.   operator=(const BC_TUnboundedCollection<Item, StorageManager>& c)
  36. {
  37.   fRep = c.fRep;
  38.   return *this;
  39. }
  40.  
  41. template<class Item, class StorageManager>
  42. BC_Boolean BC_TUnboundedCollection<Item, StorageManager>::
  43.   operator==(const BC_TCollection<Item>& c) const
  44. {
  45.   return BC_TCollection<Item>::operator==(c);
  46. }
  47.  
  48. template<class Item, class StorageManager>
  49. BC_Boolean BC_TUnboundedCollection<Item, StorageManager>::
  50.   operator==(const BC_TUnboundedCollection<Item, StorageManager>& c) const
  51. {
  52.   return (fRep == c.fRep);
  53. }
  54.  
  55. template<class Item, class StorageManager>
  56. BC_Boolean BC_TUnboundedCollection<Item, StorageManager>::
  57.   operator!=(const BC_TUnboundedCollection<Item, StorageManager>& c) const
  58. {
  59.   return !operator==(c);
  60. }
  61.  
  62. template<class Item, class StorageManager>
  63. const Item& BC_TUnboundedCollection<Item, StorageManager>::
  64.   operator[](BC_Index index) const
  65. {
  66.   return fRep[index];
  67. }
  68.  
  69. template<class Item, class StorageManager>
  70. Item& BC_TUnboundedCollection<Item, StorageManager>::operator[](BC_Index index)
  71. {
  72.   return (Item&)(fRep[index]);
  73. }
  74.  
  75. template<class Item, class StorageManager>
  76. void BC_TUnboundedCollection<Item, StorageManager>::Clear()
  77. {
  78.   fRep.Clear();
  79. }
  80.  
  81. template<class Item, class StorageManager>
  82. void BC_TUnboundedCollection<Item, StorageManager>::Insert(const Item& item)
  83. {
  84.   fRep.Insert(item);
  85. }
  86.  
  87. template<class Item, class StorageManager>
  88. void BC_TUnboundedCollection<Item, StorageManager>::
  89.   Insert(const Item& item, BC_Index before)
  90. {
  91.   fRep.Insert(item, before);
  92. }
  93.  
  94. template<class Item, class StorageManager>
  95. void BC_TUnboundedCollection<Item, StorageManager>::Append(const Item& item)
  96. {
  97.   fRep.Append(item);
  98. }
  99.  
  100. template<class Item, class StorageManager>
  101. void BC_TUnboundedCollection<Item, StorageManager>::
  102.   Append(const Item& item, BC_Index after)
  103. {
  104.   fRep.Append(item, after);
  105. }
  106.  
  107. template<class Item, class StorageManager>
  108. void BC_TUnboundedCollection<Item, StorageManager>::Remove(BC_Index at)
  109. {
  110.   fRep.Remove(at);
  111. }
  112.  
  113. template<class Item, class StorageManager>
  114. void BC_TUnboundedCollection<Item, StorageManager>::
  115.   Replace(BC_Index at, const Item& item)
  116. {
  117.   fRep.Replace(at, item);
  118. }
  119.  
  120. template<class Item, class StorageManager>
  121. BC_Index BC_TUnboundedCollection<Item, StorageManager>::Length() const
  122. {
  123.   return fRep.Length();
  124. }
  125.  
  126. template<class Item, class StorageManager>
  127. BC_Boolean BC_TUnboundedCollection<Item, StorageManager>::IsEmpty() const
  128. {
  129.   return (fRep.Length() == 0);
  130. }
  131.  
  132. template<class Item, class StorageManager>
  133. const Item& BC_TUnboundedCollection<Item, StorageManager>::First() const
  134. {
  135.   return fRep.First();
  136. }
  137.  
  138. template<class Item, class StorageManager>
  139. Item& BC_TUnboundedCollection<Item, StorageManager>::First()
  140. {
  141.   return (Item&)(fRep.First());
  142. }
  143.  
  144. template<class Item, class StorageManager>
  145. const Item& BC_TUnboundedCollection<Item, StorageManager>::Last() const
  146. {
  147.   return fRep.Last();
  148. }
  149.  
  150. template<class Item, class StorageManager>
  151. Item& BC_TUnboundedCollection<Item, StorageManager>::Last()
  152. {
  153.   return (Item&)(fRep.Last());
  154. }
  155.  
  156. template<class Item, class StorageManager>
  157. BC_ExtendedIndex BC_TUnboundedCollection<Item, StorageManager>::
  158.   Location(const Item& item) const
  159. {
  160.   return fRep.Location(item);
  161. }
  162.  
  163. template<class Item, class StorageManager>
  164. void BC_TUnboundedCollection<Item, StorageManager>::Purge()
  165. {
  166.   fRep.Clear();
  167. }
  168.  
  169. template<class Item, class StorageManager>
  170. void BC_TUnboundedCollection<Item, StorageManager>::Add(const Item& item)
  171. {
  172.   fRep.Append(item);
  173. }
  174.  
  175. template<class Item, class StorageManager>
  176. BC_Index BC_TUnboundedCollection<Item, StorageManager>::Cardinality() const
  177. {
  178.   return fRep.Length();
  179. }
  180.  
  181. template<class Item, class StorageManager>
  182. const Item& BC_TUnboundedCollection<Item, StorageManager>::ItemAt(BC_Index index) const
  183. {
  184.   return fRep.ItemAt(index);
  185. }
  186.  
  187. template<class Item, class StorageManager>
  188. void* BC_TUnboundedCollection<Item, StorageManager>::operator new(size_t s)
  189. {
  190.   return StorageManager::Allocate(s);
  191. }
  192.  
  193. template<class Item, class StorageManager>
  194. void BC_TUnboundedCollection<Item, StorageManager>::operator delete(void* p, size_t s)
  195. {
  196.   StorageManager::Deallocate(p, s);
  197. }
  198.