00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CEC_Default_Factory.h 00006 * 00007 * CEC_Default_Factory.h,v 1.18 2006/03/14 06:14:24 jtc Exp 00008 * 00009 * @author Carlos O'Ryan (coryan@cs.wustl.edu) 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef TAO_CEC_DEFAULT_FACTORY_H 00015 #define TAO_CEC_DEFAULT_FACTORY_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include "orbsvcs/CosEvent/CEC_Factory.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "orbsvcs/CosEvent/CEC_Defaults.h" 00026 00027 #include "ace/Service_Config.h" 00028 #include "ace/Time_Value.h" 00029 00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00031 00032 /** 00033 * @class TAO_CEC_Default_Factory 00034 * 00035 * @brief A generic factory for EC experimentation. 00036 * 00037 * This class allows the user to experiment with different EC 00038 * configurations. Using a command-line like interface the user 00039 * can specify which strategies will this factory generate. 00040 * Since the class can be dynamically loaded the strategies can be 00041 * set in the service configurator file. 00042 * = MEMORY MANAGMENT 00043 */ 00044 class TAO_Event_Serv_Export TAO_CEC_Default_Factory : public TAO_CEC_Factory 00045 { 00046 public: 00047 /// Constructor 00048 TAO_CEC_Default_Factory (void); 00049 00050 /// destructor... 00051 virtual ~TAO_CEC_Default_Factory (void); 00052 00053 /// Helper function to register the default factory into the service 00054 /// configurator. 00055 static int init_svcs (void); 00056 00057 // = The Service_Object entry points 00058 virtual int init (int argc, ACE_TCHAR* argv[]); 00059 virtual int fini (void); 00060 00061 // = The CEC_Factory methods 00062 virtual TAO_CEC_Dispatching* 00063 create_dispatching (TAO_CEC_EventChannel*); 00064 virtual void 00065 destroy_dispatching (TAO_CEC_Dispatching*); 00066 virtual TAO_CEC_Pulling_Strategy* 00067 create_pulling_strategy (TAO_CEC_EventChannel*); 00068 virtual void 00069 destroy_pulling_strategy (TAO_CEC_Pulling_Strategy*); 00070 virtual TAO_CEC_ConsumerAdmin* 00071 create_consumer_admin (TAO_CEC_EventChannel*); 00072 virtual void 00073 destroy_consumer_admin (TAO_CEC_ConsumerAdmin*); 00074 virtual TAO_CEC_SupplierAdmin* 00075 create_supplier_admin (TAO_CEC_EventChannel*); 00076 virtual void 00077 destroy_supplier_admin (TAO_CEC_SupplierAdmin*); 00078 virtual TAO_CEC_ProxyPushSupplier* 00079 create_proxy_push_supplier (TAO_CEC_EventChannel*); 00080 virtual void 00081 destroy_proxy_push_supplier (TAO_CEC_ProxyPushSupplier*); 00082 virtual TAO_CEC_ProxyPullSupplier* 00083 create_proxy_pull_supplier (TAO_CEC_EventChannel*); 00084 virtual void 00085 destroy_proxy_pull_supplier (TAO_CEC_ProxyPullSupplier*); 00086 virtual TAO_CEC_ProxyPushConsumer* 00087 create_proxy_push_consumer (TAO_CEC_EventChannel*); 00088 virtual void 00089 destroy_proxy_push_consumer (TAO_CEC_ProxyPushConsumer*); 00090 virtual TAO_CEC_ProxyPullConsumer* 00091 create_proxy_pull_consumer (TAO_CEC_EventChannel*); 00092 virtual void 00093 destroy_proxy_pull_consumer (TAO_CEC_ProxyPullConsumer*); 00094 virtual TAO_CEC_ProxyPushConsumer_Collection* 00095 create_proxy_push_consumer_collection (TAO_CEC_EventChannel*); 00096 virtual void 00097 destroy_proxy_push_consumer_collection ( 00098 TAO_CEC_ProxyPushConsumer_Collection* 00099 ); 00100 virtual TAO_CEC_ProxyPullConsumer_Collection* 00101 create_proxy_pull_consumer_collection (TAO_CEC_EventChannel*); 00102 virtual void 00103 destroy_proxy_pull_consumer_collection ( 00104 TAO_CEC_ProxyPullConsumer_Collection* 00105 ); 00106 virtual TAO_CEC_ProxyPushSupplier_Collection* 00107 create_proxy_push_supplier_collection (TAO_CEC_EventChannel*); 00108 virtual void 00109 destroy_proxy_push_supplier_collection ( 00110 TAO_CEC_ProxyPushSupplier_Collection* 00111 ); 00112 virtual TAO_CEC_ProxyPullSupplier_Collection* 00113 create_proxy_pull_supplier_collection (TAO_CEC_EventChannel*); 00114 virtual void 00115 destroy_proxy_pull_supplier_collection ( 00116 TAO_CEC_ProxyPullSupplier_Collection* 00117 ); 00118 00119 virtual ACE_Lock* create_consumer_lock (void); 00120 virtual void destroy_consumer_lock (ACE_Lock*); 00121 virtual ACE_Lock* create_supplier_lock (void); 00122 virtual void destroy_supplier_lock (ACE_Lock*); 00123 00124 virtual TAO_CEC_ConsumerControl* 00125 create_consumer_control (TAO_CEC_EventChannel*); 00126 virtual void 00127 destroy_consumer_control (TAO_CEC_ConsumerControl*); 00128 virtual TAO_CEC_SupplierControl* 00129 create_supplier_control (TAO_CEC_EventChannel*); 00130 virtual void 00131 destroy_supplier_control (TAO_CEC_SupplierControl*); 00132 00133 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL) 00134 virtual TAO_CEC_Dispatching* 00135 create_dispatching (TAO_CEC_TypedEventChannel*); 00136 virtual TAO_CEC_TypedConsumerAdmin* 00137 create_consumer_admin (TAO_CEC_TypedEventChannel*); 00138 virtual void 00139 destroy_consumer_admin (TAO_CEC_TypedConsumerAdmin*); 00140 virtual TAO_CEC_TypedSupplierAdmin* 00141 create_supplier_admin (TAO_CEC_TypedEventChannel*); 00142 virtual void 00143 destroy_supplier_admin (TAO_CEC_TypedSupplierAdmin*); 00144 virtual TAO_CEC_ProxyPushSupplier* 00145 create_proxy_push_supplier (TAO_CEC_TypedEventChannel*); 00146 virtual TAO_CEC_ProxyPushSupplier_Collection* 00147 create_proxy_push_supplier_collection (TAO_CEC_TypedEventChannel*); 00148 virtual TAO_CEC_TypedProxyPushConsumer* 00149 create_proxy_push_consumer (TAO_CEC_TypedEventChannel*); 00150 virtual void 00151 destroy_proxy_push_consumer (TAO_CEC_TypedProxyPushConsumer*); 00152 virtual TAO_CEC_TypedProxyPushConsumer_Collection* 00153 create_proxy_push_consumer_collection (TAO_CEC_TypedEventChannel*); 00154 virtual void 00155 destroy_proxy_push_consumer_collection ( 00156 TAO_CEC_TypedProxyPushConsumer_Collection* 00157 ); 00158 virtual TAO_CEC_ConsumerControl* 00159 create_consumer_control (TAO_CEC_TypedEventChannel*); 00160 virtual TAO_CEC_SupplierControl* 00161 create_supplier_control (TAO_CEC_TypedEventChannel*); 00162 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */ 00163 00164 private: 00165 /// Parse an argument to set the type of collections used. 00166 int parse_collection_arg (ACE_TCHAR* opt); 00167 00168 private: 00169 /// Several flags to control the kind of object created. 00170 int dispatching_; 00171 int pulling_strategy_; 00172 int consumer_collection_; 00173 int supplier_collection_; 00174 int consumer_lock_; 00175 int supplier_lock_; 00176 00177 /// The MT dispatching priority has several arguments that could be 00178 /// controlled here... 00179 int dispatching_threads_; 00180 int dispatching_threads_flags_; 00181 int dispatching_threads_priority_; 00182 int dispatching_threads_force_active_; 00183 00184 /// How often (in microseconds) are the pull suppliers polled by the 00185 /// reactive pulling strategy. 00186 int reactive_pulling_period_; 00187 00188 /// Use this ORB to locate global resources. 00189 char *orbid_; 00190 00191 /// Indicate ORB ID has been duplicated (memory allocated). 00192 int orbid_dupped_; 00193 00194 /// The consumer and supplier control policies. 00195 int consumer_control_; 00196 int supplier_control_; 00197 00198 /// The consumer and supplier control periods in usecs 00199 int consumer_control_period_; 00200 int supplier_control_period_; 00201 00202 /// The consumer and supplier control timeout in usecs 00203 ACE_Time_Value consumer_control_timeout_; 00204 ACE_Time_Value supplier_control_timeout_; 00205 00206 /// The number of retries before disconnecting a proxy 00207 unsigned int proxy_disconnect_retries_; 00208 }; 00209 00210 TAO_END_VERSIONED_NAMESPACE_DECL 00211 00212 #if defined (__ACE_INLINE__) 00213 #include "orbsvcs/CosEvent/CEC_Default_Factory.i" 00214 #endif /* __ACE_INLINE__ */ 00215 00216 ACE_STATIC_SVC_DECLARE (TAO_CEC_Default_Factory) 00217 ACE_FACTORY_DECLARE (TAO_Event_Serv, TAO_CEC_Default_Factory) 00218 00219 #include /**/ "ace/post.h" 00220 00221 #endif /* TAO_CEC_DEFAULT_FACTORY_H */