00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CEC_Dispatching.h 00006 * 00007 * $Id: CEC_Dispatching.h 76589 2007-01-25 18:04:11Z elliott_c $ 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) = 0; 00065 virtual void push_nocopy (TAO_CEC_ProxyPushSupplier *proxy, 00066 CORBA::Any &event) = 0; 00067 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL) 00068 virtual void invoke (TAO_CEC_ProxyPushSupplier *proxy, 00069 const TAO_CEC_TypedEvent &typed_event) = 0; 00070 virtual void invoke_nocopy (TAO_CEC_ProxyPushSupplier *proxy, 00071 TAO_CEC_TypedEvent &typed_event) = 0; 00072 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */ 00073 }; 00074 00075 // **************************************************************** 00076 00077 /** 00078 * @class TAO_CEC_Reactive_Dispatching 00079 * 00080 * @brief Dispatch using the caller thread. 00081 * 00082 * The events are dispatched in FIFO ordering, using the invoking 00083 * thread to push the event to the consumer. 00084 */ 00085 class TAO_Event_Serv_Export TAO_CEC_Reactive_Dispatching : public TAO_CEC_Dispatching 00086 { 00087 public: 00088 /// The scheduler is used to find the range of priorities and similar 00089 /// info. 00090 TAO_CEC_Reactive_Dispatching (void); 00091 00092 // = The CEC_Dispatching methods. 00093 virtual void activate (void); 00094 virtual void shutdown (void); 00095 virtual void push (TAO_CEC_ProxyPushSupplier *proxy, 00096 const CORBA::Any &event); 00097 virtual void push_nocopy (TAO_CEC_ProxyPushSupplier *proxy, 00098 CORBA::Any &event); 00099 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL) 00100 virtual void invoke (TAO_CEC_ProxyPushSupplier *proxy, 00101 const TAO_CEC_TypedEvent &typed_event); 00102 virtual void invoke_nocopy (TAO_CEC_ProxyPushSupplier *proxy, 00103 TAO_CEC_TypedEvent &typed_event); 00104 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */ 00105 }; 00106 00107 TAO_END_VERSIONED_NAMESPACE_DECL 00108 00109 #include /**/ "ace/post.h" 00110 00111 #endif /* TAO_CEC_DISPATCHING_H */