00001
00002
00003
00004
00005 #include "tao/PortableServer/Active_Object_Map_Entry.h"
00006
00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00008
00009 ACE_INLINE int
00010 TAO_Active_Object_Map::is_servant_in_map (PortableServer::Servant servant,
00011 bool &deactivated)
00012 {
00013 return this->id_uniqueness_strategy_->is_servant_in_map (servant,
00014 deactivated);
00015 }
00016
00017 ACE_INLINE int
00018 TAO_Active_Object_Map::bind_using_system_id_returning_system_id (PortableServer::Servant servant,
00019 CORBA::Short priority,
00020 PortableServer::ObjectId_out system_id)
00021 {
00022 if (servant == 0 &&
00023 !this->using_active_maps_)
00024 {
00025 PortableServer::ObjectId id;
00026
00027 int result =
00028 this->user_id_map_->create_key (id);
00029
00030 if (result == 0)
00031 {
00032 ACE_NEW_RETURN (system_id,
00033 PortableServer::ObjectId (id),
00034 -1);
00035 }
00036
00037 return result;
00038 }
00039
00040 TAO_Active_Object_Map_Entry *entry = 0;
00041
00042 int result = this->id_assignment_strategy_->bind_using_system_id (servant,
00043 priority,
00044 entry);
00045
00046 if (result == 0)
00047 result = this->id_hint_strategy_->system_id (system_id,
00048 *entry);
00049 return result;
00050 }
00051
00052 ACE_INLINE int
00053 TAO_Active_Object_Map::bind_using_system_id_returning_user_id (PortableServer::Servant servant,
00054 CORBA::Short priority,
00055 PortableServer::ObjectId_out user_id)
00056 {
00057 TAO_Active_Object_Map_Entry *entry = 0;
00058
00059 int result = this->id_assignment_strategy_->bind_using_system_id (servant,
00060 priority,
00061 entry);
00062 if (result == 0)
00063 ACE_NEW_RETURN (user_id,
00064 PortableServer::ObjectId (entry->user_id_),
00065 -1);
00066 return result;
00067 }
00068
00069 ACE_INLINE int
00070 TAO_Active_Object_Map::bind_using_user_id (PortableServer::Servant servant,
00071 const PortableServer::ObjectId &user_id,
00072 CORBA::Short priority)
00073 {
00074 TAO_Active_Object_Map_Entry *entry = 0;
00075 return this->id_uniqueness_strategy_->bind_using_user_id (servant,
00076 user_id,
00077 priority,
00078 entry);
00079 }
00080
00081 ACE_INLINE int
00082 TAO_Active_Object_Map::find_system_id_using_user_id (const PortableServer::ObjectId &user_id,
00083 CORBA::Short priority,
00084 PortableServer::ObjectId_out system_id)
00085 {
00086 if (!this->using_active_maps_)
00087 {
00088 ACE_NEW_RETURN (system_id,
00089 PortableServer::ObjectId (user_id),
00090 -1);
00091
00092 return 0;
00093 }
00094
00095 TAO_Active_Object_Map_Entry *entry = 0;
00096 int result = this->id_uniqueness_strategy_->bind_using_user_id (0,
00097 user_id,
00098 priority,
00099 entry);
00100 if (result == 0)
00101 result = this->id_hint_strategy_->system_id (system_id,
00102 *entry);
00103 return result;
00104 }
00105
00106 ACE_INLINE int
00107 TAO_Active_Object_Map::rebind_using_user_id_and_system_id (PortableServer::Servant servant,
00108 const PortableServer::ObjectId &user_id,
00109 const PortableServer::ObjectId &system_id,
00110 TAO_Active_Object_Map_Entry *&entry)
00111 {
00112 ACE_UNUSED_ARG (system_id);
00113
00114 return this->id_uniqueness_strategy_->bind_using_user_id (servant,
00115 user_id,
00116 -1,
00117 entry);
00118 }
00119
00120 ACE_INLINE int
00121 TAO_Active_Object_Map::unbind_using_user_id (const PortableServer::ObjectId &user_id)
00122 {
00123 return this->id_uniqueness_strategy_->unbind_using_user_id (user_id);
00124 }
00125
00126 ACE_INLINE int
00127 TAO_Active_Object_Map::find_user_id_using_servant (PortableServer::Servant servant,
00128 PortableServer::ObjectId_out user_id)
00129 {
00130 return this->id_uniqueness_strategy_->find_user_id_using_servant (servant,
00131 user_id);
00132 }
00133
00134 ACE_INLINE int
00135 TAO_Active_Object_Map::find_system_id_using_servant (PortableServer::Servant servant,
00136 PortableServer::ObjectId_out system_id,
00137 CORBA::Short &priority)
00138 {
00139 return this->id_uniqueness_strategy_->find_system_id_using_servant (servant,
00140 system_id,
00141 priority);
00142 }
00143
00144 ACE_INLINE int
00145 TAO_Active_Object_Map::find_servant_using_user_id (const PortableServer::ObjectId &user_id,
00146 PortableServer::Servant &servant)
00147 {
00148 TAO_Active_Object_Map_Entry *entry = 0;
00149 int result = this->user_id_map_->find (user_id,
00150 entry);
00151 if (result == 0)
00152 {
00153 if (entry->deactivated_)
00154 result = -1;
00155 else if (entry->servant_ == 0)
00156 result = -1;
00157 else
00158 servant = entry->servant_;
00159 }
00160
00161 return result;
00162 }
00163
00164 ACE_INLINE int
00165 TAO_Active_Object_Map::find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
00166 const PortableServer::ObjectId &user_id,
00167 PortableServer::Servant &servant,
00168 TAO_Active_Object_Map_Entry *&entry)
00169 {
00170 return this->lifespan_strategy_->find_servant_using_system_id_and_user_id (system_id,
00171 user_id,
00172 servant,
00173 entry);
00174 }
00175
00176 ACE_INLINE int
00177 TAO_Active_Object_Map::find_entry_using_user_id (const PortableServer::ObjectId &user_id,
00178 TAO_Active_Object_Map_Entry *&entry)
00179 {
00180 int result = this->user_id_map_->find (user_id,
00181 entry);
00182
00183 if (result == 0)
00184 {
00185 if (entry->deactivated_)
00186 result = -1;
00187 }
00188
00189 return result;
00190 }
00191
00192 ACE_INLINE int
00193 TAO_Active_Object_Map::find_servant_and_system_id_using_user_id (const PortableServer::ObjectId &user_id,
00194 PortableServer::Servant &servant,
00195 PortableServer::ObjectId_out system_id,
00196 CORBA::Short &priority)
00197 {
00198 TAO_Active_Object_Map_Entry *entry = 0;
00199 int result = this->find_entry_using_user_id (user_id,
00200 entry);
00201
00202 if (result == 0)
00203 {
00204 if (entry->servant_ == 0)
00205 {
00206 result = -1;
00207 }
00208 else
00209 {
00210 result = this->id_hint_strategy_->system_id (system_id,
00211 *entry);
00212 if (result == 0)
00213 {
00214 servant = entry->servant_;
00215 priority = entry->priority_;
00216 }
00217 }
00218 }
00219
00220 return result;
00221 }
00222
00223 ACE_INLINE int
00224 TAO_Active_Object_Map::find_user_id_using_system_id (const PortableServer::ObjectId &system_id,
00225 PortableServer::ObjectId_out user_id)
00226 {
00227 PortableServer::ObjectId id;
00228 int result = this->id_hint_strategy_->recover_key (system_id,
00229 id);
00230 if (result == 0)
00231 ACE_NEW_RETURN (user_id,
00232 PortableServer::ObjectId (id),
00233 -1);
00234 return 0;
00235 }
00236
00237 ACE_INLINE int
00238 TAO_Active_Object_Map::find_user_id_using_system_id (const PortableServer::ObjectId &system_id,
00239 PortableServer::ObjectId &user_id)
00240 {
00241 return this->id_hint_strategy_->recover_key (system_id,
00242 user_id);
00243 }
00244
00245 ACE_INLINE CORBA::Boolean
00246 TAO_Active_Object_Map::remaining_activations (PortableServer::Servant servant)
00247 {
00248 return this->id_uniqueness_strategy_->remaining_activations (servant);
00249 }
00250
00251 ACE_INLINE size_t
00252 TAO_Active_Object_Map::current_size (void)
00253 {
00254 return this->user_id_map_->current_size ();
00255 }
00256
00257
00258 ACE_INLINE size_t
00259 TAO_Active_Object_Map::system_id_size (void)
00260 {
00261 return TAO_Active_Object_Map::system_id_size_;
00262 }
00263
00264 TAO_END_VERSIONED_NAMESPACE_DECL