ORB_Core.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // $Id: ORB_Core.inl 79288 2007-08-09 08:22:49Z 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_;
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 ACE_Thread_Manager *
00148 TAO_ORB_Core::thr_mgr (void)
00149 {
00150   return &this->tm_;
00151 }
00152 
00153 ACE_INLINE CORBA::ORB_ptr
00154 TAO_ORB_Core::orb (void)
00155 {
00156   return this->orb_;
00157 }
00158 
00159 ACE_INLINE TAO_Adapter_Registry *
00160 TAO_ORB_Core::adapter_registry (void)
00161 {
00162   return &this->adapter_registry_;
00163 }
00164 
00165 ACE_INLINE TAO_Request_Dispatcher *
00166 TAO_ORB_Core::request_dispatcher (void)
00167 {
00168   return this->request_dispatcher_;
00169 }
00170 
00171 ACE_INLINE TAO_ORB_Core::InitRefMap *
00172 TAO_ORB_Core::init_ref_map (void)
00173 {
00174   return &this->init_ref_map_;
00175 }
00176 
00177 ACE_INLINE void
00178 TAO_ORB_Core::set_default (const char * orb_id)
00179 {
00180   TAO::ORB_Table * const table = TAO::ORB_Table::instance ();
00181   table->set_default (orb_id);
00182 }
00183 
00184 ACE_INLINE void
00185 TAO_ORB_Core::not_default (const char * orb_id)
00186 {
00187   TAO::ORB_Table * const table = TAO::ORB_Table::instance ();
00188   table->not_default (orb_id);
00189 }
00190 
00191 ACE_INLINE void
00192 TAO_ORB_Core::optimize_collocation_objects (CORBA::Boolean opt)
00193 {
00194   this->opt_for_collocation_ = opt;
00195 }
00196 
00197 ACE_INLINE CORBA::Boolean
00198 TAO_ORB_Core::optimize_collocation_objects (void) const
00199 {
00200   return this->opt_for_collocation_;
00201 }
00202 
00203 ACE_INLINE void
00204 TAO_ORB_Core::use_global_collocation (CORBA::Boolean opt)
00205 {
00206   this->use_global_collocation_ = opt;
00207 }
00208 
00209 ACE_INLINE CORBA::Boolean
00210 TAO_ORB_Core::use_global_collocation (void) const
00211 {
00212   return this->use_global_collocation_;
00213 }
00214 
00215 ACE_INLINE CORBA::ULong
00216 TAO_ORB_Core::get_collocation_strategy (void) const
00217 {
00218   return this->collocation_strategy_;
00219 }
00220 
00221 ACE_INLINE TAO_ORB_Parameters *
00222 TAO_ORB_Core::orb_params(void)
00223 {
00224   return &(this->orb_params_);
00225 }
00226 
00227 #define TAO_OC_RETRIEVE(member) \
00228 ((this->member##_ == 0) \
00229   ? (this->member##_ = this->resource_factory ()->get_##member ()) \
00230   : (this->member##_))
00231 
00232 ACE_INLINE TAO_ProtocolFactorySet *
00233 TAO_ORB_Core::protocol_factories (void)
00234 {
00235   return TAO_OC_RETRIEVE (protocol_factories);
00236 }
00237 
00238 ACE_INLINE TAO_Parser_Registry *
00239 TAO_ORB_Core::parser_registry (void)
00240 {
00241   return &this->parser_registry_;
00242 }
00243 
00244 #undef TAO_OC_RETRIEVE
00245 
00246 #if (TAO_HAS_CORBA_MESSAGING == 1)
00247 
00248 ACE_INLINE TAO_Policy_Manager *
00249 TAO_ORB_Core::policy_manager (void)
00250 {
00251   return this->policy_manager_;
00252 }
00253 
00254 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00255 
00256 ACE_INLINE TAO_ORB_Core_TSS_Resources*
00257 TAO_ORB_Core::get_tss_resources (void)
00258 {
00259   return ACE_TSS_GET (&this->tss_resources_,TAO_ORB_Core_TSS_Resources);
00260 }
00261 
00262 ACE_INLINE void *
00263 TAO_ORB_Core::get_tss_resource (size_t slot_id)
00264 {
00265   TAO_ORB_Core_TSS_Resources *tss_resources =
00266     this->get_tss_resources ();
00267 
00268   if (slot_id >= tss_resources->ts_objects_.size ())
00269     return 0;
00270 
00271   return tss_resources->ts_objects_[slot_id];
00272 }
00273 
00274 ACE_INLINE int
00275 TAO_ORB_Core::set_tss_resource (size_t slot_id, void *ts_object)
00276 {
00277   TAO_ORB_Core_TSS_Resources *tss_resources =
00278     this->get_tss_resources ();
00279 
00280   // The number of allocated slots is equal to the number of
00281   // registered TSS cleanup functions, *not* the size of the array in
00282   // the ORB core TSS resources.
00283   if (slot_id >= this->tss_cleanup_funcs_.size ())
00284     {
00285       errno = EINVAL;
00286       return -1;
00287     }
00288 
00289   // If the TSS array isn't large enough, then increase its size.
00290   // We're guaranteed not to exceed the number of allocated slots by
00291   // the above check.
00292   const size_t old_size = tss_resources->ts_objects_.size ();
00293   const size_t new_size = slot_id + 1;
00294   if (slot_id >= old_size
00295       && tss_resources->ts_objects_.size (new_size) != 0)
00296     return -1;
00297 
00298   // Initialize intermediate array elements to zero, since they
00299   // haven't been initialized yet.  This ensures that garbage is not
00300   // returned when accessing any of those elements at a later point in
00301   // time.
00302   for (size_t i = old_size; i < slot_id; ++i)
00303     tss_resources->ts_objects_[i] = 0;
00304 
00305   tss_resources->ts_objects_[slot_id] = ts_object;
00306 
00307   // Make sure the ORB core pointer is set in the ORB core's TSS
00308   // resources so that the TSS cleanup functions stored in the ORB
00309   // core can be invoked.
00310   tss_resources->orb_core_ = this;
00311 
00312   return 0;
00313 }
00314 
00315 ACE_INLINE TAO_Cleanup_Func_Registry *
00316 TAO_ORB_Core::tss_cleanup_funcs (void)
00317 {
00318   return &(this->tss_cleanup_funcs_);
00319 }
00320 
00321 ACE_INLINE bool
00322 TAO_ORB_Core::has_shutdown (void) const
00323 {
00324   return this->has_shutdown_;
00325 }
00326 
00327 ACE_INLINE int
00328 TAO_ORB_Core::thread_per_connection_timeout (ACE_Time_Value &timeout) const
00329 {
00330   timeout = this->thread_per_connection_timeout_;
00331   return this->thread_per_connection_use_timeout_;
00332 }
00333 
00334 ACE_INLINE const char *
00335 TAO_ORB_Core::orbid (void) const
00336 {
00337   return this->orbid_;
00338 }
00339 
00340 ACE_INLINE void
00341 TAO_ORB_Core::implrepo_service (const CORBA::Object_ptr ir)
00342 {
00343   this->implrepo_service_ = ir;
00344 }
00345 
00346 ACE_INLINE CORBA::Boolean
00347 TAO_ORB_Core::use_implrepo (void)
00348 {
00349   return use_implrepo_;
00350 }
00351 
00352 ACE_INLINE CORBA::Boolean
00353 TAO_ORB_Core::imr_endpoints_in_ior (void)
00354 {
00355   return imr_endpoints_in_ior_;
00356 }
00357 
00358 ACE_INLINE CORBA::Object_ptr
00359 TAO_ORB_Core::resolve_typecodefactory (void)
00360 {
00361   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00362                     CORBA::Object::_nil ());
00363   if (CORBA::is_nil (this->typecode_factory_))
00364     {
00365       this->resolve_typecodefactory_i ();
00366     }
00367   return CORBA::Object::_duplicate (this->typecode_factory_);
00368 }
00369 
00370 #if TAO_HAS_INTERCEPTORS == 1
00371 
00372 ACE_INLINE CORBA::Object_ptr
00373 TAO_ORB_Core::resolve_picurrent (void)
00374 {
00375   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00376                     CORBA::Object::_nil ());
00377   if (CORBA::is_nil (this->pi_current_))
00378     {
00379       this->resolve_picurrent_i ();
00380     }
00381   return CORBA::Object::_duplicate (this->pi_current_);
00382 }
00383 
00384 #endif  /* TAO_HAS_INTERCEPTORS == 1 */
00385 
00386 ACE_INLINE CORBA::Object_ptr
00387 TAO_ORB_Core::resolve_codecfactory (void)
00388 {
00389   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00390                     CORBA::Object::_nil ());
00391   if (CORBA::is_nil (this->codec_factory_))
00392     {
00393       this->resolve_codecfactory_i ();
00394     }
00395   return CORBA::Object::_duplicate (this->codec_factory_);
00396 }
00397 
00398 ACE_INLINE CORBA::Object_ptr
00399 TAO_ORB_Core::resolve_compression_manager (void)
00400 {
00401   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00402                     CORBA::Object::_nil ());
00403   if (CORBA::is_nil (this->compression_manager_))
00404     {
00405       this->resolve_compression_manager_i ();
00406     }
00407   return CORBA::Object::_duplicate (this->compression_manager_);
00408 }
00409 
00410 ACE_INLINE const char *
00411 TAO_ORB_Core::server_id (void) const
00412 {
00413   return this->server_id_.c_str();
00414 }
00415 
00416 ACE_INLINE TAO_Codeset_Manager *
00417 TAO_ORB_Core::codeset_manager()
00418 {
00419   if (this->orb_params()->negotiate_codesets() == 0)
00420     return 0;
00421   if (this->codeset_manager_ == 0)
00422     {
00423       // This causes a factory to be loaded which will call
00424       // the codeset_manager setter in this thread.
00425       this->codeset_manager_ =
00426         this->resource_factory()->codeset_manager();
00427       if (this->codeset_manager_ == 0)
00428         this->orb_params()->negotiate_codesets(false);
00429     }
00430   return this->codeset_manager_;
00431 }
00432 
00433 ACE_INLINE TAO::ORBInitializer_Registry_Adapter *
00434 TAO_ORB_Core::orbinitializer_registry ()
00435 {
00436   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00437                     0);
00438   if (orbinitializer_registry_ == 0)
00439     {
00440       return this->orbinitializer_registry_i ();
00441     }
00442   return this->orbinitializer_registry_;
00443 }
00444 
00445 ACE_INLINE TAO::PolicyFactory_Registry_Adapter *
00446 TAO_ORB_Core::policy_factory_registry ()
00447 {
00448   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00449                     0);
00450   if (policy_factory_registry_ == 0)
00451     {
00452       return this->policy_factory_registry_i ();
00453     }
00454   return this->policy_factory_registry_;
00455 }
00456 
00457 ACE_INLINE CORBA::Object_ptr
00458 TAO_ORB_Core::resolve_dynanyfactory (void)
00459 {
00460   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00461                     CORBA::Object::_nil ());
00462   if (CORBA::is_nil (this->dynany_factory_))
00463     {
00464       this->resolve_dynanyfactory_i ();
00465     }
00466   return CORBA::Object::_duplicate (this->dynany_factory_);
00467 }
00468 
00469 ACE_INLINE CORBA::Object_ptr
00470 TAO_ORB_Core::resolve_ior_manipulation (void)
00471 {
00472   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00473                     CORBA::Object::_nil ());
00474   if (CORBA::is_nil (this->ior_manip_factory_))
00475     {
00476       this->resolve_iormanipulation_i ();
00477     }
00478   return CORBA::Object::_duplicate (this->ior_manip_factory_);
00479 }
00480 
00481 ACE_INLINE CORBA::Object_ptr
00482 TAO_ORB_Core::resolve_ior_table (void)
00483 {
00484   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00485                     CORBA::Object::_nil ());
00486   if (CORBA::is_nil (this->ior_table_))
00487     {
00488       this->resolve_ior_table_i ();
00489     }
00490   return CORBA::Object::_duplicate (this->ior_table_);
00491 }
00492 
00493 // ****************************************************************
00494 
00495 #if (TAO_HAS_CORBA_MESSAGING == 1)
00496 
00497 ACE_INLINE TAO_Policy_Current &
00498 TAO_ORB_Core::policy_current (void)
00499 {
00500   return *this->policy_current_;
00501 }
00502 
00503 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00504 
00505 ACE_INLINE CORBA::Object_ptr
00506 TAO_ORB_Core::resolve_poa_current (void)
00507 {
00508   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00509                     CORBA::Object::_nil ());
00510   if (CORBA::is_nil (this->poa_current_.in ()))
00511     {
00512       this->resolve_poa_current_i ();
00513     }
00514   return CORBA::Object::_duplicate (this->poa_current_.in ());
00515 }
00516 
00517 #if (TAO_HAS_CORBA_MESSAGING == 1)
00518 
00519 ACE_INLINE  TAO_Policy_Set *
00520 TAO_ORB_Core::get_default_policies (void)
00521 {
00522   return this->default_policies_;
00523 }
00524 
00525 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00526 
00527 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00528 ACE_INLINE CORBA::Object_ptr
00529 TAO_ORB_Core::resolve_rt_orb (void)
00530 {
00531   if (CORBA::is_nil (this->rt_orb_.in ()))
00532     {
00533       ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
00534                         CORBA::Object::_nil ());
00535       if (CORBA::is_nil (this->rt_orb_.in ()))
00536         {
00537           // Save a reference to the priority mapping manager.
00538           this->rt_orb_ =
00539               this->object_ref_table ().resolve_initial_reference (
00540               TAO_OBJID_RTORB);
00541         }
00542     }
00543 
00544   return CORBA::Object::_duplicate (this->rt_orb_.in ());
00545 }
00546 #endif
00547 
00548 #if (TAO_HAS_INTERCEPTORS == 1)
00549 ACE_INLINE CORBA::Object_ptr
00550 TAO_ORB_Core::pi_current (void)
00551 {
00552   // A pointer/reference to PICurrent is cached in the ORB Core since
00553   // it is accessed in the critical path (i.e. the request invocation
00554   // path).  Caching it prevents additional overhead to due object
00555   // resolution from occurring.
00556   return this->pi_current_;
00557 }
00558 
00559 ACE_INLINE void
00560 TAO_ORB_Core::pi_current (CORBA::Object_ptr current)
00561 {
00562   // Not duplicated since the ORB Core's "object_ref_table" already
00563   // contains a duplicate of the PICurrent object.
00564   this->pi_current_ = current;
00565 }
00566 
00567 ACE_INLINE TAO::ClientRequestInterceptor_Adapter *
00568 TAO_ORB_Core::clientrequestinterceptor_adapter (void)
00569 {
00570   return this->client_request_interceptor_adapter_;
00571 }
00572 
00573 ACE_INLINE TAO::ServerRequestInterceptor_Adapter *
00574 TAO_ORB_Core::serverrequestinterceptor_adapter (void)
00575 {
00576   return this->server_request_interceptor_adapter_;
00577 }
00578 
00579 #endif /* TAO_HAS_INTERCEPTORS */
00580 
00581 /// Verify condition for  permanent forward is given,
00582 /// both parameters must provide group attributes.
00583 ACE_INLINE  CORBA::Boolean
00584 TAO_ORB_Core::is_permanent_forward_condition
00585 (const CORBA::Object_ptr obj,
00586  const TAO_Service_Context &service_context)
00587 {
00588   const TAO_Service_Callbacks *service_callback =
00589       this->fault_tolerance_service ().service_callback ();
00590 
00591   CORBA::Boolean const permanent_forward_condition =
00592       service_callback &&
00593       service_callback->is_permanent_forward_condition (obj,
00594                                                         service_context);
00595 
00596   return permanent_forward_condition;
00597 }
00598 
00599 ACE_INLINE
00600 void
00601 TAO_ORB_Core::set_sync_scope_hook (Sync_Scope_Hook hook)
00602 {
00603   this->sync_scope_hook_ = hook;
00604 }
00605 
00606 ACE_INLINE
00607 void
00608 TAO_ORB_Core::set_timeout_hook (Timeout_Hook hook)
00609 {
00610   // Saving the hook pointer so that we can use it later when needed.
00611   this->timeout_hook_ = hook;
00612 }
00613 
00614 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
00615 
00616 ACE_INLINE
00617 void
00618 TAO_ORB_Core::set_eager_transport_queueing_strategy (
00619   TAO::Transport_Queueing_Strategy* strategy)
00620 {
00621   this->eager_transport_queueing_strategy_ = strategy;
00622 }
00623 
00624 ACE_INLINE
00625 void
00626 TAO_ORB_Core::set_delayed_transport_queueing_strategy (
00627   TAO::Transport_Queueing_Strategy* strategy)
00628 {
00629   this->delayed_transport_queueing_strategy_ = strategy;
00630 }
00631 
00632 #endif
00633 
00634 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Sun Jan 27 13:07:35 2008 for TAO by doxygen 1.3.6