home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IACLLCT.C < prev    next >
Text File  |  1993-09-22  |  2KB  |  45 lines

  1. /*******************************************************************************
  2. *                                                                              *
  3. * COPYRIGHT:                                                                   *
  4. *   IBM C/C++ Tools Version 2.01 - Collection Class Library                    *
  5. *   Licensed Materials - Property of IBM                                       *
  6. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  7. *   All Rights Reserved                                                        *
  8. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  9. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  10. *                                                                              *
  11. *******************************************************************************/
  12. #include <ibexcept.h>
  13.  
  14. template <class Element>
  15. IACollection <Element> ::~IACollection ()
  16. {
  17. }
  18.  
  19. template <class Element>
  20. void IACollection < Element >::
  21. addAllFrom (IACollection < Element > const& collection)
  22. { ICHECK (! isIdentical (collection),
  23.           IIdenticalCollectionException, IIdenticalCollectionText)
  24.   ICursor *cursor = collection.newCursor ();
  25.   forCursor (*cursor) {
  26.     add (collection.elementAt (*cursor));
  27.   }
  28.   delete cursor;
  29. };
  30.  
  31. template <class Element>
  32. void IACollection < Element >::
  33. copy (IACollection < Element > const& collection)
  34. { if (! isIdentical (collection)) {
  35.     removeAll ();
  36.     addAllFrom (collection);
  37.   }
  38. };
  39.  
  40. template <class Element>
  41. void* IACollection < Element >::
  42. identity () const
  43. { return (void*) this;
  44. }
  45.