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

  1. // Borland C++ - (C) Copyright 1991 by Borland International
  2.  
  3. // Contents ----------------------------------------------------------------
  4. //
  5. //         Association
  6. //         Association::Association
  7. //         Association::Association    copy constructor
  8. //
  9. // Description
  10. //
  11. //         Defines the class Association, which is an object that can
  12. //         be stored in a Dictionary.  An Association contains references
  13. //         to two Objects, a Key and a Value.
  14. //
  15. // End ---------------------------------------------------------------------
  16.  
  17. // Interface Dependencies ---------------------------------------------------
  18.  
  19. #ifndef __ASSOC_H
  20. #define __ASSOC_H
  21.  
  22. #ifndef __IOSTREAM_H
  23. #include <iostream.h>
  24. #define __IOSTREAM_H
  25. #endif
  26.  
  27. #ifndef __CLSTYPES_H
  28. #include <clstypes.h>
  29. #define __CLSTYPES_H
  30. #endif
  31.  
  32. #ifndef __OBJECT_H
  33. #include <object.h>
  34. #define __OBJECT_H
  35. #endif
  36.  
  37. // End Interface Dependencies ------------------------------------------------
  38.  
  39. // Class //
  40. _CLASSDEF(Association)
  41.  
  42. class _CLASSTYPE Association : public Object
  43. {
  44. public:
  45.     Association( RObject k, RObject v ) : aKey( k ), aValue( v ) {}
  46.     Association( RCAssociation a ) :
  47.                                     aKey( a.key() ), aValue( a.value() ) {}
  48.     virtual ~Association();
  49.  
  50.     RObject key() const { return aKey; }
  51.     RObject         value() const { return aValue; }
  52.  
  53.     virtual classType       isA() const;
  54.     virtual Pchar nameOf() const;
  55.     virtual hashValueType   hashValue() const;
  56.     virtual int             isEqual( RCObject ) const;
  57.     virtual int             isAssociation() const;
  58.     virtual void            printOn( Rostream ) const;
  59.  
  60. private:
  61.             RObject            aKey;
  62.             RObject            aValue;
  63. };
  64.  
  65. // Description -------------------------------------------------------------
  66. //
  67. //         Defines an association class.  An association keeps two objects
  68. //         together and treats them as a single object.
  69. //
  70. // Constructors
  71. //
  72. //         Association( RObject k, RObject v )
  73. //
  74. //         Constructor from two objects.
  75. //
  76. //         Association( Association& a )
  77. //
  78. //         Copy constructor.
  79. //
  80. // Public Members
  81. //
  82. //         key
  83. //
  84. //         Returns a reference to the key
  85. //
  86. //         value
  87. //
  88. //         Returns a reference to the value of the association.
  89. //
  90. // Private Members
  91. //
  92. //      aKey
  93. //
  94. //      aValue
  95. //
  96. // End ---------------------------------------------------------------------
  97.  
  98.  
  99. #endif // ifndef __ASSOC_H //
  100.  
  101.