EC_Default_Factory.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 /**
00003  *  @file   EC_Default_Factory.h
00004  *
00005  *  $Id: EC_Default_Factory.h 75279 2006-11-08 19:17:49Z cleeland $
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   /// Flags used by thread-based dispatching strategies.
00160   int dispatching_threads_;     //! number of threads; may be ignored depending on strategy; default: TAO_EC_DEFAULT_DISPATCHING_THREADS
00161   int dispatching_threads_flags_; //! flags for thread creation; default: TAO_EC_DEFAULT_DISPATCHING_THREADS_FLAGS
00162   int dispatching_threads_priority_; //! dispatching thread priority; default: TAO_EC_DEFAULT_DISPATCHING_THREADS_PRIORITY
00163   int dispatching_threads_force_active_; //! create threads with innocuous default values if creation with requested values fails
00164   ACE_CString queue_full_service_object_name_; //! name of ACE_Service_Object which should be invoked when output queue becomes full
00165   TAO_EC_Queue_Full_Service_Object* find_service_object (const char* wanted,
00166                                                          const char* fallback);
00167 
00168   /// Use this ORB to locate global resources.
00169   ACE_CString orbid_;
00170 
00171   /// The consumer and supplier control policies.
00172   int consumer_control_;
00173   int supplier_control_;
00174 
00175   /// The consumer and supplier control periods in usecs
00176   int consumer_control_period_;
00177   int supplier_control_period_;
00178 
00179   /// The consumer control timeout in usecs
00180   ACE_Time_Value consumer_control_timeout_;
00181 
00182   /// The supplier control timeout in usecs
00183   ACE_Time_Value supplier_control_timeout_;
00184 
00185   /// Validate the connection to consumer on connect
00186   int consumer_validate_connection_;
00187 };
00188 
00189 TAO_END_VERSIONED_NAMESPACE_DECL
00190 
00191 #if defined (__ACE_INLINE__)
00192 #include "orbsvcs/Event/EC_Default_Factory.inl"
00193 #endif /* __ACE_INLINE__ */
00194 
00195 ACE_STATIC_SVC_DECLARE (TAO_EC_Default_Factory)
00196 ACE_FACTORY_DECLARE (TAO_RTEvent_Serv, TAO_EC_Default_Factory)
00197 
00198 #include /**/ "ace/post.h"
00199 
00200 #endif /* TAO_EC_DEFAULT_FACTORY_H */

Generated on Tue Feb 2 17:44:05 2010 for TAO_RTEvent by  doxygen 1.4.7