00001 00002 #ifndef d_Association_h 00003 #define d_Association_h 1 00004 00005 //------------------------------------------------------------------------------ 00006 #include "oDynaObject.h" 00007 #include "oStreamable.h" 00008 //------------------------------------------------------------------------------ 00009 00010 /** 00011 * Express an association between a key and a value. 00012 * 00013 * An association is compound of the couple key and value. Key and value can be 00014 * of any types. 00015 * 00016 * LOCATION: 00017 * d_Association.h 00018 * 00019 * USAGE: 00020 * d_Association< <key_type>, <value-type> <property-name>; 00021 * 00022 * Where: 00023 * 00024 * <key-type >: Key type. Can be a literal or a user type 00025 * <value-type >: Value type. Can be a literal or a user type 00026 * <PROPERTY-NAME>: NAME OF PROPERTY 00027 * 00028 * <key-type> must be an ODMG literal or a user type but with the definition of 00029 * operator<. 00030 * 00031 * EXAMPLES: 00032 * * DEFINITION OF A DICTIONARY OF CODE/PRODUCT 00033 * d_Association< d_String, d_Float > Rates; 00034 * 00035 * SEE ALSO: 00036 * d_Dictionary 00037 * 00038 * ODMG: 00039 * Compliant 00040 */ 00041 00042 template <class K, class V> 00043 class _ODLL d_Association : public oStreamable 00044 { 00045 public: 00046 00047 /** 00048 * Default Constructor. 00049 * 00050 * ODMG : Compliant 00051 */ 00052 d_Association(); 00053 00054 /** 00055 * Creates and fill a d_Association object. 00056 * 00057 * <iDomain> is the domain of the database where the object will be stored. 00058 * 00059 * Take the database's domain by d_Database::getDomain(). 00060 * 00061 * SEE ALSO: d_Database::getDomain() 00062 * ODMG : Compliant 00063 */ 00064 d_Association( const K& iKey, const V& iValue, oDomain* iDomain ); 00065 00066 /** 00067 * Copy Constructor. 00068 * 00069 * ODMG : Compliant 00070 */ 00071 d_Association ( const d_Association<K,V>& iSource ); 00072 00073 /** 00074 * Destructor. 00075 * 00076 * ODMG : Compliant 00077 */ 00078 ~d_Association(); 00079 00080 // Internal. 00081 void delete_object(){;} 00082 00083 // Internal. 00084 virtual void toStream( oObjectStream& iBuffer, 00085 oInterface* iInterface = 0 ); 00086 // Internal. 00087 virtual void fromStream( oObjectStream& iBuffer, 00088 oInterface* iInterface = 0 ); 00089 00090 // Internal. 00091 K key; 00092 // Internal. 00093 V value; 00094 00095 // Internal. 00096 oDynaObject keyDynaObject; 00097 // Internal. 00098 oDynaObject valueDynaObject; 00099 }; 00100 00101 //------------------------------------------------------------------------------ 00102 #include "d_Association.cti" 00103 00104 //------------------------------------------------------------------------------ 00105 //------------------------------------------------------------------------------ 00106 #endif
1.3-rc1