00001 /* -*- C++ -*- */ 00002 00003 //============================================================================= 00004 /** 00005 * @file Key_Adapters.h 00006 * 00007 * $Id: Key_Adapters.h 71473 2006-03-10 07:19:20Z jtc $ 00008 * 00009 * @author Irfan Pyarali 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_KEY_ADAPTERS_H 00014 #define TAO_KEY_ADAPTERS_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/PortableServer/portableserver_export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/PortableServer/PS_ForwardC.h" 00025 00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00027 class ACE_Active_Map_Manager_Key; 00028 ACE_END_VERSIONED_NAMESPACE_DECL 00029 00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00031 00032 /////////////////////////////////////////////////////////////////////////////// 00033 00034 /** 00035 * @class TAO_Incremental_Key_Generator 00036 * 00037 * @brief Defines a key generator. 00038 * 00039 * This class is used in adapters of maps that do not produce keys. 00040 */ 00041 class TAO_Incremental_Key_Generator 00042 { 00043 public: 00044 00045 TAO_Incremental_Key_Generator (void); 00046 00047 int operator() (PortableServer::ObjectId &id); 00048 00049 protected: 00050 00051 CORBA::ULong counter_; 00052 }; 00053 00054 //////////////////////////////////////////////////////////////////////////////// 00055 00056 /** 00057 * @class TAO_ObjectId_Hash 00058 * 00059 * @brief Hashing class for Object Ids. 00060 * 00061 * Define the hash() method for Object Ids. 00062 */ 00063 class TAO_PortableServer_Export TAO_ObjectId_Hash 00064 { 00065 public: 00066 00067 /// Returns hash value. 00068 u_long operator () (const PortableServer::ObjectId &id) const; 00069 }; 00070 00071 //////////////////////////////////////////////////////////////////////////////// 00072 00073 /** 00074 * @class TAO_Ignore_Original_Key_Adapter 00075 * 00076 * @brief A key adapter (encode/decode) class. 00077 * 00078 * Define the encoding and decoding methods for converting 00079 * between Object Ids and active keys. This class ignores the 00080 * <original_key> passed to it. 00081 */ 00082 class TAO_Ignore_Original_Key_Adapter 00083 { 00084 public: 00085 00086 int encode (const PortableServer::ObjectId &original_key, 00087 const ACE_Active_Map_Manager_Key &active_key, 00088 PortableServer::ObjectId &modified_key); 00089 00090 int decode (const PortableServer::ObjectId &modified_key, 00091 ACE_Active_Map_Manager_Key &active_key); 00092 00093 int decode (const PortableServer::ObjectId &modified_key, 00094 PortableServer::ObjectId &original_key); 00095 }; 00096 00097 //////////////////////////////////////////////////////////////////////////////// 00098 00099 /** 00100 * @class TAO_Preserve_Original_Key_Adapter 00101 * 00102 * @brief A key adapter (encode/decode) class. 00103 * 00104 * Define the encoding and decoding methods for converting 00105 * between Object Ids and active keys. This class remembers the 00106 * <original_key> passed to it. 00107 */ 00108 class TAO_Preserve_Original_Key_Adapter 00109 { 00110 public: 00111 00112 int encode (const PortableServer::ObjectId &original_key, 00113 const ACE_Active_Map_Manager_Key &active_key, 00114 PortableServer::ObjectId &modified_key); 00115 00116 int decode (const PortableServer::ObjectId &modified_key, 00117 ACE_Active_Map_Manager_Key &active_key); 00118 00119 int decode (const PortableServer::ObjectId &modified_key, 00120 PortableServer::ObjectId &original_key); 00121 }; 00122 00123 /////////////////////////////////////////////////////////////////////////////// 00124 00125 TAO_END_VERSIONED_NAMESPACE_DECL 00126 00127 #include /**/ "ace/post.h" 00128 00129 #endif /* TAO_KEY_ADAPTERS_H */