advanced_resource.h

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

Generated on Tue Feb 2 17:47:18 2010 for TAO_Strategies by  doxygen 1.4.7