00001 // -*- C++ -*- 00002 /** 00003 * @file EC_Per_Supplier_Filter.h 00004 * 00005 * $Id: EC_Per_Supplier_Filter.h 76589 2007-01-25 18:04:11Z elliott_c $ 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_PER_SUPPLIER_FILTER_H 00016 #define TAO_EC_PER_SUPPLIER_FILTER_H 00017 #include /**/ "ace/pre.h" 00018 00019 #include "orbsvcs/Event/EC_Supplier_Filter.h" 00020 #include "orbsvcs/Event/EC_Supplier_Filter_Builder.h" 00021 #include /**/ "orbsvcs/Event/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 template<class PROXY> class TAO_ESF_Proxy_Collection; 00030 class TAO_EC_Event_Channel_Base; 00031 00032 /** 00033 * @class TAO_EC_Per_Supplier_Filter 00034 * 00035 * @brief Filter the events on each supplier. 00036 * 00037 * This is a filtering strategy for the suppliers. In this 00038 * particular case we keep a collection of the consumers that 00039 * could potentially be interested in any event generated by a 00040 * particular supplier. 00041 * This minimizes the amount of consumers touched by the EC when 00042 * dispatching an event. 00043 */ 00044 class TAO_RTEvent_Serv_Export TAO_EC_Per_Supplier_Filter : public TAO_EC_Supplier_Filter 00045 { 00046 public: 00047 /// Constructor 00048 TAO_EC_Per_Supplier_Filter (TAO_EC_Event_Channel_Base* ec); 00049 00050 /// Destructor 00051 virtual ~TAO_EC_Per_Supplier_Filter (void); 00052 00053 // = The TAO_EC_Supplier_Filter methods. 00054 virtual void bind (TAO_EC_ProxyPushConsumer* consumer); 00055 virtual void unbind (TAO_EC_ProxyPushConsumer* consumer); 00056 virtual void connected (TAO_EC_ProxyPushSupplier* supplier); 00057 virtual void reconnected (TAO_EC_ProxyPushSupplier* supplier); 00058 virtual void disconnected (TAO_EC_ProxyPushSupplier* supplier); 00059 virtual void shutdown (void); 00060 virtual void push (const RtecEventComm::EventSet& event, 00061 TAO_EC_ProxyPushConsumer *consumer); 00062 virtual void push_scheduled_event (RtecEventComm::EventSet &event, 00063 const TAO_EC_QOS_Info &event_info); 00064 virtual CORBA::ULong _decr_refcnt (void); 00065 virtual CORBA::ULong _incr_refcnt (void); 00066 00067 private: 00068 /// The event channel, used to locate the set of consumers. 00069 TAO_EC_Event_Channel_Base *event_channel_; 00070 00071 /// The proxy for the supplier we are bound to. 00072 TAO_EC_ProxyPushConsumer* consumer_; 00073 00074 /// Keep the collection of proxies for the consumers that may be 00075 /// interested in our events. 00076 TAO_ESF_Proxy_Collection<TAO_EC_ProxyPushSupplier>* collection_; 00077 00078 /// Reference counting 00079 CORBA::ULong refcnt_; 00080 00081 /// Locking 00082 TAO_SYNCH_MUTEX lock_; 00083 }; 00084 00085 // **************************************************************** 00086 00087 /** 00088 * @class TAO_EC_Per_Supplier_Filter_Builder 00089 * 00090 * @brief Create Per_Supplier_Filter objects 00091 * 00092 */ 00093 class TAO_RTEvent_Serv_Export TAO_EC_Per_Supplier_Filter_Builder : public TAO_EC_Supplier_Filter_Builder 00094 { 00095 public: 00096 /// constructor.... 00097 TAO_EC_Per_Supplier_Filter_Builder (TAO_EC_Event_Channel_Base* ec); 00098 00099 // = The TAO_EC_Supplier_Filter_Builder methods... 00100 virtual TAO_EC_Supplier_Filter* 00101 create (RtecEventChannelAdmin::SupplierQOS& qos); 00102 virtual void 00103 destroy (TAO_EC_Supplier_Filter *filter); 00104 00105 private: 00106 /// The event channel 00107 TAO_EC_Event_Channel_Base* event_channel_; 00108 }; 00109 00110 TAO_END_VERSIONED_NAMESPACE_DECL 00111 00112 #if defined (__ACE_INLINE__) 00113 #include "orbsvcs/Event/EC_Per_Supplier_Filter.inl" 00114 #endif /* __ACE_INLINE__ */ 00115 00116 #include /**/ "ace/post.h" 00117 #endif /* TAO_EC_PER_SUPPLIER_FILTER_H */