00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CEC_Dispatching.h 00006 * 00007 * CEC_Dispatching.h,v 1.17 2006/03/15 07:52:21 jtc Exp 00008 * 00009 * @author Carlos O'Ryan (coryan@cs.wustl.edu) 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef TAO_CEC_DISPATCHING_H 00015 #define TAO_CEC_DISPATCHING_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include "orbsvcs/CosEventCommC.h" 00020 00021 #include "orbsvcs/CosEvent/event_serv_export.h" 00022 00023 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00024 # pragma once 00025 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 class TAO_CEC_ProxyPushSupplier; 00030 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL) 00031 class TAO_CEC_TypedEvent; 00032 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */ 00033 00034 /** 00035 * @class TAO_CEC_Dispatching 00036 * 00037 * @brief Define the interface for the dispatching strategies. 00038 * 00039 * The EC may be configured with different dispatching strategies, 00040 * for instance, it can use a pool of threads to dispatch the 00041 * events, or a set of queues with threads at different priorities 00042 * for each queue or can simply push the event to the consumer in 00043 * FIFO order. 00044 */ 00045 class TAO_Event_Serv_Export TAO_CEC_Dispatching 00046 { 00047 public: 00048 /// destructor... 00049 virtual ~TAO_CEC_Dispatching (void); 00050 00051 /// Initialize all the data structures, activate any internal threads, 00052 /// etc. 00053 virtual void activate (void) = 0; 00054 00055 /** 00056 * Deactivate any internal threads and cleanup internal data 00057 * structures, it should only return once the threads have finished 00058 * their jobs. 00059 */ 00060 virtual void shutdown (void) = 0; 00061 00062 /// The consumer represented by <proxy> should receive <event>. 00063 virtual void push (TAO_CEC_ProxyPushSupplier *proxy, 00064 const CORBA::Any &event 00065 ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; 00066 virtual void push_nocopy (TAO_CEC_ProxyPushSupplier *proxy, 00067 CORBA::Any &event 00068 ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; 00069 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL) 00070 virtual void invoke (TAO_CEC_ProxyPushSupplier *proxy, 00071 const TAO_CEC_TypedEvent &typed_event 00072 ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; 00073 virtual void invoke_nocopy (TAO_CEC_ProxyPushSupplier *proxy, 00074 TAO_CEC_TypedEvent &typed_event 00075 ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; 00076 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */ 00077 }; 00078 00079 // **************************************************************** 00080 00081 /** 00082 * @class TAO_CEC_Reactive_Dispatching 00083 * 00084 * @brief Dispatch using the caller thread. 00085 * 00086 * The events are dispatched in FIFO ordering, using the invoking 00087 * thread to push the event to the consumer. 00088 */ 00089 class TAO_Event_Serv_Export TAO_CEC_Reactive_Dispatching : public TAO_CEC_Dispatching 00090 { 00091 public: 00092 /// The scheduler is used to find the range of priorities and similar 00093 /// info. 00094 TAO_CEC_Reactive_Dispatching (void); 00095 00096 // = The CEC_Dispatching methods. 00097 virtual void activate (void); 00098 virtual void shutdown (void); 00099 virtual void push (TAO_CEC_ProxyPushSupplier *proxy, 00100 const CORBA::Any &event 00101 ACE_ENV_ARG_DECL_WITH_DEFAULTS); 00102 virtual void push_nocopy (TAO_CEC_ProxyPushSupplier *proxy, 00103 CORBA::Any &event 00104 ACE_ENV_ARG_DECL_WITH_DEFAULTS); 00105 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL) 00106 virtual void invoke (TAO_CEC_ProxyPushSupplier *proxy, 00107 const TAO_CEC_TypedEvent &typed_event 00108 ACE_ENV_ARG_DECL_WITH_DEFAULTS); 00109 virtual void invoke_nocopy (TAO_CEC_ProxyPushSupplier *proxy, 00110 TAO_CEC_TypedEvent &typed_event 00111 ACE_ENV_ARG_DECL_WITH_DEFAULTS); 00112 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */ 00113 }; 00114 00115 TAO_END_VERSIONED_NAMESPACE_DECL 00116 00117 #include /**/ "ace/post.h" 00118 00119 #endif /* TAO_CEC_DISPATCHING_H */