00001
00002
00003
00004
00005 #include "tao/ORB_Core.h"
00006
00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00008
00009 ACE_INLINE void
00010 TAO_Stub::reset_base (void)
00011 {
00012 this->base_profiles_.rewind ();
00013 this->profile_success_ = false;
00014
00015 this->set_profile_in_use_i (base_profiles_.get_next ());
00016 }
00017
00018
00019 ACE_INLINE ACE_Lock*
00020 TAO_Stub::profile_lock (void) const
00021 {
00022 return this->profile_lock_ptr_;
00023 }
00024
00025 ACE_INLINE void
00026 TAO_Stub::reset_forward (void)
00027 {
00028 while (this->forward_profiles_ != 0)
00029 this->forward_back_one ();
00030 }
00031
00032 ACE_INLINE void
00033 TAO_Stub::reset_profiles_i (void)
00034 {
00035 this->reset_forward ();
00036 this->reset_base ();
00037 }
00038
00039 ACE_INLINE void
00040 TAO_Stub::reset_profiles (void)
00041 {
00042 ACE_MT (ACE_GUARD (ACE_Lock,
00043 guard,
00044 *this->profile_lock_ptr_));
00045 this->reset_profiles_i ();
00046 }
00047
00048 ACE_INLINE TAO_Profile *
00049 TAO_Stub::profile_in_use (void)
00050 {
00051 return this->profile_in_use_;
00052 }
00053
00054 ACE_INLINE TAO_MProfile *
00055 TAO_Stub::make_profiles (void)
00056 {
00057 TAO_MProfile *mp = 0;
00058
00059 ACE_NEW_RETURN (mp,
00060 TAO_MProfile (base_profiles_),
00061 0);
00062
00063 return mp;
00064 }
00065
00066 ACE_INLINE TAO_Profile *
00067 TAO_Stub::next_forward_profile (void)
00068 {
00069 TAO_Profile *pfile_next = 0;
00070
00071 while (this->forward_profiles_
00072 && (pfile_next = this->forward_profiles_->get_next ()) == 0
00073 && this->forward_profiles_ != this->forward_profiles_perm_)
00074
00075
00076 this->forward_back_one ();
00077
00078 return pfile_next;
00079 }
00080
00081 ACE_INLINE TAO_Profile *
00082 TAO_Stub::next_profile_i (void)
00083 {
00084 TAO_Profile *pfile_next = 0;
00085
00086
00087 if (this->forward_profiles_perm_)
00088
00089
00090 {
00091
00092
00093 pfile_next = this->next_forward_profile ();
00094
00095 if (pfile_next == 0)
00096 {
00097
00098
00099
00100
00101
00102 this->forward_profiles_->rewind ();
00103 this->profile_success_ = false;
00104 this->set_profile_in_use_i (this->forward_profiles_->get_next());
00105 }
00106 else
00107 this->set_profile_in_use_i (pfile_next);
00108
00109
00110
00111 this->orb_core_->reinitialize_object (this);
00112
00113 return pfile_next;
00114 }
00115 else
00116 {
00117 if (this->forward_profiles_)
00118 {
00119 pfile_next = this->next_forward_profile ();
00120 if (pfile_next == 0)
00121 {
00122
00123 pfile_next = this->base_profiles_.get_next ();
00124 }
00125
00126
00127
00128 this->orb_core_->reinitialize_object (this);
00129 }
00130 else
00131 pfile_next = this->base_profiles_.get_next ();
00132
00133 if (pfile_next == 0)
00134 this->reset_base ();
00135 else
00136 this->set_profile_in_use_i (pfile_next);
00137
00138 return pfile_next;
00139 }
00140 }
00141
00142 ACE_INLINE TAO_Profile *
00143 TAO_Stub::next_profile (void)
00144 {
00145
00146 ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
00147 guard,
00148 *this->profile_lock_ptr_,
00149 0));
00150 return this->next_profile_i ();
00151 }
00152
00153 ACE_INLINE CORBA::Boolean
00154 TAO_Stub::valid_forward_profile (void)
00155 {
00156 return (this->profile_success_ && this->forward_profiles_);
00157 }
00158
00159 ACE_INLINE void
00160 TAO_Stub::set_valid_profile (void)
00161 {
00162 this->profile_success_ = true;
00163 }
00164
00165 ACE_INLINE CORBA::Boolean
00166 TAO_Stub::valid_profile (void) const
00167 {
00168 return this->profile_success_;
00169 }
00170
00171 ACE_INLINE TAO_Profile *
00172 TAO_Stub::base_profiles (const TAO_MProfile &mprofiles)
00173 {
00174 ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
00175 guard,
00176 *this->profile_lock_ptr_,
00177 0));
00178
00179
00180
00181
00182
00183
00184 this->reset_forward ();
00185 this->base_profiles_.set (mprofiles);
00186 this->reset_base ();
00187 return this->profile_in_use_;
00188
00189 }
00190
00191 ACE_INLINE CORBA::Boolean
00192 TAO_Stub::next_profile_retry (void)
00193 {
00194 ACE_MT (ACE_GUARD_RETURN (ACE_Lock,
00195 guard,
00196 *this->profile_lock_ptr_,
00197 0));
00198
00199 if (this->profile_success_ && this->forward_profiles_)
00200 {
00201
00202
00203
00204
00205
00206 this->reset_profiles_i ();
00207 return true;
00208 }
00209 else if (this->next_profile_i ())
00210 {
00211 return true;
00212 }
00213
00214 return false;
00215 #if 0
00216 else
00217 {
00218
00219
00220 TAO_Profile *prof = 0;
00221 this->orb_core_->service_profile_reselection (this,
00222 prof);
00223
00224
00225 if (prof)
00226 {
00227 return true;
00228 }
00229 this->reset_profiles_i ();
00230 return false;
00231 }
00232 #endif
00233 }
00234
00235 ACE_INLINE const TAO_MProfile&
00236 TAO_Stub::base_profiles (void) const
00237 {
00238 return this->base_profiles_;
00239 }
00240
00241 ACE_INLINE TAO_MProfile&
00242 TAO_Stub::base_profiles (void)
00243 {
00244 return this->base_profiles_;
00245 }
00246
00247 ACE_INLINE const TAO_MProfile *
00248 TAO_Stub::forward_profiles (void) const
00249 {
00250 return this->forward_profiles_;
00251 }
00252
00253 ACE_INLINE CORBA::Boolean
00254 TAO_Stub::is_collocated (void) const
00255 {
00256 return this->is_collocated_;
00257 }
00258
00259 ACE_INLINE TAO_ORB_Core*
00260 TAO_Stub::orb_core (void) const
00261 {
00262 return this->orb_core_.get ();
00263 }
00264
00265 ACE_INLINE CORBA::ORB_var &
00266 TAO_Stub::servant_orb_var (void)
00267 {
00268
00269 return this->servant_orb_;
00270 }
00271
00272 ACE_INLINE CORBA::ORB_ptr
00273 TAO_Stub::servant_orb_ptr (void)
00274 {
00275
00276 return CORBA::ORB::_duplicate (this->servant_orb_.in ());
00277 }
00278
00279 ACE_INLINE void
00280 TAO_Stub::servant_orb (CORBA::ORB_ptr orb)
00281 {
00282 this->servant_orb_ = CORBA::ORB::_duplicate (orb);
00283 }
00284
00285 ACE_INLINE TAO_Abstract_ServantBase *
00286 TAO_Stub::collocated_servant (void) const
00287 {
00288 return collocated_servant_;
00289 }
00290
00291 ACE_INLINE void
00292 TAO_Stub::collocated_servant (TAO_Abstract_ServantBase * servant)
00293 {
00294 this->collocated_servant_ = servant;
00295 }
00296
00297 ACE_INLINE TAO::Object_Proxy_Broker *
00298 TAO_Stub::object_proxy_broker (void) const
00299 {
00300 return this->object_proxy_broker_;
00301 }
00302
00303 ACE_INLINE void
00304 TAO_Stub::object_proxy_broker (TAO::Object_Proxy_Broker * object_proxy_broker)
00305 {
00306 this->object_proxy_broker_ = object_proxy_broker;
00307 }
00308
00309 ACE_INLINE void
00310 TAO_Stub::destroy (void)
00311 {
00312
00313 delete this;
00314 }
00315
00316 ACE_INLINE CORBA::Boolean
00317 TAO_Stub::optimize_collocation_objects (void) const
00318 {
00319 return this->collocation_opt_;
00320 }
00321
00322
00323
00324
00325 ACE_INLINE
00326 TAO_Stub_Auto_Ptr::TAO_Stub_Auto_Ptr (TAO_Stub *p)
00327 : p_ (p)
00328 {
00329 ACE_TRACE ("TAO_Stub_Auto_Ptr::TAO_Stub_Auto_Ptr");
00330 }
00331
00332 ACE_INLINE TAO_Stub *
00333 TAO_Stub_Auto_Ptr::get (void) const
00334 {
00335 ACE_TRACE ("TAO_Stub_Auto_Ptr::get");
00336 return this->p_;
00337 }
00338
00339 ACE_INLINE TAO_Stub *
00340 TAO_Stub_Auto_Ptr::release (void)
00341 {
00342 ACE_TRACE ("TAO_Stub_Auto_Ptr::release");
00343 TAO_Stub *old = this->p_;
00344 this->p_ = 0;
00345 return old;
00346 }
00347
00348 ACE_INLINE void
00349 TAO_Stub_Auto_Ptr::reset (TAO_Stub *p)
00350 {
00351 ACE_TRACE ("TAO_Stub_Auto_Ptr::reset");
00352 if (this->get () != p && this->get () != 0)
00353 this->get ()->_decr_refcnt ();
00354 this->p_ = p;
00355 }
00356
00357 ACE_INLINE TAO_Stub *
00358 TAO_Stub_Auto_Ptr::operator-> () const
00359 {
00360 ACE_TRACE ("TAO_Stub_Auto_Ptr::operator->");
00361 return this->get ();
00362 }
00363
00364 ACE_INLINE
00365 TAO_Stub_Auto_Ptr::TAO_Stub_Auto_Ptr (TAO_Stub_Auto_Ptr &rhs)
00366 : p_ (rhs.release ())
00367 {
00368 ACE_TRACE ("TAO_Stub_Auto_Ptr::TAO_Stub_Auto_Ptr");
00369 }
00370
00371 ACE_INLINE TAO_Stub_Auto_Ptr &
00372 TAO_Stub_Auto_Ptr::operator= (TAO_Stub_Auto_Ptr &rhs)
00373 {
00374 ACE_TRACE ("TAO_Stub_Auto_Ptr::operator=");
00375 if (this != &rhs)
00376 {
00377 this->reset (rhs.release ());
00378 }
00379 return *this;
00380 }
00381
00382 ACE_INLINE
00383 TAO_Stub_Auto_Ptr::~TAO_Stub_Auto_Ptr (void)
00384 {
00385 ACE_TRACE ("TAO_Stub_Auto_Ptr::~TAO_Stub_Auto_Ptr");
00386 if (this->get() != 0)
00387 this->get ()->_decr_refcnt ();
00388 }
00389
00390
00391
00392 ACE_INLINE TAO_Stub &
00393 TAO_Stub_Auto_Ptr::operator *() const
00394 {
00395 ACE_TRACE ("TAO_Stub_Auto_Ptr::operator *()");
00396
00397 return *this->get ();
00398 }
00399
00400 TAO_END_VERSIONED_NAMESPACE_DECL