00001 /* -*- C++ -*- */ 00002 /** 00003 * @file EC_Default_Factory.h 00004 * 00005 * EC_Default_Factory.h,v 1.28 2006/03/14 06:14:25 jtc Exp 00006 * 00007 * @author Carlos O'Ryan (coryan@cs.wustl.edu) 00008 * 00009 * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and 00010 * other members of the DOC group. More details can be found in: 00011 * 00012 * http://doc.ece.uci.edu/~coryan/EC/index.html 00013 */ 00014 00015 #ifndef TAO_EC_DEFAULT_FACTORY_H 00016 #define TAO_EC_DEFAULT_FACTORY_H 00017 00018 #include /**/ "ace/pre.h" 00019 00020 #include "orbsvcs/Event/EC_Factory.h" 00021 00022 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00023 # pragma once 00024 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00025 00026 #include "orbsvcs/Event/EC_Defaults.h" 00027 00028 #include "ace/Service_Config.h" 00029 #include "ace/SString.h" 00030 #include "ace/Time_Value.h" 00031 00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00033 00034 class TAO_EC_Queue_Full_Service_Object; 00035 00036 /** 00037 * @class TAO_EC_Default_Factory 00038 * 00039 * @brief A generic factory for EC experimentation. 00040 * 00041 * This class allows the user to experiment with different EC 00042 * configurations. Using a command-line like interface the user 00043 * can specify which strategies will this factory generate. 00044 * Since the class can be dynamically loaded the strategies can be 00045 * set in the service configurator file. 00046 */ 00047 class TAO_RTEvent_Serv_Export TAO_EC_Default_Factory : public TAO_EC_Factory 00048 { 00049 public: 00050 /// Constructor 00051 TAO_EC_Default_Factory (void); 00052 00053 /// destructor... 00054 virtual ~TAO_EC_Default_Factory (void); 00055 00056 /// Helper function to register the default factory into the service 00057 /// configurator. 00058 static int init_svcs (void); 00059 00060 // = The Service_Object entry points 00061 virtual int init (int argc, ACE_TCHAR* argv[]); 00062 virtual int fini (void); 00063 00064 // = The EC_Factory methods 00065 virtual TAO_EC_Dispatching* 00066 create_dispatching (TAO_EC_Event_Channel_Base*); 00067 virtual void 00068 destroy_dispatching (TAO_EC_Dispatching*); 00069 virtual TAO_EC_Filter_Builder* 00070 create_filter_builder (TAO_EC_Event_Channel_Base*); 00071 virtual void 00072 destroy_filter_builder (TAO_EC_Filter_Builder*); 00073 virtual TAO_EC_Supplier_Filter_Builder* 00074 create_supplier_filter_builder (TAO_EC_Event_Channel_Base*); 00075 virtual void 00076 destroy_supplier_filter_builder (TAO_EC_Supplier_Filter_Builder*); 00077 virtual TAO_EC_ConsumerAdmin* 00078 create_consumer_admin (TAO_EC_Event_Channel_Base*); 00079 virtual void 00080 destroy_consumer_admin (TAO_EC_ConsumerAdmin*); 00081 virtual TAO_EC_SupplierAdmin* 00082 create_supplier_admin (TAO_EC_Event_Channel_Base*); 00083 virtual void 00084 destroy_supplier_admin (TAO_EC_SupplierAdmin*); 00085 virtual TAO_EC_ProxyPushSupplier* 00086 create_proxy_push_supplier (TAO_EC_Event_Channel_Base*); 00087 virtual void 00088 destroy_proxy_push_supplier (TAO_EC_ProxyPushSupplier*); 00089 virtual TAO_EC_ProxyPushConsumer* 00090 create_proxy_push_consumer (TAO_EC_Event_Channel_Base*); 00091 virtual void 00092 destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer*); 00093 virtual TAO_EC_Timeout_Generator* 00094 create_timeout_generator (TAO_EC_Event_Channel_Base*); 00095 virtual void 00096 destroy_timeout_generator (TAO_EC_Timeout_Generator*); 00097 virtual TAO_EC_ObserverStrategy* 00098 create_observer_strategy (TAO_EC_Event_Channel_Base*); 00099 virtual void 00100 destroy_observer_strategy (TAO_EC_ObserverStrategy*); 00101 virtual TAO_EC_Scheduling_Strategy* 00102 create_scheduling_strategy (TAO_EC_Event_Channel_Base*); 00103 virtual void 00104 destroy_scheduling_strategy (TAO_EC_Scheduling_Strategy*); 00105 virtual TAO_EC_ProxyPushConsumer_Collection* 00106 create_proxy_push_consumer_collection (TAO_EC_Event_Channel_Base*); 00107 virtual void 00108 destroy_proxy_push_consumer_collection (TAO_EC_ProxyPushConsumer_Collection*); 00109 virtual TAO_EC_ProxyPushSupplier_Collection* 00110 create_proxy_push_supplier_collection (TAO_EC_Event_Channel_Base*); 00111 virtual void 00112 destroy_proxy_push_supplier_collection (TAO_EC_ProxyPushSupplier_Collection*); 00113 00114 virtual ACE_Lock* create_consumer_lock (void); 00115 virtual void destroy_consumer_lock (ACE_Lock*); 00116 virtual ACE_Lock* create_supplier_lock (void); 00117 virtual void destroy_supplier_lock (ACE_Lock*); 00118 00119 virtual TAO_EC_ConsumerControl* 00120 create_consumer_control (TAO_EC_Event_Channel_Base*); 00121 virtual void 00122 destroy_consumer_control (TAO_EC_ConsumerControl*); 00123 virtual TAO_EC_SupplierControl* 00124 create_supplier_control (TAO_EC_Event_Channel_Base*); 00125 virtual void 00126 destroy_supplier_control (TAO_EC_SupplierControl*); 00127 00128 /// Accessors to consumer collection flags 00129 int consumer_collection (void) const; 00130 00131 /// Accessors to supplier collection flags 00132 int supplier_collection (void) const; 00133 00134 /// Accessors to supplier filtering flags 00135 int supplier_filtering (void) const; 00136 00137 /// Accessor to ORBid 00138 const ACE_CString& orb_id (void) const; 00139 protected: 00140 00141 /// Helper for agrument parsing. Prints out an error message about 00142 /// unsupported option value. 00143 void unsupported_option_value (const char * option_name, 00144 const char * option_value); 00145 00146 protected: 00147 /// Several flags to control the kind of object created. 00148 int dispatching_; 00149 int filtering_; 00150 int supplier_filtering_; 00151 int timeout_; 00152 int observer_; 00153 int scheduling_; 00154 int consumer_collection_; 00155 int supplier_collection_; 00156 int consumer_lock_; 00157 int supplier_lock_; 00158 00159 /// The MT dispatching priority has several arguments that could be 00160 /// controlled here... 00161 int dispatching_threads_; 00162 int dispatching_threads_flags_; 00163 int dispatching_threads_priority_; 00164 int dispatching_threads_force_active_; 00165 ACE_CString queue_full_service_object_name_; 00166 TAO_EC_Queue_Full_Service_Object* find_service_object (const char* wanted, 00167 const char* fallback); 00168 00169 /// Use this ORB to locate global resources. 00170 ACE_CString orbid_; 00171 00172 /// The consumer and supplier control policies. 00173 int consumer_control_; 00174 int supplier_control_; 00175 00176 /// The consumer and supplier control periods in usecs 00177 int consumer_control_period_; 00178 int supplier_control_period_; 00179 00180 /// The consumer control timeout in usecs 00181 ACE_Time_Value consumer_control_timeout_; 00182 00183 /// The supplier control timeout in usecs 00184 ACE_Time_Value supplier_control_timeout_; 00185 00186 /// Validate the connection to consumer on connect 00187 int consumer_validate_connection_; 00188 }; 00189 00190 TAO_END_VERSIONED_NAMESPACE_DECL 00191 00192 #if defined (__ACE_INLINE__) 00193 #include "orbsvcs/Event/EC_Default_Factory.i" 00194 #endif /* __ACE_INLINE__ */ 00195 00196 ACE_STATIC_SVC_DECLARE (TAO_EC_Default_Factory) 00197 ACE_FACTORY_DECLARE (TAO_RTEvent_Serv, TAO_EC_Default_Factory) 00198 00199 #include /**/ "ace/post.h" 00200 00201 #endif /* TAO_EC_DEFAULT_FACTORY_H */