ORB_Core.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // $Id: ORB_Core.inl 81473 2008-04-28 13:11:24Z johnnyw $
00004 
00005 #include "tao/ORB_Core_TSS_Resources.h"
00006 #include "tao/ORB_Table.h"
00007 
00008 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00009 
00010 ACE_INLINE ACE_Service_Gestalt*
00011 TAO_ORB_Core::configuration (void) const
00012 {
00013   return this->config_.get ();
00014 }
00015 
00016 ACE_INLINE unsigned long
00017 TAO_ORB_Core::_incr_refcnt (void)
00018 {
00019   return this->refcount_++;
00020 }
00021 
00022 ACE_INLINE unsigned long
00023 TAO_ORB_Core::_decr_refcnt (void)
00024 {
00025   unsigned long count = --this->refcount_;
00026   if (count != 0)
00027     return count;
00028 
00029   this->fini ();
00030   return 0;
00031 }
00032 
00033 ACE_INLINE ACE_Lock *
00034 TAO_ORB_Core::locking_strategy (void)
00035 {
00036   if (this->resource_factory ()->use_locked_data_blocks ())
00037     return &this->data_block_lock_;
00038 
00039   return 0;
00040 }
00041 
00042 ACE_INLINE CORBA::Boolean
00043 TAO_ORB_Core::bidir_giop_policy (void)
00044 {
00045   return this->bidir_giop_policy_;
00046 }
00047 
00048 ACE_INLINE void
00049 TAO_ORB_Core::bidir_giop_policy (CORBA::Boolean val)
00050 {
00051   this->bidir_giop_policy_ = val;
00052 }
00053 
00054 ACE_INLINE TAO_Object_Ref_Table &
00055 TAO_ORB_Core::object_ref_table (void)
00056 {
00057   return this->object_ref_table_;
00058 }
00059 
00060 ACE_INLINE TAO::ObjectKey_Table &
00061 TAO_ORB_Core::object_key_table (void)
00062 {
00063   return this->object_key_table_;
00064 }
00065 
00066 ACE_INLINE TAO_Flushing_Strategy *
00067 TAO_ORB_Core::flushing_strategy (void)
00068 {
00069   return this->flushing_strategy_;
00070 }
00071 
00072 ACE_INLINE TAO_Protocols_Hooks *
00073 TAO_ORB_Core::get_protocols_hooks (void)
00074 {
00075   return this->protocols_hooks_;
00076 }
00077 
00078 ACE_INLINE TAO_Network_Priority_Protocols_Hooks *
00079 TAO_ORB_Core::get_network_priority_protocols_hooks (void)
00080 {
00081   return this->network_priority_protocols_hooks_;
00082 }
00083 
00084 ACE_INLINE CORBA::Boolean
00085 TAO_ORB_Core::service_profile_selection (const TAO_MProfile &mprofile,
00086                                          TAO_Profile  *&profile)
00087 {
00088   CORBA::Boolean retval = false;
00089   // @@ If different services have the same feature we may want to
00090   // prioritise them here. We need to decide here whose selection of
00091   // profile is more important.
00092   if (this->ft_service_.service_callback ())
00093     {
00094       retval =
00095         this->ft_service_.service_callback ()->select_profile (mprofile,
00096                                                                 profile);
00097     }
00098   return retval;
00099 }
00100 
00101 ACE_INLINE CORBA::Boolean
00102 TAO_ORB_Core::object_is_nil (CORBA::Object_ptr obj)
00103 {
00104   CORBA::Boolean retval = false;
00105   if (this->ft_service_.service_callback ())
00106     {
00107       retval = this->ft_service_.service_callback ()->object_is_nil (obj);
00108     }
00109   return retval;
00110 }
00111 
00112 
00113 ACE_INLINE TAO_Service_Callbacks::Profile_Equivalence
00114 TAO_ORB_Core::is_profile_equivalent (const TAO_Profile *this_p,
00115                                      const TAO_Profile *that_p)
00116 {
00117   TAO_Service_Callbacks::Profile_Equivalence retval
00118     = TAO_Service_Callbacks::DONT_KNOW;
00119 
00120   if (this->ft_service_.service_callback ())
00121     {
00122       retval =
00123         this->ft_service_.service_callback ()->is_profile_equivalent (this_p,
00124                                                                       that_p);
00125     }
00126 
00127   return retval;
00128 }
00129 
00130 ACE_INLINE CORBA::ULong
00131 TAO_ORB_Core::hash_service (TAO_Profile *p, CORBA::ULong m)
00132 {
00133   if (this->ft_service_.service_callback ())
00134     {
00135       return this->ft_service_.service_callback ()->hash_ft (p, m);
00136     }
00137 
00138   return 0;
00139 }
00140 
00141 ACE_INLINE TAO_Fault_Tolerance_Service &
00142 TAO_ORB_Core::fault_tolerance_service (void)
00143 {
00144   return this->ft_service_;
00145 }
00146 
00147 ACE_INLINE CORBA::Boolean
00148 TAO_ORB_Core::ft_send_extended_sc (void)
00149 {
00150   return this->ft_send_extended_sc_;
00151 }
00152 
00153 ACE_INLINE ACE_Thread_Manager *
00154 TAO_ORB_Core::thr_mgr (void)
00155 {
00156   return &this->tm_;
00157 }
00158 
00159 ACE_INLINE CORBA::ORB_ptr
00160 TAO_ORB_Core::orb (void)
00161 {
00162   return this->orb_;
00163 }
00164 
00165 ACE_INLINE TAO_Adapter_Registry *
00166 TAO_ORB_Core::adapter_registry (void)
00167 {
00168   return &this->adapter_registry_;
00169 }
00170 
00171 ACE_INLINE TAO_Request_Dispatcher *
00172 TAO_ORB_Core::request_dispatcher (void)
00173 {
00174   return this->request_dispatcher_;
00175 }
00176 
00177 ACE_INLINE TAO_ORB_Core::InitRefMap *
00178 TAO_ORB_Core::init_ref_map (void)
00179 {
00180   return &this->init_ref_map_;
00181 }
00182 
00183 ACE_INLINE void
00184 TAO_ORB_Core::set_default (const char * orb_id)
00185 {
00186   TAO::ORB_Table * const table = TAO::ORB_Table::instance ();
00187   table->set_default (orb_id);
00188 }
00189 
00190 ACE_INLINE void
00191 TAO_ORB_Core::not_default (const char * orb_id)
00192 {
00193   TAO::ORB_Table * const table = TAO::ORB_Table::instance ();
00194   table->not_default (orb_id);
00195 }
00196 
00197 ACE_INLINE void
00198 TAO_ORB_Core::optimize_collocation_objects (CORBA::Boolean opt)
00199 {
00200   this->opt_for_collocation_ = opt;
00201 }
00202 
00203 ACE_INLINE CORBA::Boolean
00204 TAO_ORB_Core::optimize_collocation_objects (void) const
00205 {
00206   return this->opt_for_collocation_;
00207 }
00208 
00209 ACE_INLINE void
00210 TAO_ORB_Core::use_global_collocation (CORBA::Boolean opt)
00211 {
00212   this->use_global_collocation_ = opt;
00213 }
00214 
00215 ACE_INLINE CORBA::Boolean
00216 TAO_ORB_Core::use_global_collocation (void) const
00217 {
00218   return this->use_global_collocation_;
00219 }
00220 
00221 ACE_INLINE CORBA::ULong
00222 TAO_ORB_Core::get_collocation_strategy (void) const
00223 {
00224   return this->collocation_strategy_;
00225 }
00226 
00227 ACE_INLINE TAO_ORB_Parameters *
00228 TAO_ORB_Core::orb_params(void)
00229 {
00230   return &(this->orb_params_);
00231 }
00232 
00233 #define TAO_OC_RETRIEVE(member) \
00234 ((this->member##_ == 0) \
00235   ? (this->member##_ = this->resource_factory ()->get_##member ()) \
00236   : (this->member##_))
00237 
00238 ACE_INLINE TAO_ProtocolFactorySet *
00239 TAO_ORB_Core::protocol_factories (void)
00240 {
00241   return TAO_OC_RETRIEVE (protocol_factories);
00242 }
00243 
00244 ACE_INLINE TAO_Parser_Registry *
00245 TAO_ORB_Core::parser_registry (void)
00246 {
00247   return &this->parser_registry_;
00248 }
00249 
00250 #undef TAO_OC_RETRIEVE
00251 
00252 #if (TAO_HAS_CORBA_MESSAGING == 1)
00253 
00254 ACE_INLINE TAO_Policy_Manager *
00255 TAO_ORB_Core::policy_manager (void)
00256 {
00257   return this->policy_manager_;
00258 }
00259 
00260 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00261 
00262 ACE_INLINE TAO_ORB_Core_TSS_Resources*
00263 TAO_ORB_Core::get_tss_resources (void)
00264 {
00265   return ACE_TSS_GET (&this->tss_resources_,TAO_ORB_Core_TSS_Resources);
00266 }
00267 
00268 ACE_INLINE void *
00269 TAO_ORB_Core::get_tss_resource (size_t slot_id)
00270 {
00271   TAO_ORB_Core_TSS_Resources *tss_resources =
00272     this->get_tss_resources ();
00273 
00274   if (slot_id >= tss_resources->ts_objects_.size ())
00275     return 0;
00276 
00277   return tss_resources->ts_objects_[slot_id];
00278 }
00279 
00280 ACE_INLINE int
00281 TAO_ORB_Core::set_tss_resource (size_t slot_id, void *ts_object)
00282 {
00283   TAO_ORB_Core_TSS_Resources *tss_resources =
00284     this->get_tss_resources ();
00285 
00286   // The number of allocated slots is equal to the number of
00287   // registered TSS cleanup functions, *not* the size of the array in
00288   // the ORB core TSS resources.
00289   if (slot_id >= this->tss_cleanup_funcs_.size ())
00290     {
00291       errno = EINVAL;
00292       return -1;
00293     }
00294 
00295   // If the TSS array isn't large enough, then increase its size.
00296   // We're guaranteed not to exceed the number of allocated slots by
00297   // the above check.
00298   const size_t old_size = tss_resources->ts_objects_.size ();
00299   const size_t new_size = slot_id + 1;
00300   if (slot_id >= old_size
00301       && tss_resources->ts_objects_.size (new_size) != 0)
00302     return -1;
00303 
00304   // Initialize intermediate array elements to zero, since they
00305   // haven't been initialized yet.  This ensures that garbage is not
00306   // returned when accessing any of those elements at a later point in
00307   // time.
00308   for (size_t i = old_size; i < slot_id; ++i)
00309     tss_resources->ts_objects_[i] = 0;
00310 
00311   tss_resources->ts_objects_[slot_id] = ts_object;
00312 
00313   // Make sure the ORB core pointer is set in the ORB core's TSS
00314   // resources so that the TSS cleanup functions stored in the ORB
00315   // core can be invoked.
00316   tss_resources->orb_core_ = this;
00317 
00318   return 0;
00319 }
00320 
00321 ACE_INLINE TAO_Cleanup_Func_Registry *
00322 TAO_ORB_Core::tss_cleanup_funcs (void)
00323 {
00324   return &(this->tss_cleanup_funcs_);
00325 }
00326 
00327 ACE_INLINE bool
00328 TAO_ORB_Core::has_shutdown (void) const
00329 {
00330   return this->has_shutdown_;
00331 }
00332 
00333 ACE_INLINE int
00334 TAO_ORB_Core::thread_per_connection_timeout (ACE_Time_Value &timeout) const
00335 {
00336   timeout = this->thread_per_connection_timeout_;
00337   return this->thread_per_connection_use_timeout_;
00338 }
00339 
00340 ACE_INLINE const char *
00341 TAO_ORB_Core::orbid (void) const
00342 {
00343   return this->orbid_;
00344 }
00345 
00346 ACE_INLINE void
00347 TAO_ORB_Core::implrepo_service (const CORBA::Object_ptr ir)
00348 {
00349   this->implrepo_service_ = ir;
00350 }
00351 
00352 ACE_INLINE CORBA::Boolean
00353 TAO_ORB_Core::use_implrepo (void)
00354 {
00355   return use_implrepo_;
00356 }
00357 
00358 ACE_INLINE CORBA::Boolean
00359 TAO_ORB_Core::imr_endpoints_in_ior (void)
00360 {
00361   return imr_endpoints_in_ior_;
00362 }
00363 
00364 ACE_INLINE CORBA::Object_ptr
00365 TAO_ORB_Core::resolve_typecodefactory (void)
00366 {
00367   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00368                     CORBA::Object::_nil ());
00369   if (CORBA::is_nil (this->typecode_factory_))
00370     {
00371       this->resolve_typecodefactory_i ();
00372     }
00373   return CORBA::Object::_duplicate (this->typecode_factory_);
00374 }
00375 
00376 #if TAO_HAS_INTERCEPTORS == 1
00377 
00378 ACE_INLINE CORBA::Object_ptr
00379 TAO_ORB_Core::resolve_picurrent (void)
00380 {
00381   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00382                     CORBA::Object::_nil ());
00383   if (CORBA::is_nil (this->pi_current_))
00384     {
00385       this->resolve_picurrent_i ();
00386     }
00387   return CORBA::Object::_duplicate (this->pi_current_);
00388 }
00389 
00390 #endif  /* TAO_HAS_INTERCEPTORS == 1 */
00391 
00392 ACE_INLINE CORBA::Object_ptr
00393 TAO_ORB_Core::resolve_codecfactory (void)
00394 {
00395   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00396                     CORBA::Object::_nil ());
00397   if (CORBA::is_nil (this->codec_factory_))
00398     {
00399       this->resolve_codecfactory_i ();
00400     }
00401   return CORBA::Object::_duplicate (this->codec_factory_);
00402 }
00403 
00404 ACE_INLINE CORBA::Object_ptr
00405 TAO_ORB_Core::resolve_compression_manager (void)
00406 {
00407   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00408                     CORBA::Object::_nil ());
00409   if (CORBA::is_nil (this->compression_manager_))
00410     {
00411       this->resolve_compression_manager_i ();
00412     }
00413   return CORBA::Object::_duplicate (this->compression_manager_);
00414 }
00415 
00416 ACE_INLINE const char *
00417 TAO_ORB_Core::server_id (void) const
00418 {
00419   return this->server_id_.c_str();
00420 }
00421 
00422 ACE_INLINE TAO_Codeset_Manager *
00423 TAO_ORB_Core::codeset_manager()
00424 {
00425   if (this->orb_params()->negotiate_codesets() == 0)
00426     return 0;
00427   if (this->codeset_manager_ == 0)
00428     {
00429       // This causes a factory to be loaded which will call
00430       // the codeset_manager setter in this thread.
00431       this->codeset_manager_ =
00432         this->resource_factory()->codeset_manager();
00433       if (this->codeset_manager_ == 0)
00434         this->orb_params()->negotiate_codesets(false);
00435     }
00436   return this->codeset_manager_;
00437 }
00438 
00439 ACE_INLINE TAO::ORBInitializer_Registry_Adapter *
00440 TAO_ORB_Core::orbinitializer_registry ()
00441 {
00442   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00443                     0);
00444   if (orbinitializer_registry_ == 0)
00445     {
00446       return this->orbinitializer_registry_i ();
00447     }
00448   return this->orbinitializer_registry_;
00449 }
00450 
00451 ACE_INLINE TAO_Service_Context_Registry &
00452 TAO_ORB_Core::service_context_registry (void)
00453 {
00454   return this->service_context_registry_;
00455 }
00456 
00457 ACE_INLINE TAO::PolicyFactory_Registry_Adapter *
00458 TAO_ORB_Core::policy_factory_registry ()
00459 {
00460   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00461                     0);
00462   if (policy_factory_registry_ == 0)
00463     {
00464       return this->policy_factory_registry_i ();
00465     }
00466   return this->policy_factory_registry_;
00467 }
00468 
00469 ACE_INLINE CORBA::Object_ptr
00470 TAO_ORB_Core::resolve_dynanyfactory (void)
00471 {
00472   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00473                     CORBA::Object::_nil ());
00474   if (CORBA::is_nil (this->dynany_factory_))
00475     {
00476       this->resolve_dynanyfactory_i ();
00477     }
00478   return CORBA::Object::_duplicate (this->dynany_factory_);
00479 }
00480 
00481 ACE_INLINE CORBA::Object_ptr
00482 TAO_ORB_Core::resolve_ior_manipulation (void)
00483 {
00484   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00485                     CORBA::Object::_nil ());
00486   if (CORBA::is_nil (this->ior_manip_factory_))
00487     {
00488       this->resolve_iormanipulation_i ();
00489     }
00490   return CORBA::Object::_duplicate (this->ior_manip_factory_);
00491 }
00492 
00493 ACE_INLINE CORBA::Object_ptr
00494 TAO_ORB_Core::resolve_ior_table (void)
00495 {
00496   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00497                     CORBA::Object::_nil ());
00498   if (CORBA::is_nil (this->ior_table_))
00499     {
00500       this->resolve_ior_table_i ();
00501     }
00502   return CORBA::Object::_duplicate (this->ior_table_);
00503 }
00504 
00505 ACE_INLINE CORBA::Object_ptr
00506 TAO_ORB_Core::resolve_monitor (void)
00507 {
00508   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00509                     CORBA::Object::_nil ());
00510   if (CORBA::is_nil (this->monitor_))
00511     {
00512       this->resolve_monitor_i ();
00513     }
00514   return CORBA::Object::_duplicate (this->monitor_);
00515 }
00516 
00517 // ****************************************************************
00518 
00519 #if (TAO_HAS_CORBA_MESSAGING == 1)
00520 
00521 ACE_INLINE TAO_Policy_Current &
00522 TAO_ORB_Core::policy_current (void)
00523 {
00524   return *this->policy_current_;
00525 }
00526 
00527 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00528 
00529 ACE_INLINE CORBA::Object_ptr
00530 TAO_ORB_Core::resolve_poa_current (void)
00531 {
00532   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00533                     CORBA::Object::_nil ());
00534   if (CORBA::is_nil (this->poa_current_.in ()))
00535     {
00536       this->resolve_poa_current_i ();
00537     }
00538   return CORBA::Object::_duplicate (this->poa_current_.in ());
00539 }
00540 
00541 #if (TAO_HAS_CORBA_MESSAGING == 1)
00542 
00543 ACE_INLINE  TAO_Policy_Set *
00544 TAO_ORB_Core::get_default_policies (void)
00545 {
00546   return this->default_policies_;
00547 }
00548 
00549 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00550 
00551 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00552 ACE_INLINE CORBA::Object_ptr
00553 TAO_ORB_Core::resolve_rt_orb (void)
00554 {
00555   if (CORBA::is_nil (this->rt_orb_.in ()))
00556     {
00557       ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00558                         CORBA::Object::_nil ());
00559       if (CORBA::is_nil (this->rt_orb_.in ()))
00560         {
00561           // Save a reference to the priority mapping manager.
00562           this->rt_orb_ =
00563               this->object_ref_table ().resolve_initial_reference (
00564               TAO_OBJID_RTORB);
00565         }
00566     }
00567 
00568   return CORBA::Object::_duplicate (this->rt_orb_.in ());
00569 }
00570 #endif
00571 
00572 #if (TAO_HAS_INTERCEPTORS == 1)
00573 ACE_INLINE CORBA::Object_ptr
00574 TAO_ORB_Core::pi_current (void)
00575 {
00576   // A pointer/reference to PICurrent is cached in the ORB Core since
00577   // it is accessed in the critical path (i.e. the request invocation
00578   // path).  Caching it prevents additional overhead to due object
00579   // resolution from occurring.
00580   return this->pi_current_;
00581 }
00582 
00583 ACE_INLINE void
00584 TAO_ORB_Core::pi_current (CORBA::Object_ptr current)
00585 {
00586   // Not duplicated since the ORB Core's "object_ref_table" already
00587   // contains a duplicate of the PICurrent object.
00588   this->pi_current_ = current;
00589 }
00590 
00591 ACE_INLINE TAO::ClientRequestInterceptor_Adapter *
00592 TAO_ORB_Core::clientrequestinterceptor_adapter (void)
00593 {
00594   return this->client_request_interceptor_adapter_;
00595 }
00596 
00597 ACE_INLINE TAO::ServerRequestInterceptor_Adapter *
00598 TAO_ORB_Core::serverrequestinterceptor_adapter (void)
00599 {
00600   return this->server_request_interceptor_adapter_;
00601 }
00602 
00603 #endif /* TAO_HAS_INTERCEPTORS */
00604 
00605 /// Verify condition for  permanent forward is given,
00606 /// both parameters must provide group attributes.
00607 ACE_INLINE  CORBA::Boolean
00608 TAO_ORB_Core::is_permanent_forward_condition
00609 (const CORBA::Object_ptr obj,
00610  const TAO_Service_Context &service_context)
00611 {
00612   const TAO_Service_Callbacks *service_callback =
00613       this->fault_tolerance_service ().service_callback ();
00614 
00615   // Since forward location is allowed to be nil then check for it.
00616   CORBA::Boolean const permanent_forward_condition =
00617       service_callback && obj &&
00618       service_callback->is_permanent_forward_condition (obj,
00619                                                         service_context);
00620 
00621   return permanent_forward_condition;
00622 }
00623 
00624 ACE_INLINE
00625 void
00626 TAO_ORB_Core::set_sync_scope_hook (Sync_Scope_Hook hook)
00627 {
00628   this->sync_scope_hook_ = hook;
00629 }
00630 
00631 ACE_INLINE
00632 void
00633 TAO_ORB_Core::set_timeout_hook (Timeout_Hook hook)
00634 {
00635   // Saving the hook pointer so that we can use it later when needed.
00636   this->timeout_hook_ = hook;
00637 }
00638 
00639 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
00640 
00641 ACE_INLINE
00642 void
00643 TAO_ORB_Core::set_eager_transport_queueing_strategy (
00644   TAO::Transport_Queueing_Strategy* strategy)
00645 {
00646   this->eager_transport_queueing_strategy_ = strategy;
00647 }
00648 
00649 ACE_INLINE
00650 void
00651 TAO_ORB_Core::set_delayed_transport_queueing_strategy (
00652   TAO::Transport_Queueing_Strategy* strategy)
00653 {
00654   this->delayed_transport_queueing_strategy_ = strategy;
00655 }
00656 
00657 #endif
00658 
00659 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7