home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / BCPPOWL1.ZIP / CLSRC.ZIP / SET.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-28  |  2.3 KB  |  99 lines

  1. // Borland C++ - (C) Copyright 1991 by Borland International
  2.  
  3. // Contents ----------------------------------------------------------------
  4. //
  5. //
  6. // Description
  7. //
  8. //      Implementation of member functions for class Set.
  9. //
  10. // End ---------------------------------------------------------------------
  11.  
  12. // Interface Dependencies ---------------------------------------------------
  13.  
  14. #ifndef __CLSTYPES_H
  15. #include <clstypes.h>
  16. #endif
  17.  
  18. #ifndef __SET_H
  19. #include <set.h>
  20. #endif
  21.  
  22. // End Interface Dependencies ------------------------------------------------
  23.  
  24. // Implementation Dependencies ----------------------------------------------
  25. // End Implementation Dependencies -------------------------------------------
  26.  
  27.  
  28. // Member Function //
  29.  
  30. Set::~Set()
  31.  
  32. // Summary -----------------------------------------------------------------
  33. //
  34. //      Destructor for a Set object.
  35. //
  36. //        We don't do anything here, because the destructor for HashTable
  37. //        will take care of destroying the contained objects.
  38. //
  39. // End ---------------------------------------------------------------------
  40. {
  41. }
  42. // End Destructor //
  43.  
  44.  
  45. // Member Function //
  46.  
  47. classType Set::isA() const
  48.  
  49. // Summary -----------------------------------------------------------------
  50. //
  51. //      Returns the class type of a set.
  52. //
  53. // End ---------------------------------------------------------------------
  54. {
  55.     return setClass;
  56. }
  57. // End Member Function Set::isA //
  58.  
  59.  
  60. // Member Function //
  61.  
  62. char *Set::nameOf() const
  63.  
  64. // Summary -----------------------------------------------------------------
  65. //
  66. //      Returns a pointer to the character string "Set".
  67. //
  68. // End ---------------------------------------------------------------------
  69. {
  70.     return "Set";
  71. }
  72. // End Member Function Set::isA //
  73.  
  74.  
  75. // Member Function //
  76.  
  77. void Set::add( Object& objectToAdd )
  78.  
  79. // Summary -----------------------------------------------------------------
  80. //
  81. //      Adds an object to the set.  Sets may have only one copy of an object
  82. //      in the set at any time.
  83. //
  84. // Parameters
  85. //
  86. //      objectToAdd
  87. //
  88. // End ---------------------------------------------------------------------
  89. {
  90.     if ( !(Bag::hasMember( objectToAdd )) )
  91.     {
  92.         Bag::add( objectToAdd );
  93.     }
  94. }
  95. // End Member Function Set::add //
  96.  
  97.  
  98.  
  99.