home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************
- * *
- * IBM(R) VisualAge(TM) for C++ for Windows(R), Version 3.5 *
- * *
- * PID: 5622-880 *
- * - Licensed Material - Program-Property of IBM *
- * (C) Copyright IBM Corp. 1991, 1995 - All Right Reserved. *
- * *
- * US Government Users Restricted Rights - Use, duplication or *
- * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *
- * *
- * VisualAge, and IBM are trademarks or registered trademarks of *
- * International Business Machines Corporation. *
- * Windows is a registered trademark of Microsoft Corporation. *
- * *
- **********************************************************************/
-
- #pragma info (nocls, nocnd, nocns, nocnv, noext, nognr, novft)
- #pragma pack (4)
-
- // ---
- // IVBagImpl
- // ---
-
- // public members
-
- template <class VInherited>
- IVBagImpl <VInherited>::
- IVBagImpl (Ops& ops, INumber numberOfElements)
- : VInherited (ops, numberOfElements)
- {
- }
-
- template <class VInherited>
- IVBagImpl <VInherited>::
- IVBagImpl
- (Ops& ops, IVBagImpl <VInherited> const& collection)
- : VInherited (ops, collection)
- {
- }
-
- template <class VInherited>
- IBoolean
- IVBagImpl <VInherited>::
- Add (void const* element, ICursorImpl& cursor)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- IBoolean hasBeenAdded = VInherited::Add (element, cursor);
- EnableNotification (isEnabled);
- if (hasBeenAdded && HasObservers ()) {
- NotifyOfAddAt (cursor);
- }
- return hasBeenAdded;
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- AddAllFrom (IACollectionImpl const& collection)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- VInherited::AddAllFrom (collection);
- EnableNotification (isEnabled);
- if (HasObservers ()) {
- NotifyOfModification ();
- }
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- AddAntivalence (IABagImpl const& collection1,
- IABagImpl const& collection2)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- VInherited::AddAntivalence (collection1, collection2);
- EnableNotification (isEnabled);
- if (HasObservers ()) {
- NotifyOfModification ();
- }
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- AddDifference (IABagImpl const& collection1,
- IABagImpl const& collection2)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- VInherited::AddDifference (collection1, collection2);
- EnableNotification (isEnabled);
- if (HasObservers ()) {
- NotifyOfModification ();
- }
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- AddIntersection (IABagImpl const& collection1,
- IABagImpl const& collection2)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- VInherited::AddIntersection (collection1, collection2);
- EnableNotification (isEnabled);
- if (HasObservers ()) {
- NotifyOfModification ();
- }
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- AddUnion (IABagImpl const& collection1,
- IABagImpl const& collection2)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- VInherited::AddUnion (collection1, collection2);
- EnableNotification (isEnabled);
- if (HasObservers ()) {
- NotifyOfModification ();
- }
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- Antivalence (IABagImpl const& collection)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- VInherited::Antivalence (collection);
- EnableNotification (isEnabled);
- if (HasObservers ()) {
- NotifyOfModification ();
- }
- }
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- Copy (IACollectionImpl const& collection)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- VInherited::Copy (collection);
- EnableNotification (isEnabled);
- if (HasObservers ()) {
- NotifyOfModification ();
- }
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- Difference (IABagImpl const& collection)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- VInherited::Difference (collection);
- EnableNotification (isEnabled);
- if (HasObservers ()) {
- NotifyOfModification ();
- }
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- Intersection (IABagImpl const& collection)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- VInherited::Intersection (collection);
- EnableNotification (isEnabled);
- if (HasObservers ()) {
- NotifyOfModification ();
- }
- }
- template <class VInherited>
- IBoolean
- IVBagImpl <VInherited>::
- LocateOrAdd (void const* element, ICursorImpl& cursor)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- IBoolean hasBeenLocated = VInherited::LocateOrAdd (element, cursor);
- EnableNotification (isEnabled);
- if (! hasBeenLocated && HasObservers ()) {
- NotifyOfAddAt (cursor);
- }
- return hasBeenLocated;
- }
-
- template <class VInherited>
- IBoolean
- IVBagImpl <VInherited>::
- Remove (void const* element)
- { if (HasObservers () && Locate (element, CursorOf (*this))) {
- NotifyOfRemoveAt (CursorOf (*this));
- }
- return VInherited::Remove (element);
- }
-
- template <class VInherited>
- INumber
- IVBagImpl <VInherited>::
- RemoveAll ()
- { INumber result = VInherited::RemoveAll ();
- if (result > 0 && HasObservers ()) {
- NotifyOfModification ();
- }
- return result;
- }
-
- template <class VInherited>
- INumber
- IVBagImpl <VInherited>::
- RemoveAll (IPredFunc predFunc, void* addArg)
- { INumber result = VInherited::RemoveAll (predFunc, addArg);
- if (result > 0 && HasObservers ()) {
- NotifyOfModification ();
- }
- return result;
- }
-
- template <class VInherited>
- INumber
- IVBagImpl <VInherited>::
- RemoveAllOccurrences (void const* element)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- INumber result = VInherited::RemoveAllOccurrences (element);
- EnableNotification (isEnabled);
- if (result > 0 && HasObservers ()) {
- NotifyOfModification ();
- }
- return result;
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- RemoveAt (ICursorImpl& cursor)
- { if (HasObservers ()) {
- NotifyOfRemoveAt (cursor);
- }
- VInherited::RemoveAt (cursor);
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- ReplaceAt (ICursorImpl const& cursor, void const* element)
- { if (HasObservers ()) {
- #if defined (ICLCC_COMPAT_IVB)
- NotifyOfRemoveAt (cursor); // to be removed in a future release
- #else
- NotifyOfReplaceAt (cursor, element);
- #endif
- }
- VInherited::ReplaceAt (cursor, element);
- #if defined (ICLCC_COMPAT_IVB)
- if (HasObservers ()) {
- NotifyOfAddAt (cursor); // to be removed in a future release
- }
- #endif
- }
-
- template <class VInherited>
- void
- IVBagImpl <VInherited>::
- Union (IABagImpl const& collection)
- { IBoolean isEnabled = IsEnabledForNotification ();
- DisableNotification ();
- VInherited::Union (collection);
- EnableNotification (isEnabled);
- if (HasObservers ()) {
- NotifyOfModification ();
- }
- }
-
- #pragma info (restore)
- #pragma pack ()
-