advanced_resource.h

Go to the documentation of this file.
00001 // advanced_resource.h,v 1.20 2006/03/10 07:19:19 jtc Exp
00002 
00003 #ifndef TAO_ADVANCED_RESOURCE_H
00004 #define TAO_ADVANCED_RESOURCE_H
00005 #include /**/ "ace/pre.h"
00006 
00007 #include "tao/Strategies/strategies_export.h"
00008 #include "tao/default_resource.h"
00009 
00010 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00011 # pragma once
00012 #endif /* ACE_LACKS_PRAGMA_ONCE */
00013 
00014 #include "tao/ORB_Core.h"
00015 
00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00017 
00018 class TAO_Connection_Purging_Strategy;
00019 
00020 class TAO_Strategies_Export TAO_Resource_Factory_Changer
00021 {
00022 public:
00023   TAO_Resource_Factory_Changer (void);
00024 };
00025 
00026 /**
00027  * @class TAO_Advanced_Resource_Factory
00028  *
00029  * @brief TAO's default resource factory
00030  *
00031  * Using a <{resource source specifier}> as a discriminator, the
00032  * factory can return resource instances which are, e.g., global,
00033  * stored in thread-specific storage, stored in shared memory,
00034  * etc.
00035  *
00036  */
00037 class TAO_Strategies_Export TAO_Advanced_Resource_Factory : public TAO_Default_Resource_Factory
00038 {
00039 public:
00040   // = Initialization and termination methods.
00041   /// Constructor.
00042   TAO_Advanced_Resource_Factory (void);
00043 
00044   /// Destructor.
00045   virtual ~TAO_Advanced_Resource_Factory (void);
00046 
00047   // = Service Configurator hooks.
00048   /// Dynamic linking hook
00049   virtual int init (int argc, ACE_TCHAR* argv[]);
00050 
00051   /// Type of lock used for the allocators
00052   enum Allocator_Lock_Type
00053   {
00054     TAO_ALLOCATOR_NULL_LOCK,
00055     TAO_ALLOCATOR_THREAD_LOCK
00056   };
00057 
00058   /// Type of Reactor
00059   enum
00060   {
00061     /// Use ACE_Token
00062     TAO_REACTOR_SELECT_MT = 1,
00063 
00064     /// Use ACE_Noop_Token
00065     TAO_REACTOR_SELECT_ST = 2,
00066     TAO_REACTOR_WFMO      = 3,
00067     TAO_REACTOR_MSGWFMO   = 4,
00068     TAO_REACTOR_TP        = 5
00069   };
00070 
00071   /// Thread queueing Strategy
00072   enum
00073   {
00074     /// Not set, use LIFO.
00075     TAO_THREAD_QUEUE_NOT_SET,
00076 
00077     /// FIFO, first-in-first-out.
00078     TAO_THREAD_QUEUE_FIFO,
00079 
00080     /// LIFO, last-in-first-out (default).
00081     TAO_THREAD_QUEUE_LIFO
00082   };
00083 
00084   /**
00085    * @name Resource Retrieval
00086    */
00087   //@{
00088   virtual int init_protocol_factories (void);
00089   virtual ACE_Allocator* input_cdr_dblock_allocator (void);
00090   virtual ACE_Allocator* input_cdr_buffer_allocator (void);
00091   virtual ACE_Allocator* input_cdr_msgblock_allocator (void);
00092   virtual ACE_Allocator* amh_response_handler_allocator (void);
00093   virtual ACE_Allocator* ami_response_handler_allocator (void);
00094   virtual int input_cdr_allocator_type_locked (void);
00095   virtual TAO_ProtocolFactorySet *get_protocol_factories (void);
00096   //@}
00097 
00098   virtual TAO_Connection_Purging_Strategy *create_purging_strategy (void);
00099   virtual TAO_LF_Strategy *create_lf_strategy (void);
00100 
00101 protected:
00102 
00103   /// Obtain the reactor implementation
00104   virtual ACE_Reactor_Impl *allocate_reactor_impl (void) const;
00105 
00106   void report_option_value_error (const ACE_TCHAR* option_name,
00107                                   const ACE_TCHAR* option_value);
00108 
00109   void report_unsupported_error (const ACE_TCHAR* option_name);
00110 
00111   /// List of loaded protocol factories.
00112   TAO_ProtocolFactorySet protocol_factories_;
00113 
00114   /// The type of reactor registry.
00115   int reactor_registry_type_;
00116 
00117   /// Flag indicating which kind of reactor we should use.
00118   int reactor_type_;
00119 
00120   /// The type of queueing strategy to use for multi-threaded
00121   /// select reactors, TAO_REACTOR_SELECT_MT and TAO_REACTOR_TP.
00122   int threadqueue_type_;
00123 
00124   /// The type of CDR allocators.
00125   Allocator_Lock_Type cdr_allocator_type_;
00126 
00127   /// Type of lock used by AMH response handler allocator.
00128   Allocator_Lock_Type amh_response_handler_allocator_lock_type_;
00129 
00130   /// Type of lock used by AMI response handler allocator.
00131   Allocator_Lock_Type ami_response_handler_allocator_lock_type_;
00132 
00133   virtual int load_default_protocols (void);
00134 
00135 };
00136 
00137 static TAO_Resource_Factory_Changer TAO_changer;
00138 
00139 TAO_END_VERSIONED_NAMESPACE_DECL
00140 
00141 ACE_STATIC_SVC_DECLARE_EXPORT (TAO_Strategies, TAO_Advanced_Resource_Factory)
00142 ACE_FACTORY_DECLARE (TAO_Strategies, TAO_Advanced_Resource_Factory)
00143 
00144 #include /**/ "ace/post.h"
00145 #endif /* TAO_ADVANCED_RESOURCE_H */

Generated on Thu Nov 9 13:39:28 2006 for TAO_Strategies by doxygen 1.3.6