Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ORB_Core.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // ===================================================================
00004 /**
00005  *  @file   ORB_Core.h
00006  *
00007  *  $Id: ORB_Core.h,v 1.1.1.4.2.2 2003/04/10 14:04:04 phil Exp $
00008  *
00009  *  @author DOC Center - Washington University at St. Louis
00010  *  @author DOC Laboratory - University of California at Irvine
00011  */
00012 // ===================================================================
00013 
00014 #ifndef TAO_ORB_CORE_H
00015 #define TAO_ORB_CORE_H
00016 #include "ace/pre.h"
00017 
00018 #include "corbafwd.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ORB.h"
00025 #include "Environment.h"
00026 #include "Policy_Manager.h"
00027 #include "Resource_Factory.h"
00028 #include "params.h"
00029 #include "TAO_Singleton_Manager.h"
00030 #include "TAO_Singleton.h"
00031 #include "Adapter.h"
00032 #include "PolicyFactory_Registry.h"
00033 #include "Parser_Registry.h"
00034 #include "Service_Callbacks.h"
00035 #include "Fault_Tolerance_Service.h"
00036 #include "Cleanup_Func_Registry.h"
00037 #include "Object_Ref_Table.h"
00038 
00039 // Interceptor definitions.
00040 #include "PortableInterceptorC.h"
00041 #include "Interceptor_List.h"
00042 #include "PICurrent.h"
00043 
00044 #include "ace/Hash_Map_Manager_T.h"
00045 #include "ace/Thread_Manager.h"
00046 
00047 // Forward declarations
00048 class TAO_Acceptor;
00049 class TAO_Connector;
00050 class TAO_Connector_Registry;
00051 
00052 class TAO_Resource_Factory;
00053 class TAO_Client_Strategy_Factory;
00054 class TAO_Server_Strategy_Factory;
00055 class TAO_Transport_Cache_Manager;
00056 
00057 class TAO_TSS_Resources;
00058 class TAO_Leader_Follower;
00059 class TAO_LF_Strategy;
00060 class TAO_RT_ORB;
00061 class TAO_RT_Current;
00062 class TAO_MProfile;
00063 class TAO_Profile;
00064 class TAO_GIOP_Invocation;
00065 
00066 class TAO_Endpoint_Selector_Factory;
00067 class TAO_Message_State_Factory;
00068 class TAO_ServerRequest;
00069 class TAO_Protocols_Hooks;
00070 class TAO_BiDir_Adapter;
00071 
00072 class TAO_Flushing_Strategy;
00073 
00074 class TAO_Thread_Lane_Resources_Manager;
00075 class TAO_Collocation_Resolver;
00076 class TAO_Thread_Lane_Resources;
00077 class TAO_Stub_Factory;
00078 class TAO_Endpoint_Selector_Factory;
00079 class TAO_Service_Context;
00080 class TAO_POA_PortableGroup_Hooks;
00081 class TAO_Request_Dispatcher;
00082 
00083 class TAO_Codeset_Manager;
00084 
00085 
00086 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
00087 
00088 class TAO_Buffering_Constraint_Policy;
00089 class TAO_Eager_Buffering_Sync_Strategy;
00090 class TAO_Delayed_Buffering_Sync_Strategy;
00091 
00092 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
00093 
00094 #if TAO_HAS_INTERCEPTORS == 1
00095 class TAO_ClientRequestInfo;
00096 #endif  /* TAO_HAS_INTERCEPTORS == 1  */
00097 
00098 
00099 class TAO_Transport_Sync_Strategy;
00100 class TAO_Sync_Strategy;
00101 class TAO_Policy_Validator;
00102 
00103 // ****************************************************************
00104 
00105 /**
00106  * @class TAO_ORB_Core_TSS_Resources
00107  *
00108  * @brief The TSS resoures of an ORB core.
00109  *
00110  * This class is used by the ORB_Core to store the resources
00111  * potentially bound to a thread in TSS storage. The members are public
00112  * because only the ORB Core is expected to access them.
00113  */
00114 class TAO_Export TAO_ORB_Core_TSS_Resources
00115 {
00116 public:
00117 
00118   /// Constructor
00119   TAO_ORB_Core_TSS_Resources (void);
00120 
00121   /// destructor
00122   ~TAO_ORB_Core_TSS_Resources (void);
00123 
00124 private:
00125 
00126   /// The ORB Core TSS resources should not be copied
00127   ACE_UNIMPLEMENTED_FUNC (TAO_ORB_Core_TSS_Resources (const TAO_ORB_Core_TSS_Resources&))
00128   ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_ORB_Core_TSS_Resources&))
00129 
00130 public:
00131 
00132 
00133   /// The allocators for the output CDR streams.
00134   //@{
00135   ACE_Allocator *output_cdr_dblock_allocator_;
00136   ACE_Allocator *output_cdr_buffer_allocator_;
00137   ACE_Allocator *output_cdr_msgblock_allocator_;
00138   //@}
00139 
00140   /**
00141    * @todo
00142    * The rest of the resources are not currently in use, just a plan
00143    * for the future...
00144    */
00145   /// Counter for how (nested) calls this thread has made to run the
00146   /// event loop.
00147   int event_loop_thread_;
00148 
00149   /// Counter for how many times this thread has become a client
00150   /// leader.
00151   int client_leader_thread_;
00152 
00153   /// Lane for this thread.
00154   void *lane_;
00155 
00156   /// Generic container for thread-specific objects.
00157   ACE_Array_Base<void *> ts_objects_;
00158 
00159   /// Pointer to the ORB core.  Needed to get access to the TSS
00160   /// cleanup functions for the TSS objects stored in the TSS object
00161   /// array in this class.
00162   TAO_ORB_Core *orb_core_;
00163 
00164 #if TAO_HAS_INTERCEPTORS == 1
00165   /// The thread-specific portion of the PICurrent object.
00166   TAO_PICurrent_Impl pi_current_;
00167 
00168   /// The PortableInterceptor::ClientRequestInfo object for the
00169   /// current thread.
00170   TAO_ClientRequestInfo *client_request_info_;
00171 #endif  /* TAO_HAS_INTERCEPTORS == 1 */
00172 
00173 };
00174 
00175 // ****************************************************************
00176 
00177 /**
00178  * @class TAO_ORB_Core
00179  *
00180  * @brief Encapsulates the state of an ORB.
00181  *
00182  * This is the implementation class for the CORBA::ORB interface.  The
00183  * class also encapsulates the access to the ORB resources and its
00184  * state.
00185  * @par
00186  * Some resources can be TSS or global, those resources are always
00187  * accessed through a TSS interface, but are allocated using the
00188  * Resource_Factory.  If the resource is really global the
00189  * Resource_Factory will simply return a pointer to the global
00190  * instance.
00191  */
00192 class TAO_Export TAO_ORB_Core
00193 {
00194   friend class TAO_ORB_Core_Auto_Ptr;
00195   friend class TAO_ORB_Table;
00196   friend CORBA::ORB_ptr CORBA::ORB_init (int &,
00197                                          char *argv[],
00198                                          const char *,
00199                                          CORBA_Environment &);
00200 public:
00201 
00202   /// Constructor.
00203   TAO_ORB_Core (const char* id);
00204 
00205   /// Accessor for the ORB parameters.
00206   TAO_ORB_Parameters *orb_params (void);
00207 
00208   /**
00209    * @todo
00210    * In the future this hook should change, instead of hardcoding the
00211    * object we should add a "Resolver" to the ORB, so the "POACurrent"
00212    * object returns a per-ORB object.
00213    * @par
00214    * Similarly, each ORB should implement the TSS pattern to put   the
00215    * POA_Current_Impl in a void* slot.  The current approach *does*
00216    * decouple the POA from the ORB, but it cannot add new adapters or
00217    * other components transparently.
00218    */
00219   /// Accessor to the POA current.
00220   //@{
00221   CORBA::Object_ptr poa_current(void);
00222   void poa_current (CORBA::Object_ptr poa_current);
00223   //@}
00224 
00225   ///Get the connector registry
00226   TAO_Connector_Registry *connector_registry (ACE_ENV_SINGLE_ARG_DECL);
00227 
00228   ///Get the IOR parser registry
00229   TAO_Parser_Registry *parser_registry (void);
00230 
00231   /// Return pointer to the policy factory registry associated with
00232   /// this ORB core.
00233   TAO_PolicyFactory_Registry *policy_factory_registry (void);
00234 
00235   /// Get the protocol factories
00236   TAO_ProtocolFactorySet *protocol_factories (void);
00237 
00238   /// Get pointer to the ORB.
00239   CORBA::ORB_ptr orb (void);
00240 
00241   /// Wrappers that forward the request to the concurrency strategy.
00242   ACE_Reactor *reactor (void);
00243 
00244   /// Get the ACE_Thread_Manager
00245   ACE_Thread_Manager *thr_mgr (void);
00246 
00247   /// Return the RootPOA, or try to load it if not initialized already.
00248   CORBA::Object_ptr root_poa (ACE_ENV_SINGLE_ARG_DECL);
00249 
00250   /// Get the adapter registry
00251   TAO_Adapter_Registry *adapter_registry (void);
00252 
00253   /// @name Collocation Strategies
00254   //@{
00255   enum
00256   {
00257     /// Indicate object should refer to ORB for either one of the
00258     /// following strategies.
00259     ORB_CONTROL,
00260 
00261     /// Collocated calls will go thru POA.
00262     THRU_POA,
00263 
00264     /// Collocated calls invoke operation on Servant directly.
00265     DIRECT
00266   };
00267 
00268   /**
00269    * This method returns the right collocation strategy, if any,
00270    * to be used to perform a method invocation on the given object.
00271    *
00272    * @note
00273    * No-Collocation is a special case of collocation.
00274    */
00275   static int collocation_strategy (CORBA::Object_ptr object
00276                                    ACE_ENV_ARG_DECL);
00277   //@}
00278 
00279   /**
00280    * @name Default Code Set Translators
00281    *
00282    * Get the default codeset translators.
00283    *
00284    * @par
00285    * In most configurations these are just <nil> objects, but they can
00286    * be set to something different if the native character sets are
00287    * not ISO8869 (aka Latin/1, UTF-8) and UNICODE (aka UTF-16).
00288    *
00289    * @note
00290    * This is just note on how the translator database coule be
00291    * implemented: use the Service Configurator to load the translator,
00292    * and then use the CodesetId (an unsigned long) to translate the
00293    * character set code into the Service Object name.
00294    * @par
00295    * The default resource factory could parse command line options
00296    * like:
00297    *   - -ORBcharcodeset 0x00010001=ISO8859
00298    *   - -ORBcharcodeset 0x10020417=IBM1047
00299    *   - -ORBwcharcodeset 0x00010106=ISOIEC10646
00300    * that would let the user experiment with different translators
00301    * and plug them in on demand.
00302    *@par
00303    *
00304    * We should also think about how translators will report conversion
00305    * failures and how to simplify the implementation of char
00306    * translators (it would seem like just a couple of arrays are
00307    * needed, maybe the arrays should be dynamically loaded and the
00308    * implementation would remain constant?  Just a thought.
00309    *
00310    */
00311   //@{
00312   /// Convert from ISO8859 to the native character set
00313   ACE_Char_Codeset_Translator *from_iso8859 (void) const;
00314 
00315   /// Convert from the native character set to ISO8859
00316   ACE_Char_Codeset_Translator *to_iso8859 (void) const;
00317 
00318   /// Convert from UNICODE to the native wide character set
00319   ACE_WChar_Codeset_Translator *from_unicode (void) const;
00320 
00321   /// Convert from the native wide character set to UNICODE
00322   ACE_WChar_Codeset_Translator *to_unicode (void) const;
00323   //@}
00324 
00325   /// Set/get the collocation flags
00326   //@{
00327   void optimize_collocation_objects (CORBA::Boolean opt);
00328   CORBA::Boolean optimize_collocation_objects (void) const;
00329 
00330   void use_global_collocation (CORBA::Boolean opt);
00331   CORBA::Boolean use_global_collocation (void) const;
00332 
00333   CORBA::ULong get_collocation_strategy (void) const;
00334   //@}
00335 
00336   /// Get the adapter named "RootPOA" and cache the result, this is an
00337   /// optimization for the POA.
00338   TAO_Adapter *poa_adapter (void);
00339 
00340   /// A spawned thread needs to inherit some properties/objects from
00341   /// the spawning thread in order to serve requests.  Return 0 if
00342   /// it successfully inherits from the parent, -1 otherwise.
00343   int inherit_from_parent_thread (TAO_ORB_Core_TSS_Resources *tss_resources);
00344 
00345   /**
00346    * @name Access to Factories
00347    *
00348    * These factories are not thread-specific, and are presented here
00349    * in order to have one place to get useful information.  Often, the
00350    * instances to which the return pointers are stored in the Service
00351    * Repository.
00352    */
00353   //@{
00354   /// Returns pointer to the resource factory.
00355   TAO_Resource_Factory *resource_factory (void);
00356 
00357   /// Returns pointer to the client factory.
00358   TAO_Client_Strategy_Factory *client_factory (void);
00359 
00360   /// Returns pointer to the server factory.
00361   TAO_Server_Strategy_Factory *server_factory (void);
00362 
00363   /// Returns pointer to the Protocols_Hooks.
00364   TAO_Protocols_Hooks *protocols_hooks (void);
00365 
00366   /// Returns a pointer to the Thread Lane Resources Manager.
00367   TAO_Thread_Lane_Resources_Manager &thread_lane_resources_manager (void);
00368 
00369   /// Returns a pointer to the Collocation Resolver.
00370   TAO_Collocation_Resolver &collocation_resolver (void);
00371 
00372   /// Returns a pointer to the Stub factory.
00373   TAO_Stub_Factory *stub_factory (void);
00374 
00375   /// Returns a pointer to the endpoint selector factory.
00376   TAO_Endpoint_Selector_Factory *endpoint_selector_factory (void);
00377 
00378   //@}
00379 
00380   /// Sets the value of TAO_ORB_Core::thread_lane_resources_manager_factory_name_
00381   static void set_thread_lane_resources_manager_factory (const char *thread_lane_resources_manager_factory_name);
00382 
00383   /// Sets the value of TAO_ORB_Core::collocation_resolver_name_
00384   static void set_collocation_resolver (const char *collocation_resolver_name);
00385 
00386   /// Sets the value of TAO_ORB_Core::stub_factory_name_
00387   static void set_stub_factory (const char *stub_factory_name);
00388 
00389   /// Sets the value of TAO_ORB_Core::resource_factory_
00390   static void set_resource_factory (const char *resource_factory_name);
00391 
00392   /// Sets the value of TAO_ORB_Core::protocols_hooks_
00393   static void set_protocols_hooks (const char *protocols_hooks_name);
00394 
00395   /// Sets the value of TAO_ORB_Core::endpoint_selector_factory_
00396   static void set_endpoint_selector_factory (
00397     const char *endpoint_selector_factory_name);
00398 
00399   /// Sets the name of the POA factory and the dynamic service
00400   /// configurator directive to load it if needed.
00401   static void set_poa_factory (
00402                     const char *poa_factory_name,
00403                     const char *poa_factory_directive);
00404 
00405   /// Access the POA factory name.
00406   static const ACE_CString &poa_factory_name (void);
00407 
00408   /// Gets the value of TAO_ORB_Core::protocols_hooks__
00409   TAO_Protocols_Hooks * get_protocols_hooks (ACE_ENV_SINGLE_ARG_DECL);
00410 
00411   /// Sets the value of TAO_ORB_Core::dynamic_adapter_name_.
00412   static void dynamic_adapter_name (const char *name);
00413 
00414   /// Gets the value of TAO_ORB_Core::dynamic_adapter_name_.
00415   static const char *dynamic_adapter_name (void);
00416 
00417   /// Sets the value of TAO_ORB_Core::ifr_client_adapter_name_.
00418   static void ifr_client_adapter_name (const char *name);
00419 
00420   /// Gets the value of TAO_ORB_Core::ifr_client_adapter_name_.
00421   static const char *ifr_client_adapter_name (void);
00422 
00423   /// Sets the value of TAO_ORB_Core::typecodefactory_adapter_name_.
00424   static void typecodefactory_adapter_name (const char *name);
00425 
00426   /// Gets the value of TAO_ORB_Core::typecodefactory_adapter_name_.
00427   static const char *typecodefactory_adapter_name (void);
00428 
00429   /// See if we have a collocated address, if yes, return the POA
00430   /// associated with the address.
00431   int is_collocated (const TAO_MProfile& mprofile);
00432 
00433   /// This allocator is always TSS and has no locks. It is intended
00434   /// for allocating the ACE_Data_Blocks used in *outgoing* CDR
00435   /// streams.
00436   ACE_Allocator *output_cdr_dblock_allocator (void);
00437 
00438   /// This allocator is always TSS and has no locks. It is intended
00439   /// for allocating the buffers used in *outgoing* CDR streams.
00440   ACE_Allocator *output_cdr_buffer_allocator (void);
00441 
00442   /// This allocator is always TSS and has no locks. It is intended
00443   /// for allocating the ACE_Data_Blocks used in *outgoing* CDR
00444   /// streams.
00445   ACE_Allocator *output_cdr_msgblock_allocator (void);
00446 
00447   /// This allocator is global, may or may not have locks. It is
00448   /// intended for allocating the ACE_Data_Blocks used in *incoming*
00449   /// CDR streams.
00450   ACE_Allocator *input_cdr_dblock_allocator (void);
00451 
00452   /// This allocator is always global and has no locks. It is intended
00453   /// for allocating the buffers used in *incoming* CDR streams.
00454   ACE_Allocator *input_cdr_buffer_allocator (void);
00455 
00456   /// This allocator is always global and has no locks. It is intended
00457   /// for allocating the buffers used in *incoming* CDR streams.
00458   ACE_Allocator *input_cdr_msgblock_allocator (void);
00459 
00460   /// This allocator is always global and has no locks. It is intended
00461   /// for allocating the buffers used to queue messages in
00462   /// transports.
00463   ACE_Allocator *transport_message_buffer_allocator (void);
00464 
00465 #if 0
00466   /// @@todo: All these need to go. They were added in the first place
00467   /// to get around a problem with input_cdr* methods. The input_cdr*
00468   /// methods would access from TSS if an option is set. Since some
00469   /// portions of the ORB didnt require memory from TSS, we had these
00470   /// new set of methods. Now that the semantics are changed for
00471   /// input_cdr* methods, these methods may not be required. We can
00472   /// remove them at a later date!
00473 
00474   /// This allocator is global, may or may not have locks. It is
00475   /// intended for ACE_Data_Blocks used in message blocks or CDR
00476   /// streams that have no relation with the life of threads,
00477   /// something like used in a class on a per connection basis
00478   ACE_Allocator *message_block_dblock_allocator (void);
00479 
00480   /// This allocator is global, may or may not have locks. It is
00481   /// intended for ACE_Data_Blocks used in message blocks or CDR
00482   /// streams that have no relation with the life of threads,
00483   /// something like used in a class on a per connection basis
00484   ACE_Allocator *message_block_buffer_allocator (void);
00485 
00486   /// This allocator is global, may or may not have locks. It is
00487   /// intended for ACE_Data_Blocks used in message blocks or CDR
00488   /// streams that have no relation with the life of threads,
00489   /// something like used in a class on a per connection basis
00490   ACE_Allocator *message_block_msgblock_allocator (void);
00491 
00492   /// The data blocks returned have memeory from the global pool. Will
00493   /// not get anything from the TSS even if it is available.
00494   ACE_Data_Block *data_block_for_message_block (size_t size);
00495 
00496 #endif /*if 0*/
00497 
00498   /// The Message Blocks used for input CDRs must have appropiate
00499   /// locking strategies.
00500   ACE_Data_Block *create_input_cdr_data_block (size_t size);
00501 
00502 
00503   /// Return the locking strategy used for the data blocks.
00504   ACE_Lock *locking_strategy (void);
00505 
00506 #if (TAO_HAS_CORBA_MESSAGING == 1)
00507 
00508   /// Accessor method for the default_policies_
00509   TAO_Policy_Set *get_default_policies (void);
00510 
00511   /// Get a cached policy.  First, check the ORB-level Policy
00512   /// Manager, and then check the ORB defaults.
00513   CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type);
00514 
00515 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00516 
00517   /**
00518    * The thread has a default environment to simplify porting between
00519    * platforms that support native C++ exceptions and those that
00520    * don't. This is a TSS resource (always), but with a twist: if the
00521    * user creates a new environment the old one is "pushed" (actually
00522    * the new one remembers it), eventually the new environment
00523    * destructor pops itself from the stack and we recover the old
00524    * environment.
00525    * @par
00526    * This means that if the user create a new environment and somebody
00527    * calls a function using the default one the exception will still
00528    * be received in the environment created by the user.
00529    * The only drawback is that environments life time must nest
00530    * properly, this shouldn't be a problem because environments are
00531    * usually created on the stack, but, the spec allows their creation
00532    * on the heap and/or as class members; we need to investigate the
00533    * tradeoffs and take a decision.
00534    */
00535   //@{
00536   CORBA_Environment *default_environment (void) const;
00537   void default_environment (CORBA_Environment*);
00538   //@}
00539 
00540 #if (TAO_HAS_CORBA_MESSAGING == 1)
00541 
00542   /// Return the Policy_Manager for this ORB.
00543   TAO_Policy_Manager *policy_manager (void);
00544 
00545   /// Accesors to the policy current, this object should be kept in
00546   /// TSS storage.  The POA has to reset the policy current object on
00547   /// every upcall.
00548   TAO_Policy_Current &policy_current (void);
00549 
00550 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00551 
00552   /// Invoke the timeout hook if present.
00553   /**
00554    * The timeout hook is used to determine if the timeout policy is
00555    * set and with what value.  If the ORB is compiled without support
00556    * for Messaging this feature does not take effect
00557    * \param has_timeout returns 0 if there is no timeout policy set.
00558    * \param time_value returns the timeout value in effect for the object,
00559    * thread and current ORB.
00560    */
00561   void call_timeout_hook (TAO_Stub *stub,
00562                           int &has_timeout,
00563                           ACE_Time_Value &time_value);
00564 
00565   /// Define the Timeout_Hook signature
00566   typedef void (*Timeout_Hook) (TAO_ORB_Core *,
00567                                 TAO_Stub *,
00568                                 int&,
00569                                 ACE_Time_Value&);
00570 
00571   static void set_timeout_hook (Timeout_Hook hook);
00572 
00573 
00574   /// Access to the RoundtripTimeoutPolicy policy set on the thread or
00575   /// on the ORB.  In this method, we do not consider the stub since
00576   /// we do not have access to it.
00577   CORBA::Policy_ptr stubless_relative_roundtrip_timeout (void);
00578 
00579   /// Invoke the timeout hook if present.
00580   /**
00581    * The timeout hook is used to determine if the timeout policy is
00582    * set and with what value.  If the ORB is compiled without support
00583    * for Messaging this feature does not take effect
00584    * \param has_timeout returns 0 if there is no timeout policy set.
00585    * \param time_value returns the timeout value in effect for the object,
00586    * thread and current ORB.
00587    */
00588   void connection_timeout (TAO_Stub *stub,
00589                            int &has_timeout,
00590                            ACE_Time_Value &time_value);
00591 
00592   /// Define the Timeout_Hook signature
00593   static void connection_timeout_hook (Timeout_Hook hook);
00594 
00595 
00596   /// Access to the connection timeout policy set on the thread or
00597   /// on the ORB.  In this method, we do not consider the stub since
00598   /// we do not have access to it.
00599   CORBA::Policy_ptr stubless_connection_timeout (void);
00600 
00601 
00602   void call_sync_scope_hook (TAO_Stub *stub,
00603                              int &has_synchronization,
00604                              Messaging::SyncScope &scope);
00605 
00606   TAO_Sync_Strategy &get_sync_strategy (TAO_Stub *stub,
00607                                         Messaging::SyncScope &scope);
00608   typedef void (*Sync_Scope_Hook) (TAO_ORB_Core *,
00609                                    TAO_Stub *,
00610                                    int &,
00611                                    Messaging::SyncScope &);
00612   static void set_sync_scope_hook (Sync_Scope_Hook hook);
00613 
00614 #if (TAO_HAS_SYNC_SCOPE_POLICY == 1)
00615   CORBA::Policy_ptr stubless_sync_scope (void);
00616 #endif  /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */
00617 
00618 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
00619 
00620   CORBA::Policy_ptr default_buffering_constraint (void) const;
00621 
00622   /// This strategy will buffer messages.
00623   //@{
00624   TAO_Eager_Buffering_Sync_Strategy &eager_buffering_sync_strategy (void);
00625   TAO_Delayed_Buffering_Sync_Strategy &delayed_buffering_sync_strategy (void);
00626   //@}
00627 
00628 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
00629 
00630   /// This strategy will sync with the transport.
00631   TAO_Transport_Sync_Strategy &transport_sync_strategy (void);
00632 
00633   /// Handle to the factory for protocols_hooks_..
00634   TAO_Protocols_Hooks *protocols_hooks_;
00635 
00636   /// Obtain the TSS resources of this orb.
00637   TAO_ORB_Core_TSS_Resources* get_tss_resources (void);
00638 
00639   /// Obtain the TSS resource in the given slot.
00640   void* get_tss_resource (size_t slot_id);
00641 
00642   /// Set the TSS resource at the given slot.
00643   /// Returns 0 on success, and -1 on failure.
00644   int set_tss_resource (size_t slot_id, void *);
00645 
00646   /// Register a TSS cleanup function.  The slot ID for the
00647   /// corresponding ORB core TSS resource is returned by the reference
00648   /// argument.  This method return 0 on success, and -1 on failure.
00649   int add_tss_cleanup_func (ACE_CLEANUP_FUNC cleanup,
00650                             size_t &slot_id);
00651 
00652   /// Return the underlying TSS cleanup function registry.
00653   TAO_Cleanup_Func_Registry *tss_cleanup_funcs (void);
00654 
00655   /// Get access to the leader_follower class.
00656   TAO_Leader_Follower &leader_follower (void);
00657 
00658   /// Get access to the leader follower strategy.
00659   TAO_LF_Strategy &lf_strategy (void);
00660 
00661   /// Get access to the thread lane resources.
00662   TAO_Thread_Lane_Resources &lane_resources (void);
00663 
00664   /// Run the event loop.
00665   int run (ACE_Time_Value *tv,
00666            int perform_work
00667            ACE_ENV_ARG_DECL);
00668 
00669   /// End the event loop
00670   void shutdown (CORBA::Boolean wait_for_completion
00671                  ACE_ENV_ARG_DECL)
00672     ACE_THROW_SPEC (());
00673 
00674   /// Get the shutdown flag value
00675   int has_shutdown (void);
00676 
00677   /// Shutdown the ORB and free resources
00678   void destroy (ACE_ENV_SINGLE_ARG_DECL);
00679 
00680   /// Check if ORB has shutdown.  If it has, throw an exception.
00681   void check_shutdown (ACE_ENV_SINGLE_ARG_DECL);
00682 
00683   /// Returns the <timeout> value used by the server threads to poll
00684   /// the shutdown flag. If the return value is zero then the server
00685   /// threads block forever.
00686   int thread_per_connection_timeout (ACE_Time_Value &timeout) const;
00687 
00688   /// Makes sure that the ORB is open and then creates a TAO_Stub
00689   /// based on the endpoint.
00690   TAO_Stub *create_stub_object (TAO_MProfile &mprofile,
00691                                 const char *type_id,
00692                                 CORBA::PolicyList *policy_list
00693                                 ACE_ENV_ARG_DECL);
00694 
00695   /// Factory method that create the "right" Stub depending on
00696   /// wheather RTCORBA is loaded or not. The factory used to create
00697   /// the stub, is loaded at ORB initialization, and its type depends
00698   /// on the fact that RTCORBA is being used or not.
00699   TAO_Stub *create_stub (const char *repository_id,
00700                          const TAO_MProfile &profiles
00701                          ACE_ENV_ARG_DECL);
00702 
00703   /// Create a new object, use the adapter registry to create a
00704   /// collocated object, if not possible then create a regular
00705   /// object.
00706   CORBA::Object_ptr create_object (TAO_Stub *the_stub);
00707 
00708   /// Return ORBid string.
00709   const char *orbid (void) const;
00710 
00711   /// Set/Get the IOR of the Implementation Repository service.
00712   //@{
00713   CORBA::Object_ptr implrepo_service (void);
00714   void implrepo_service (const CORBA::Object_ptr ir);
00715   //@}
00716 
00717   /// Resolve the TypeCodeFactory DLL.
00718   CORBA::Object_ptr resolve_typecodefactory (ACE_ENV_SINGLE_ARG_DECL);
00719 
00720   /// Resolve the Dynamic Any Factory
00721   CORBA::Object_ptr resolve_dynanyfactory (ACE_ENV_SINGLE_ARG_DECL);
00722 
00723   /// Resolve the IOR Manipulation reference for this ORB.
00724   CORBA::Object_ptr resolve_ior_manipulation (ACE_ENV_SINGLE_ARG_DECL_NOT_USED);
00725 
00726   /// Resolve the IOR Table reference for this ORB.
00727   CORBA::Object_ptr resolve_ior_table (ACE_ENV_SINGLE_ARG_DECL_NOT_USED);
00728 
00729   /// Resolve an initial reference via the -ORBInitRef and
00730   // -ORBDefaultInitRef options.
00731   CORBA::Object_ptr resolve_rir (const char *name
00732                                  ACE_ENV_ARG_DECL_NOT_USED);
00733 
00734   /// Resolve the RT ORB reference for this ORB.
00735   CORBA::Object_ptr resolve_rt_orb (ACE_ENV_SINGLE_ARG_DECL);
00736 
00737   /// Resolve the RT Current flyweight for this ORB.
00738   /// Return server_id string.
00739   const char *server_id (void) const;
00740 
00741   CORBA::Object_ptr resolve_rt_current (ACE_ENV_SINGLE_ARG_DECL);
00742 
00743   /// Set/Get the current PortableGroup POA hooks.
00744   TAO_POA_PortableGroup_Hooks *portable_group_poa_hooks (void) const;
00745   void portable_group_poa_hooks(TAO_POA_PortableGroup_Hooks *poa_hooks);
00746 
00747   /// List all the service known by the ORB
00748   CORBA_ORB_ObjectIdList_ptr list_initial_references (ACE_ENV_SINGLE_ARG_DECL_NOT_USED);
00749 
00750   /// Reference counting...
00751   CORBA::ULong _incr_refcnt (void);
00752   CORBA::ULong _decr_refcnt (void);
00753 
00754   /// Register the handle of an open connection with the ORB Core
00755   /// handle set.  This handle set will be used to explicitly remove
00756   /// corresponding event handlers from the reactor.
00757   int register_handle (ACE_HANDLE handle);
00758 
00759   /// Remove <handle> from the ORB Core's handle set so that it
00760   /// isn't included in the set that is passed to the reactor upon ORB
00761   /// destruction.
00762   int remove_handle (ACE_HANDLE handle);
00763 
00764 
00765   /**
00766    * @name ORB Core Service Hooks
00767    *
00768    * These methods would represent the hooks in the ORB Core. These
00769    * hooks would be used to call back on the services or other
00770    * features that are dynamically loaded.
00771    */
00772   //@{
00773   /**
00774    * The loaded service in the ORB_Core would determine if the profile
00775    * selection is going to be made by the services or not. If the
00776    * services do make the selection they would return the selected
00777    * profile through <profile>.
00778    */
00779   CORBA::Boolean service_profile_selection (TAO_MProfile &mprofile,
00780                                             TAO_Profile  *&profile);
00781 
00782   /**
00783    * The loaded service in the ORB_Core would determine if the profile
00784    * reselection is going to be made by the services or not. If the
00785    * services do make the reselection they would return the selected
00786    * profile through <profile>. The reselction is for the
00787    * multi-profile IORS.
00788    */
00789   CORBA::Boolean service_profile_reselection (TAO_Stub *stub,
00790                                               TAO_Profile *&profile);
00791 
00792   /// Reset the flags in the loaded services.
00793   void reset_service_profile_flags (void);
00794 
00795   /**
00796    * The loaded service would determineif the CORBA::Object_ptr is
00797    * actually nill or not. This would be useful to accomodate new
00798    * enhanced definitions as defined by the service specification.
00799    */
00800   CORBA::Boolean object_is_nil (CORBA::Object_ptr object);
00801 
00802   /// Call the service layers with the Service Context to check
00803   /// whether they would like to add something to the list.
00804   void service_context_list (TAO_Stub *stub,
00805                              TAO_Service_Context &service_context,
00806                              CORBA::Boolean retstart
00807                              ACE_ENV_ARG_DECL);
00808 
00809   /// Return a reference to the Fault Tolerant service object.
00810   TAO_Fault_Tolerance_Service &fault_tolerance_service (void);
00811 
00812   /// Raise a comm failure exception if a service is not loaded, else
00813   /// delegate to the service to see what the service has to do for
00814   /// this case.
00815   int service_raise_comm_failure (TAO_GIOP_Invocation *invoke,
00816                                   TAO_Profile *profile
00817                                   ACE_ENV_ARG_DECL);
00818 
00819   /// Raise a transient failure exception if a service is not loaded,
00820   /// else delegate to the service to see what the service has to do
00821   /// for this case.
00822   int service_raise_transient_failure (TAO_GIOP_Invocation *invoke,
00823                                        TAO_Profile *profile
00824                                        ACE_ENV_ARG_DECL);
00825 
00826   /// Hook for logging of messages by the Logging & Recovery service
00827   /// of an FT service.
00828   void services_log_msg_rcv (TAO_Message_State_Factory &state);
00829 
00830   /// Hook for logging of messages by the Logging & Recovery service
00831   /// of an FT service.
00832   void services_log_msg_pre_upcall (TAO_ServerRequest &req);
00833 
00834   /// Hook for logging of messages by the Logging & Recovery service
00835   /// of an FT service.
00836   void services_log_msg_post_upcall (TAO_ServerRequest &req);
00837   //@}
00838 
00839 
00840   /**
00841    * @name Portable Interceptor Related Methods
00842    *
00843    * These are support methods for interceptor registration and
00844    * interceptor set (an array) access, in addition to PICurrent
00845    * access.
00846    */
00847   //@{
00848 #if TAO_HAS_INTERCEPTORS == 1
00849 
00850   /// Return a pointer to the cached TAO_PICurrent object.
00851   TAO_PICurrent *pi_current (void);
00852 
00853   /// Set the pointer to the cached TAO_PICurrent object.
00854   void pi_current (TAO_PICurrent *current);
00855 
00856   /// Register a client request interceptor.
00857   void add_interceptor (
00858     PortableInterceptor::ClientRequestInterceptor_ptr interceptor
00859     ACE_ENV_ARG_DECL);
00860 
00861   /// Register a server request interceptor.
00862   void add_interceptor (
00863     PortableInterceptor::ServerRequestInterceptor_ptr interceptor
00864     ACE_ENV_ARG_DECL);
00865 
00866   /// Return the array of client-side interceptors specific to this
00867   /// ORB.
00868   TAO_ClientRequestInterceptor_List::TYPE &
00869     client_request_interceptors (void);
00870 
00871   /// Return the array of server-side interceptors specific to this
00872   /// ORB.
00873   TAO_ServerRequestInterceptor_List::TYPE &
00874     server_request_interceptors (void);
00875 
00876 #endif /* TAO_HAS_INTERCEPTORS */
00877 
00878   /// Register an IOR interceptor.
00879   void add_interceptor (
00880     PortableInterceptor::IORInterceptor_ptr interceptor
00881     ACE_ENV_ARG_DECL);
00882 
00883   /// Return the array of IOR interceptors specific to this ORB.
00884   TAO_IORInterceptor_List::TYPE & ior_interceptors (void);
00885   //@}
00886 
00887   /// Return the underlying transport cache
00888   TAO_Transport_Cache_Manager *transport_cache (void);
00889 
00890   /// Set and Get methods to indicate whether a BiDir IIOP policy has
00891   /// been set in the POA.
00892   /// @note At present, the value will be true even if one of the POA's
00893   ///       is set with the Bi Dir GIOP policy.
00894   CORBA::Boolean bidir_giop_policy (void);
00895   void bidir_giop_policy (CORBA::Boolean);
00896 
00897   /// Return the table that maps object key/name to de-stringified
00898   /// object reference.  It is needed for supporting local objects in
00899   /// the resolve_initial_references() mechanism.
00900   TAO_Object_Ref_Table &object_ref_table (void);
00901 
00902   /// Return the current request dispatcher strategy.
00903   TAO_Request_Dispatcher *request_dispatcher (void);
00904 
00905   /// Set a new request dispatcher.  The ORB Core retains ownership
00906   /// of the request dispatcher once it gets it.  Currently, this only
00907   /// gets called at initialization.
00908   void request_dispatcher (TAO_Request_Dispatcher *rd);
00909 
00910   /// Call the libraries to handover the validators if they havent
00911   /// registered yet with the list of validators.
00912   void load_policy_validators (TAO_Policy_Validator &validator);
00913 
00914   /// Return the flushing strategy
00915   /**
00916    * The flushing strategy is created by the resource factory, and it
00917    * is used by the ORB to control the mechanism used to flush the
00918    * outgoing data queues.
00919    * The flushing strategies are stateless, therefore, there is only
00920    * one per ORB.
00921    */
00922   TAO_Flushing_Strategy *flushing_strategy (void);
00923 
00924   /// Get Code Set Manager
00925   TAO_Codeset_Manager *codeset_manager (void);
00926 
00927   typedef ACE_Hash_Map_Manager_Ex<ACE_CString, ACE_CString, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> InitRefMap;
00928 
00929   /// Return a pointer to the -ORBInitRef map.
00930   InitRefMap * init_ref_map (void);
00931 
00932   /// Set the ORB related to the orb_id as the default ORB and not the
00933   /// ORB that is first binded in the ORB Table
00934   void set_default (const char *orb_id);
00935 
00936   /// Set to choose to be not a default ORB when there are more than
00937   /// one ORB.
00938   void not_default (const char *orb_id);
00939 
00940 protected:
00941 
00942   /// Destructor is protected since the ORB Core is a reference
00943   /// counted object.
00944   ~TAO_ORB_Core (void);
00945 
00946   /// Initialize the guts of the ORB Core.  It is intended that this be
00947   /// called by <CORBA::ORB_init>.
00948   int init (int &argc, char **argv ACE_ENV_ARG_DECL);
00949 
00950   /// Final termination hook, typically called by CORBA::ORB's
00951   /// destructor.
00952   int fini (void);
00953 
00954 #if 0
00955   /// @@todo: All these need to go! We dont put input cdr's on the TSS
00956   /// anyway.
00957   /// Implement the input_cdr_*_allocator() routines using pre-fetched
00958   /// TSS resources.  This minimizes the number of calls to them.
00959   //@{
00960   ACE_Allocator *input_cdr_dblock_allocator_i (TAO_ORB_Core_TSS_Resources *);
00961   ACE_Allocator *input_cdr_buffer_allocator_i (TAO_ORB_Core_TSS_Resources *);
00962   ACE_Allocator *input_cdr_msgblock_allocator_i (TAO_ORB_Core_TSS_Resources *);
00963   //@}
00964 
00965 #endif /*if 0*/
00966   /// Routine that creates a ACE_Data_Block given the lock and allocators.
00967   ACE_Data_Block *create_data_block_i (size_t size,
00968                                        ACE_Allocator *buffer_allocator,
00969                                        ACE_Allocator *dblock_allocator,
00970                                        ACE_Lock *lock);
00971 
00972   /// Obtain and cache the dynamic any factory object reference.
00973   void resolve_typecodefactory_i (ACE_ENV_SINGLE_ARG_DECL);
00974 
00975   /// Obtain and cache the dynamic any factory object reference.
00976   void resolve_dynanyfactory_i (ACE_ENV_SINGLE_ARG_DECL);
00977 
00978   /// Obtain and cache the IORManipulation factory object reference.
00979   void resolve_iormanipulation_i (ACE_ENV_SINGLE_ARG_DECL);
00980 
00981   /// Search the Dynamic service list for BiDirectional options that
00982   /// can be dynamically loaded.
00983   int bidirectional_giop_init (ACE_ENV_SINGLE_ARG_DECL);
00984 
00985   /// Search the Dynamic service list for well known services that has
00986   /// callbacks  which can be dynamically loaded.
00987   void services_callbacks_init (void);
00988 
00989   /// Helper method that invokes Interceptor::destroy() on all
00990   /// registered interceptors when ORB::destroy() is called. Prevents
00991   /// exceptions from propagating up the call chain.
00992   void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL)
00993     ACE_THROW_SPEC (());
00994 
00995   /// Pointer to the list of protocol loaded into this ORB instance.
00996   /// Helper method to hold the common code part for -ORBEndpoint and
00997   /// -ORBListenEndpoint options.
00998   int set_endpoint_helper (const char *current_arg
00999                            ACE_ENV_ARG_DECL);
01000 
01001 private:
01002 
01003   /// The ORB Core should not be copied.
01004   //@{
01005   ACE_UNIMPLEMENTED_FUNC (TAO_ORB_Core(const TAO_ORB_Core&))
01006   ACE_UNIMPLEMENTED_FUNC (void operator=(const TAO_ORB_Core&))
01007   //@}
01008 
01009   /// Obtain and cache the dynamic any factory object reference.
01010   void resolve_ior_table_i (ACE_ENV_SINGLE_ARG_DECL);
01011 
01012   /// Try to create a new collocated object, using <other_orb> as the
01013   /// target ORB.  If not possible return 0.
01014   CORBA::Object_ptr create_collocated_object (TAO_Stub *the_stub,
01015                                               TAO_ORB_Core *other_orb,
01016                                               const TAO_MProfile &mprofile);
01017 
01018 protected:
01019 
01020   /// Synchronize internal state...
01021   TAO_SYNCH_MUTEX lock_;
01022 
01023   TAO_Thread_Lane_Resources_Manager *thread_lane_resources_manager_;
01024 
01025   TAO_Collocation_Resolver *collocation_resolver_;
01026 
01027   TAO_Stub_Factory *stub_factory_;
01028 
01029   TAO_ProtocolFactorySet *protocol_factories_;
01030 
01031   /// The cached IOR for the Implementation Repository.
01032   // @@ If this is a _var, where should it get deleted? (brunsch)
01033   CORBA::Object_ptr implrepo_service_;
01034 
01035   /// Flag for whether the implrepo support is enabled or not.
01036   int use_implrepo_;
01037 
01038   /// The cached IOR for the TypeCodeFactory DLL.
01039   CORBA::Object_ptr typecode_factory_;
01040 
01041   /// The cached object reference for the DynAnyFactory.
01042   CORBA::Object_ptr dynany_factory_;
01043 
01044   /// The cached object reference for the IORManipulataion.
01045   CORBA::Object_ptr ior_manip_factory_;
01046 
01047   /// The cached object reference for the IORTable.
01048   CORBA::Object_ptr ior_table_;
01049 
01050   /// The cached object reference for the RTCORBA::RTORB.
01051   CORBA::Object_var rt_orb_;
01052 
01053   /// The cached object reference for the RTCORBA::Current interface.
01054   CORBA::Object_var rt_current_;
01055 
01056   /**
01057    * @note
01058    * Should we keep a single ORB pointer? This is good because
01059    * multiple calls to ORB_init() with the same ORBid can use the same
01060    * object, but maybe don't want so much coupling.
01061    *
01062    * Pointer to the ORB.
01063    */
01064   CORBA::ORB_var orb_;
01065 
01066   /// Object reference to the root POA.  It will eventually be the
01067   /// object reference returned by calls to
01068   ///   CORBA::ORB::resolve_initial_references ("RootPOA").
01069   CORBA::Object_var root_poa_;
01070 
01071   // Hold a pointer for the POA if it needs to use any of the Portable
01072   // group hooks.
01073   TAO_POA_PortableGroup_Hooks *portable_group_poa_hooks_;
01074 
01075   /// Parameters used by the ORB.
01076   TAO_ORB_Parameters orb_params_;
01077 
01078   /// Return InitRefMap to find if a particular object id is present.
01079   InitRefMap init_ref_map_;
01080 
01081   /// Table that maps object key/name to (de-stringified) object
01082   /// reference.  It is needed for supporting local objects in the
01083   /// resolve_initial_references() mechanism.
01084   TAO_Object_Ref_Table object_ref_table_;
01085 
01086   /// The ORBid for this ORB.
01087   char *orbid_;
01088 
01089   /// Handle to the factory for resource information..
01090   TAO_Resource_Factory *resource_factory_;
01091 
01092 #if 0
01093   /// @@todo: All these need to go!
01094   /// The allocators for the message blocks
01095   //@{
01096   ACE_Allocator *message_block_dblock_allocator_;
01097   ACE_Allocator *message_block_buffer_allocator_;
01098   ACE_Allocator *message_block_msgblock_allocator_;
01099   //@}
01100 #endif /*if 0*/
01101 
01102   /// The server_id_ that was passed via -ORBServerId option
01103   ACE_CString server_id_;
01104 
01105   /// Handle to the factory for Client-side strategies.
01106   TAO_Client_Strategy_Factory *client_factory_;
01107 
01108   /// Handle to the factory for Server-side strategies.
01109   TAO_Server_Strategy_Factory *server_factory_;
01110 
01111   /**
01112    * @name Service Level Hooks
01113    */
01114   //@{
01115 
01116   /// Fault Tolerant service hook.
01117   TAO_Fault_Tolerance_Service ft_service_;
01118 
01119   //@}
01120 
01121   /// TRUE if we want to take advantage of collocation optimization in
01122   /// this ORB.
01123   CORBA::Boolean opt_for_collocation_;
01124 
01125   /// TRUE if we want to consider all ORBs in this address space
01126   /// collocated.
01127   CORBA::Boolean use_global_collocation_;
01128 
01129   /// Default collocation policy.  This should never be ORB_CONTROL.
01130   CORBA::ULong collocation_strategy_;
01131 
01132 
01133 #if (TAO_HAS_CORBA_MESSAGING == 1)
01134 
01135   /// The Policy_Manager for this ORB.
01136   TAO_Policy_Manager *policy_manager_;
01137 
01138   /// The default policies.
01139   TAO_Policy_Set *default_policies_;
01140 
01141   /// Policy current.
01142   TAO_Policy_Current *policy_current_;
01143 
01144 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
01145 
01146     /// The request dispatching strategy.
01147   TAO_Request_Dispatcher *request_dispatcher_;
01148 
01149   /**
01150    * POA current.
01151    *
01152    * @note
01153    * This is a pointer in order to reduce the include file
01154    * dependencies.
01155    */
01156   CORBA::Object_var poa_current_;
01157 
01158   /// The list of Adapters used in this ORB.
01159   TAO_Adapter_Registry adapter_registry_;
01160 
01161   /// An optimization for the POA.
01162   TAO_Adapter *poa_adapter_;
01163 
01164   /// The Thread Manager
01165   ACE_Thread_Manager tm_;
01166 
01167   /// The data block reference counts are locked using this mutex
01168   ACE_Lock_Adapter<TAO_SYNCH_MUTEX> data_block_lock_;
01169 
01170   /// TSS Object cleanup functions.  These correspond to the TSS
01171   /// objects stored in TAO's TSS resources.
01172   TAO_Cleanup_Func_Registry tss_cleanup_funcs_;
01173 
01174   /// This is where the tss resources for this ORB are stored.
01175   ACE_TSS_TYPE (TAO_ORB_Core_TSS_Resources) tss_resources_;
01176 
01177   /// If the resources are per-ORB (as opposed to per-ORB-per-thread)
01178   /// then they are stored here...
01179   TAO_ORB_Core_TSS_Resources orb_resources_;
01180 
01181   /// Flag which denotes that the ORB has been shutdown.
01182   int has_shutdown_;
01183 
01184   /// The value of the timeout if the flag above is not zero.
01185   //@{
01186   int thread_per_connection_use_timeout_;
01187   ACE_Time_Value thread_per_connection_timeout_;
01188   //@}
01189 
01190   /// Mutual exclusion for calling open.
01191   TAO_SYNCH_MUTEX open_lock_;
01192 
01193   /// Flag which denotes that the open method was called.
01194   int open_called_;
01195 
01196   TAO_Endpoint_Selector_Factory *endpoint_selector_factory_;
01197 
01198 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
01199 
01200   /// This strategy will buffer messages.
01201   TAO_Eager_Buffering_Sync_Strategy *eager_buffering_sync_strategy_;
01202 
01203   /// This strategy will buffer messages.
01204   TAO_Delayed_Buffering_Sync_Strategy *delayed_buffering_sync_strategy_;
01205 
01206 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
01207 
01208   /// This strategy will sync with the transport.
01209   TAO_Transport_Sync_Strategy *transport_sync_strategy_;
01210 
01211   /// Number of outstanding references to this object.
01212   CORBA::ULong refcount_;
01213 
01214   /// Registry containing all registered policy factories.
01215   TAO_PolicyFactory_Registry policy_factory_registry_;
01216 
01217 #if (TAO_HAS_INTERCEPTORS == 1)
01218   /// Cached pointer/reference to the PICurrent object.
01219   /**
01220    * A pointer/reference to the PICurrent object is cached in the ORB
01221    * Core since it is accessed in the critical path (i.e. the request
01222    * invocation path).  Caching it prevents additional overhead to due
01223    * object resolution from occurring.
01224    */
01225   TAO_PICurrent *pi_current_;
01226 
01227   /// Client request interceptor registry.
01228   TAO_ClientRequestInterceptor_List client_request_interceptors_;
01229 
01230   /// Server request interceptor registry.
01231   TAO_ServerRequestInterceptor_List server_request_interceptors_;
01232 #endif /* TAO_HAS_INTERCEPTORS */
01233 
01234   /// IOR interceptor registry.
01235   TAO_IORInterceptor_List ior_interceptors_;
01236 
01237   /// The IOR parser registry.
01238   TAO_Parser_Registry parser_registry_;
01239 
01240   /// BiDirectional GIOP factory
01241   TAO_BiDir_Adapter *bidir_adapter_;
01242 
01243   /// Bir Dir GIOP policy value
01244   CORBA::Boolean bidir_giop_policy_;
01245 
01246   /// Hold the flushing strategy
01247   TAO_Flushing_Strategy *flushing_strategy_;
01248 
01249   /// Code Set Manager
01250   TAO_Codeset_Manager *codeset_manager_;
01251 
01252 };
01253 
01254 // ****************************************************************
01255 
01256 /**
01257  * @class TAO_ORB_Core_Static_Resources
01258  *
01259  * @brief The static (global) resoures of all ORB cores.
01260  *
01261  * This class is used by the ORB_Core to store the resources global to
01262  * all ORB_Cores.  All instance variables that would have been
01263  * declared "static" in TAO_ORB_Core, should be declared in this class
01264  * to avoid the "static initialization order fiasco" as described in
01265  * http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11.
01266  * Briefly, this is the problem that occurs if any static initializers
01267  * in any other code call into set static members of TAO_ORB_Core.
01268  * Since the order in which these initializers execute is unspecified,
01269  * uninitialized members can be accessed.
01270  */
01271 class TAO_Export TAO_ORB_Core_Static_Resources
01272 {
01273 public:
01274 
01275   /// Return the singleton instance.
01276   static TAO_ORB_Core_Static_Resources* instance (void);
01277 
01278 public:
01279   // The hook to be set for the SyncScopePolicy
01280   TAO_ORB_Core::Sync_Scope_Hook sync_scope_hook_;
01281 
01282   // Name of the protocols_hooks that needs to be instantiated.
01283   // The default value is "Protocols_Hooks". If RTCORBA option is
01284   // set, its value will be set to
01285   // be "RT_Protocols_Hooks".
01286   ACE_CString protocols_hooks_name_;
01287 
01288   /// The hook to be set for the RelativeRoundtripTimeoutPolicy.
01289   TAO_ORB_Core::Timeout_Hook timeout_hook_;
01290 
01291   /// The hook to be set for the ConnectionTimeoutPolicy
01292   TAO_ORB_Core::Timeout_Hook connection_timeout_hook_;
01293 
01294   // Name of the endpoint selector factory that needs to be instantiated.
01295   // The default value is "Default_Endpoint_Selector_Factory". If
01296   // TAO_RTCORBA is linked, the set_endpoint_selector_factory will be
01297   // called to set the value to be "RT_Endpoint_Selector_Factory".
01298   ACE_CString endpoint_selector_factory_name_;
01299 
01300   // Name of the thread lane resources manager that needs to be
01301   // instantiated.  The default value is
01302   // "Default_Thread_Lane_Resources_Manager_Factory". If TAO_RTCORBA
01303   // is linked, the set_thread_lane_resources_manager will be called
01304   // to set the value to be
01305   // "RT_Thread_Lane_Resources_Manager_Factory".
01306   ACE_CString thread_lane_resources_manager_factory_name_;
01307 
01308   // Name of the collocation resolver that needs to be instantiated.
01309   // The default value is "Default_Collocation_Resolver". If
01310   // TAO_RTCORBA is linked, the set_collocation_resolver will be
01311   // called to set the value to be "RT_Collocation_Resolver".
01312   ACE_CString collocation_resolver_name_;
01313 
01314   // Name of the stub factory that needs to be instantiated.
01315   // The default value is "Default_Stub_Factory". If TAO_RTCORBA is
01316   // linked, the set_stub_factory will be called to set the value
01317   // to be "RT_Stub_Factory".
01318   ACE_CString stub_factory_name_;
01319 
01320   // Name of the resource factory that needs to be instantiated.
01321   // The default value is "Resource_Factory". If TAO_Strategies is
01322   // linked, the set_resource_factory will be called to set the value
01323   // to be "Advanced_Resource_Factory".
01324   ACE_CString resource_factory_name_;
01325 
01326   // Name of the service object for DII request creation that needs
01327   // to be instantiated. The default value is "Dynamic_Adaper". If
01328   // TAO_DynamicInterface is linked, dynamic_adapter_name() will be
01329   // called to set the value to "Concrete_Dynamic_Adapter".
01330   ACE_CString dynamic_adapter_name_;
01331 
01332   // Name of the service object for functions that make calls on
01333   // the Interface Repository. The default value is "IFR_Client_Adaper".
01334   // If TAO_IFR_CLient is linked, ifr_client_adapter_name() will be
01335   // called to set the value to "Concrete_IFR_Client_Adapter".
01336   ACE_CString ifr_client_adapter_name_;
01337 
01338   // Name of the service object used by the ORB create_*_tc functions.
01339   // The default value is "TypeCodeFactory_Adapter". If the
01340   // TypeCodeFactory library is linked, the corresponding accessor
01341   // function typecodefactory_adapter_name() will be called to set
01342   // the value to "Concrete_TypeCodeFactory_Adapter".
01343   ACE_CString typecodefactory_adapter_name_;
01344 
01345   // Name of the service object used to create the RootPOA.  The
01346   // default value is "TAO_POA".  If TAO_RTCORBA is loaded, this
01347   // will be changed to TAO_RT_POA so that a POA equipped with
01348   // realtime extensions will be returned.
01349   ACE_CString poa_factory_name_;
01350 
01351   // The service configurator directive used to load
01352   // poa_factory_name_ dynamically.
01353   ACE_CString poa_factory_directive_;
01354 
01355 private:
01356 
01357   /// Constructor.
01358   TAO_ORB_Core_Static_Resources (void);
01359 
01360 private:
01361 
01362   /// The singleton instance.
01363   static TAO_ORB_Core_Static_Resources* instance_;
01364 
01365   /// Mostly unused variable whose sole purpose is to enforce
01366   /// the instantiation of a TAO_ORB_Core_Static_Resources instance
01367   /// at initialization time.
01368   static TAO_ORB_Core_Static_Resources* initialization_reference_;
01369 };
01370 
01371 // ****************************************************************
01372 
01373 /**
01374  * @class TAO_ORB_Core_Auto_Ptr
01375  *
01376  * @brief Define a TAO_ORB_Core auto_ptr class.
01377  *
01378  * This class is used as an aid to make ORB initialization exception
01379  * safe.  It ensures that the ORB core is deallocated if an exception
01380  * is thrown.
01381  *
01382  * @todo
01383  * TAO_ORB_Core_Auto_Ptr should be renamed to TAO_ORB_Core_var
01384  * since the ORB Core is reference counted.
01385  */
01386 class TAO_Export TAO_ORB_Core_Auto_Ptr
01387 {
01388 public:
01389 
01390   /// Initialization and termination methods
01391   //@{
01392   /* explicit */ TAO_ORB_Core_Auto_Ptr (TAO_ORB_Core *p = 0);
01393   TAO_ORB_Core_Auto_Ptr (TAO_ORB_Core_Auto_Ptr &ap);
01394   TAO_ORB_Core_Auto_Ptr &operator= (TAO_ORB_Core_Auto_Ptr &rhs);
01395   ~TAO_ORB_Core_Auto_Ptr (void);
01396   //@}
01397 
01398   /// Accessor methods.
01399   //@{
01400   TAO_ORB_Core &operator *() const;
01401   TAO_ORB_Core *get (void) const;
01402   TAO_ORB_Core *release (void);
01403   void reset (TAO_ORB_Core *p = 0);
01404   TAO_ORB_Core *operator-> () const;
01405   //@}
01406 
01407 protected:
01408 
01409   TAO_ORB_Core *p_;
01410 
01411 };
01412 
01413 // ****************************************************************
01414 /**
01415  * @class TAO_TSS_Resources
01416  *
01417  * @brief The TSS resoures shared by all the ORBs
01418  *
01419  * This class is used by TAO to store the resources that are
01420  * thread-specific but are *not* ORB specific. The members are public
01421  * because only the ORB Core is expected to access them.
01422  */
01423 class TAO_Export TAO_TSS_Resources
01424 {
01425 public:
01426 
01427   /// Constructor
01428   TAO_TSS_Resources (void);
01429 
01430   /// Destructor
01431   ~TAO_TSS_Resources (void);
01432 
01433 private:
01434 
01435   /// Do not copy TSS resources
01436   //@{
01437   ACE_UNIMPLEMENTED_FUNC (TAO_TSS_Resources(const TAO_TSS_Resources&))
01438   ACE_UNIMPLEMENTED_FUNC (void operator=(const TAO_TSS_Resources&))
01439   //@}
01440 
01441 public:
01442 
01443   /**
01444    * Points to structure containing state for the current upcall
01445    * context in this thread.  Note that it does not come from the
01446    * resource factory because it must always be held in
01447    * thread-specific storage.  For now, since TAO_ORB_Core instances
01448    * are TSS singletons, we simply ride along and don't allocate
01449    * occupy another TSS slot since there are some platforms where
01450    * those are precious commodities (e.g., NT).
01451    */
01452   void *poa_current_impl_;
01453 
01454   /// The default environment for the thread.
01455   CORBA_Environment *default_environment_;
01456 
01457   /// If the user (or library) provides no environment the ORB_Core
01458   /// still holds one.
01459   CORBA_Environment tss_environment_;
01460 
01461 #if (TAO_HAS_CORBA_MESSAGING == 1)
01462 
01463   /// The initial PolicyCurrent for this thread. Should be a TSS
01464   /// resource.
01465   TAO_Policy_Current_Impl initial_policy_current_;
01466 
01467   /// This pointer is reset by the POA on each upcall.
01468   TAO_Policy_Current_Impl *policy_current_;
01469 
01470 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
01471 
01472 };
01473 
01474 /**
01475  * @todo TAO_TSS_RESOURCES singleton typedef should go away.
01476  */
01477 typedef TAO_TSS_Singleton<TAO_TSS_Resources, TAO_SYNCH_MUTEX>
01478         TAO_TSS_RESOURCES;
01479 
01480 TAO_SINGLETON_DECLARE (TAO_TSS_Singleton,
01481                        TAO_TSS_Resources,
01482                        TAO_SYNCH_MUTEX)
01483 
01484 // ****************************************************************
01485 
01486 /// Obtain an instance of the first ORB core registered in the ORB
01487 /// table.
01488 TAO_Export TAO_ORB_Core *TAO_ORB_Core_instance (void);
01489 
01490 #if defined (__ACE_INLINE__)
01491 # include "ORB_Core.i"
01492 #endif /* __ACE_INLINE__ */
01493 
01494 #include "ace/post.h"
01495 #endif /* TAO_ORB_CORE_H */

Generated on Mon Jun 16 13:49:11 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002