home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / iivhp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  3.8 KB  |  135 lines

  1. /**********************************************************************
  2. *                                                                     *
  3. *  IBM(R) VisualAge(TM) for C++ for Windows(R), Version 3.5           *
  4. *                                                                     *
  5. *  PID: 5622-880                                                      *
  6. *  - Licensed Material - Program-Property of IBM                      *
  7. *  (C) Copyright IBM Corp. 1991, 1995 - All Right Reserved.           *
  8. *                                                                     *
  9. *  US Government Users Restricted Rights - Use, duplication or        *
  10. *  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.  *
  11. *                                                                     *
  12. *  VisualAge, and IBM are trademarks or registered trademarks of      *
  13. *  International Business Machines Corporation.                       *
  14. *  Windows is a registered trademark of Microsoft Corporation.        *
  15. *                                                                     *
  16. **********************************************************************/
  17.  
  18. #pragma info (nocls, nocnd, nocns, nocnv, noext, nognr, novft)
  19. #pragma pack (4)
  20.  
  21. // ---
  22. // IVHeapImpl
  23. // ---
  24.  
  25. // public members
  26.  
  27. template <class VInherited>
  28. IVHeapImpl <VInherited>::
  29. IVHeapImpl (Ops& ops, INumber numberOfElements)
  30. : VInherited (ops, numberOfElements)
  31. {
  32. }
  33.  
  34. template <class VInherited>
  35. IVHeapImpl <VInherited>::
  36. IVHeapImpl
  37.   (Ops& ops, IVHeapImpl <VInherited> const& collection)
  38. : VInherited (ops, collection)
  39. {
  40. }
  41.  
  42. template <class VInherited>
  43. IBoolean
  44. IVHeapImpl <VInherited>::
  45. Add (void const* element, ICursorImpl& cursor)
  46. { IBoolean isEnabled = IsEnabledForNotification ();
  47.   DisableNotification ();
  48.   IBoolean hasBeenAdded = VInherited::Add (element, cursor);
  49.   EnableNotification (isEnabled);
  50.   if (hasBeenAdded && HasObservers ()) {
  51.     NotifyOfAddAt (cursor);
  52.   }
  53.   return hasBeenAdded;
  54. }
  55.  
  56. template <class VInherited>
  57. void
  58. IVHeapImpl <VInherited>::
  59. AddAllFrom (IACollectionImpl const& collection)
  60. { IBoolean isEnabled = IsEnabledForNotification ();
  61.   DisableNotification ();
  62.   VInherited::AddAllFrom (collection);
  63.   EnableNotification (isEnabled);
  64.   if (HasObservers ()) {
  65.     NotifyOfModification ();
  66.   }
  67. }
  68.  
  69. template <class VInherited>
  70. void
  71. IVHeapImpl <VInherited>::
  72. Copy (IACollectionImpl const& collection)
  73. { IBoolean isEnabled = IsEnabledForNotification ();
  74.   DisableNotification ();
  75.   VInherited::Copy (collection);
  76.   EnableNotification (isEnabled);
  77.   if (HasObservers ()) {
  78.     NotifyOfModification ();
  79.   }
  80. }
  81.  
  82. template <class VInherited>
  83. INumber
  84. IVHeapImpl <VInherited>::
  85. RemoveAll ()
  86. { INumber result = VInherited::RemoveAll ();
  87.   if (result > 0 && HasObservers ()) {
  88.     NotifyOfModification ();
  89.   }
  90.   return result;
  91. }
  92.  
  93. template <class VInherited>
  94. INumber
  95. IVHeapImpl <VInherited>::
  96. RemoveAll (IPredFunc predFunc, void* addArg)
  97. { INumber result = VInherited::RemoveAll (predFunc, addArg);
  98.   if (result > 0 && HasObservers ()) {
  99.     NotifyOfModification ();
  100.   }
  101.   return result;
  102. }
  103.  
  104. template <class VInherited>
  105. void
  106. IVHeapImpl <VInherited>::
  107. RemoveAt (ICursorImpl& cursor)
  108. { if (HasObservers ()) {
  109.     NotifyOfRemoveAt (cursor);
  110.   }
  111.   VInherited::RemoveAt (cursor);
  112. }
  113.  
  114. template <class VInherited>
  115. void
  116. IVHeapImpl <VInherited>::
  117. ReplaceAt (ICursorImpl const& cursor, void const* element)
  118. { if (HasObservers ()) {
  119. #if defined (ICLCC_COMPAT_IVB)
  120.     NotifyOfRemoveAt (cursor); // to be removed in a future release
  121. #else
  122.     NotifyOfReplaceAt (cursor, element);
  123. #endif
  124.   }
  125.   VInherited::ReplaceAt (cursor, element);
  126. #if defined (ICLCC_COMPAT_IVB)
  127.   if (HasObservers ()) {
  128.     NotifyOfAddAt (cursor); // to be removed in a future release
  129.   }
  130. #endif
  131. }
  132.  
  133. #pragma info (restore)
  134. #pragma pack ()
  135.