home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / TCPP10-8.ZIP / CLASSSRC.ZIP / ASSOC.CPP < prev    next >
C/C++ Source or Header  |  1990-09-26  |  4KB  |  166 lines

  1. //
  2. // This file contains proprietary information of Borland International.
  3. // Copying or reproduction without prior written approval is prohibited.
  4. //
  5. // Copyright (c) 1990
  6. // Borland International
  7. // 1800 Scotts Valley Dr.
  8. // Scotts Valley, CA 95066
  9. // (408) 438-8400
  10. //
  11.  
  12. // Contents ----------------------------------------------------------------
  13. //
  14. //      Association::isA
  15. //      Association::nameOf
  16. //         Association::printOn
  17. //      Association::hashValue
  18. //      Association::isEqual
  19. //      Association::isAssociation
  20. //
  21. // Description
  22. //
  23. //         Implementation of member functions for class Association.
  24. //
  25. // End ---------------------------------------------------------------------
  26.  
  27. // Interface Dependencies ---------------------------------------------------
  28.  
  29. #ifndef __IOSTREAM_H
  30. #include <iostream.h>
  31. #define __IOSTREAM_H
  32. #endif
  33.  
  34. #ifndef __CLSTYPES_H
  35. #include <clstypes.h>
  36. #endif
  37.  
  38. #ifndef __ASSOC_H
  39. #include <assoc.h>
  40. #endif
  41.  
  42. // End Interface Dependencies ------------------------------------------------
  43.  
  44. // Implementation Dependencies ----------------------------------------------
  45. // End Implementation Dependencies -------------------------------------------
  46.  
  47.  
  48. // Member Function //
  49.  
  50. Association::~Association()
  51.  
  52. // Summary -----------------------------------------------------------------
  53. //
  54. //      Destructor for an Association object.
  55. //
  56. //        We don't do anything here, because the key and value fields will
  57. //        be destroyed automatically.
  58. //
  59. // End ---------------------------------------------------------------------
  60. {
  61. }
  62. // End Destructor //
  63.  
  64.  
  65. // Member Function //
  66.  
  67. classType Association::isA() const
  68.  
  69. // Summary -----------------------------------------------------------------
  70. //
  71. //         Returns the class type of a association.
  72. //
  73. // End ---------------------------------------------------------------------
  74. {
  75.     return associationClass; 
  76. }
  77. // End Member Function Association::isA //
  78.  
  79.  
  80. // Member Function //
  81.  
  82. char *Association::nameOf() const
  83.  
  84. // Summary -----------------------------------------------------------------
  85. //
  86. //         Returns a pointer to the character string "Association."
  87. //
  88. // End ---------------------------------------------------------------------
  89. {
  90.     return "Association";
  91. }
  92. // End Member Function Association::isA //
  93.  
  94.  
  95. // Member Function //
  96.  
  97. void Association::printOn( ostream& outputStream ) const
  98.  
  99. // Summary -----------------------------------------------------------------
  100. //
  101. //         Displays the contents of this association object.
  102. //
  103. // Parameters
  104. //
  105. //         outputStream
  106. //
  107. //         The stream on which we are to display the association.
  108. //
  109. // End ---------------------------------------------------------------------
  110. {
  111.     outputStream << " " << nameOf() << " { ";
  112.     aKey.printOn( outputStream );
  113.     outputStream << ", ";
  114.     aValue.printOn( outputStream );
  115.     outputStream << " }\n";
  116. }
  117. // End Member Function //
  118.  
  119.  
  120. // Member Function //
  121.  
  122. hashValueType Association::hashValue() const
  123.  
  124. // Summary -----------------------------------------------------------------
  125. //
  126. //         Returns the hash value of an association.  We use the key's
  127. //      hash value.
  128. //
  129. // End ---------------------------------------------------------------------
  130. {
  131.     return aKey.hashValue();
  132. }
  133. // End Member Function Association::hashValue //
  134.  
  135.  
  136. // Member Function //
  137.  
  138. int Association::isEqual( const Object& toObject ) const
  139.  
  140. // Summary -----------------------------------------------------------------
  141. //
  142. //         Returns the hash value of an association.  We use the key's
  143. //      hash value.
  144. //
  145. // End ---------------------------------------------------------------------
  146. {
  147.     return aKey == ( (Association&)toObject ).key();
  148. }
  149. // End Member Function Association::isEqual //
  150.  
  151.  
  152. // Member Function //
  153.  
  154. int Association::isAssociation() const
  155.  
  156. // Summary -----------------------------------------------------------------
  157. //
  158. //         Indicates that the given object is an association.
  159. //
  160. // End ---------------------------------------------------------------------
  161. {
  162.     return 1;
  163. }
  164. // End Member Function Association::isEqual //
  165.  
  166.