Active_Object_Map.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // $Id: Active_Object_Map.inl 81663 2008-05-09 12:43:47Z johnnyw $
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 (
00019   PortableServer::Servant servant,
00020   CORBA::Short priority,
00021   PortableServer::ObjectId_out system_id)
00022 {
00023   if (servant == 0 && !this->using_active_maps_)
00024     {
00025       PortableServer::ObjectId id;
00026 
00027       int result = this->user_id_map_->create_key (id);
00028 
00029       if (result == 0)
00030         {
00031           ACE_NEW_RETURN (system_id,
00032                           PortableServer::ObjectId (id),
00033                           -1);
00034         }
00035 
00036       return result;
00037     }
00038 
00039   TAO_Active_Object_Map_Entry *entry = 0;
00040 
00041   int result =
00042     this->id_assignment_strategy_->bind_using_system_id (servant,
00043                                                          priority,
00044                                                          entry);
00045 
00046   if (result == 0)
00047     {
00048       result = this->id_hint_strategy_->system_id (system_id,
00049                                                    *entry);
00050     }
00051 
00052   return result;
00053 }
00054 
00055 ACE_INLINE int
00056 TAO_Active_Object_Map::bind_using_system_id_returning_user_id (
00057   PortableServer::Servant servant,
00058   CORBA::Short priority,
00059   PortableServer::ObjectId_out user_id)
00060 {
00061   TAO_Active_Object_Map_Entry *entry = 0;
00062 
00063   int result =
00064     this->id_assignment_strategy_->bind_using_system_id (servant,
00065                                                          priority,
00066                                                          entry);
00067   if (result == 0)
00068     ACE_NEW_RETURN (user_id,
00069                     PortableServer::ObjectId (entry->user_id_),
00070                     -1);
00071   return result;
00072 }
00073 
00074 ACE_INLINE int
00075 TAO_Active_Object_Map::bind_using_user_id (
00076   PortableServer::Servant servant,
00077   const PortableServer::ObjectId &user_id,
00078   CORBA::Short priority)
00079 {
00080   TAO_Active_Object_Map_Entry *entry = 0;
00081   return this->id_uniqueness_strategy_->bind_using_user_id (servant,
00082                                                             user_id,
00083                                                             priority,
00084                                                             entry);
00085 }
00086 
00087 ACE_INLINE int
00088 TAO_Active_Object_Map::find_system_id_using_user_id (
00089   const PortableServer::ObjectId &user_id,
00090   CORBA::Short priority,
00091   PortableServer::ObjectId_out system_id)
00092 {
00093   if (!this->using_active_maps_)
00094     {
00095       ACE_NEW_RETURN (system_id,
00096                       PortableServer::ObjectId (user_id),
00097                       -1);
00098 
00099       return 0;
00100     }
00101 
00102   TAO_Active_Object_Map_Entry *entry = 0;
00103   int result =
00104     this->id_uniqueness_strategy_->bind_using_user_id (0,
00105                                                        user_id,
00106                                                        priority,
00107                                                        entry);
00108   if (result == 0)
00109     {
00110       result =
00111         this->id_hint_strategy_->system_id (system_id, *entry);
00112     }
00113 
00114   return result;
00115 }
00116 
00117 ACE_INLINE int
00118 TAO_Active_Object_Map::rebind_using_user_id_and_system_id (
00119   PortableServer::Servant servant,
00120   const PortableServer::ObjectId &user_id,
00121   const PortableServer::ObjectId &,
00122   TAO_Active_Object_Map_Entry *&entry)
00123 {
00124   return this->id_uniqueness_strategy_->bind_using_user_id (servant,
00125                                                             user_id,
00126                                                             -1,
00127                                                             entry);
00128 }
00129 
00130 ACE_INLINE int
00131 TAO_Active_Object_Map::unbind_using_user_id (
00132   const PortableServer::ObjectId &user_id)
00133 {
00134   return this->id_uniqueness_strategy_->unbind_using_user_id (user_id);
00135 }
00136 
00137 ACE_INLINE int
00138 TAO_Active_Object_Map::find_user_id_using_servant (
00139   PortableServer::Servant servant,
00140   PortableServer::ObjectId_out user_id)
00141 {
00142   return
00143     this->id_uniqueness_strategy_->find_user_id_using_servant (servant,
00144                                                                user_id);
00145 }
00146 
00147 ACE_INLINE int
00148 TAO_Active_Object_Map::find_system_id_using_servant (
00149   PortableServer::Servant servant,
00150   PortableServer::ObjectId_out system_id,
00151   CORBA::Short &priority)
00152 {
00153   return
00154     this->id_uniqueness_strategy_->find_system_id_using_servant (servant,
00155                                                                  system_id,
00156                                                                  priority);
00157 }
00158 
00159 ACE_INLINE int
00160 TAO_Active_Object_Map::find_servant_using_user_id (
00161   const PortableServer::ObjectId &user_id,
00162   PortableServer::Servant &servant)
00163 {
00164   TAO_Active_Object_Map_Entry *entry = 0;
00165   int result = this->user_id_map_->find (user_id, entry);
00166 
00167   if (result == 0)
00168     {
00169       if (entry->deactivated_)
00170         {
00171           result = -1;
00172         }
00173       else if (entry->servant_ == 0)
00174         {
00175           result = -1;
00176         }
00177       else
00178         {
00179           servant = entry->servant_;
00180         }
00181     }
00182 
00183   return result;
00184 }
00185 
00186 ACE_INLINE int
00187 TAO_Active_Object_Map::find_servant_using_system_id_and_user_id (
00188   const PortableServer::ObjectId &system_id,
00189   const PortableServer::ObjectId &user_id,
00190   PortableServer::Servant &servant,
00191   TAO_Active_Object_Map_Entry *&entry)
00192 {
00193   return
00194     this->lifespan_strategy_->find_servant_using_system_id_and_user_id (
00195       system_id,
00196       user_id,
00197       servant,
00198       entry);
00199 }
00200 
00201 ACE_INLINE int
00202 TAO_Active_Object_Map::find_entry_using_user_id (
00203   const PortableServer::ObjectId &user_id,
00204   TAO_Active_Object_Map_Entry *&entry)
00205 {
00206   int result = this->user_id_map_->find (user_id, entry);
00207 
00208   if (result == 0)
00209     {
00210       if (entry->deactivated_)
00211         {
00212           result = -1;
00213         }
00214     }
00215 
00216   return result;
00217 }
00218 
00219 ACE_INLINE int
00220 TAO_Active_Object_Map::find_servant_and_system_id_using_user_id (
00221   const PortableServer::ObjectId &user_id,
00222   PortableServer::Servant &servant,
00223   PortableServer::ObjectId_out system_id,
00224   CORBA::Short &priority)
00225 {
00226   TAO_Active_Object_Map_Entry *entry = 0;
00227   int result = this->find_entry_using_user_id (user_id, entry);
00228 
00229   if (result == 0)
00230     {
00231       if (entry->servant_ == 0)
00232         {
00233           result = -1;
00234         }
00235       else
00236         {
00237           result = this->id_hint_strategy_->system_id (system_id,
00238                                                        *entry);
00239           if (result == 0)
00240             {
00241               servant = entry->servant_;
00242               priority = entry->priority_;
00243             }
00244         }
00245     }
00246 
00247   return result;
00248 }
00249 
00250 ACE_INLINE int
00251 TAO_Active_Object_Map::find_user_id_using_system_id (
00252   const PortableServer::ObjectId &system_id,
00253   PortableServer::ObjectId_out user_id)
00254 {
00255   PortableServer::ObjectId id;
00256   if (this->id_hint_strategy_->recover_key (system_id, id) == 0)
00257     {
00258       ACE_NEW_RETURN (user_id,
00259                       PortableServer::ObjectId (id),
00260                       -1);
00261     }
00262 
00263   return 0;
00264 }
00265 
00266 ACE_INLINE int
00267 TAO_Active_Object_Map::find_user_id_using_system_id (
00268   const PortableServer::ObjectId &system_id,
00269   PortableServer::ObjectId &user_id)
00270 {
00271   return this->id_hint_strategy_->recover_key (system_id, user_id);
00272 }
00273 
00274 ACE_INLINE CORBA::Boolean
00275 TAO_Active_Object_Map::remaining_activations (PortableServer::Servant servant)
00276 {
00277   return this->id_uniqueness_strategy_->remaining_activations (servant);
00278 }
00279 
00280 ACE_INLINE size_t
00281 TAO_Active_Object_Map::current_size (void)
00282 {
00283   return this->user_id_map_->current_size ();
00284 }
00285 
00286 /* static */
00287 ACE_INLINE size_t
00288 TAO_Active_Object_Map::system_id_size (void)
00289 {
00290   return TAO_Active_Object_Map::system_id_size_;
00291 }
00292 
00293 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:40:53 2010 for TAO_PortableServer by  doxygen 1.4.7