00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CEC_TypedConsumerAdmin.h 00006 * 00007 * $Id: CEC_TypedConsumerAdmin.h 77001 2007-02-12 07:54:49Z johnnyw $ 00008 * 00009 * @author Jon Astle (jon@astle45.fsnet.co.uk) 00010 * 00011 * Based on the untyped version by Carlos O'Ryan (coryan@cs.wustl.edu) 00012 */ 00013 //============================================================================= 00014 00015 00016 #ifndef TAO_CEC_TYPEDCONSUMERADMIN_H_ 00017 #define TAO_CEC_TYPEDCONSUMERADMIN_H_ 00018 00019 #include /**/ "ace/pre.h" 00020 00021 #include "orbsvcs/CosTypedEventChannelAdminS.h" 00022 00023 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00024 #pragma once 00025 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00026 00027 #include "orbsvcs/ESF/ESF_Proxy_Admin.h" 00028 00029 #include "orbsvcs/CosEvent/CEC_ProxyPushSupplier.h" 00030 #include "orbsvcs/CosEvent/CEC_TypedEvent.h" 00031 00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00033 00034 class TAO_CEC_TypedEventChannel; 00035 00036 //Class TAO_CEC_TypedConsumerAdmin 00037 class TAO_Event_Serv_Export TAO_CEC_TypedConsumerAdmin 00038 : public POA_CosTypedEventChannelAdmin::TypedConsumerAdmin 00039 { 00040 public: 00041 00042 // Constructor 00043 TAO_CEC_TypedConsumerAdmin (TAO_CEC_TypedEventChannel* typed_event_channel); 00044 00045 // Destructor 00046 virtual ~TAO_CEC_TypedConsumerAdmin (void); 00047 00048 /// For each elements call <worker->work()>. 00049 void for_each (TAO_ESF_Worker<TAO_CEC_ProxyPushSupplier> *worker); 00050 00051 /// Invoke the typed event on all the consumers 00052 virtual void invoke (const TAO_CEC_TypedEvent& typed_event); 00053 00054 /// Used to inform the EC that a Supplier has connected or 00055 /// disconnected from it. 00056 virtual void connected (TAO_CEC_ProxyPushSupplier*); 00057 virtual void reconnected (TAO_CEC_ProxyPushSupplier*); 00058 virtual void disconnected (TAO_CEC_ProxyPushSupplier*); 00059 00060 /// The typed event channel is shutting down, inform all the consumers of 00061 /// this 00062 virtual void shutdown (void); 00063 00064 // = The CosTypedEventChannelAdmin::TypedConsumerAdmin methods... 00065 virtual CosEventChannelAdmin::ProxyPushSupplier_ptr 00066 obtain_typed_push_supplier (const char * uses_interface); 00067 virtual CosTypedEventChannelAdmin::TypedProxyPullSupplier_ptr 00068 obtain_typed_pull_supplier (const char * supported_interface); 00069 00070 // = The CosEventChannelAdmin::ConsumerAdmin methods... 00071 virtual CosEventChannelAdmin::ProxyPushSupplier_ptr 00072 obtain_push_supplier (void); 00073 00074 virtual CosEventChannelAdmin::ProxyPullSupplier_ptr 00075 obtain_pull_supplier (void); 00076 00077 // = The PortableServer::ServantBase methods 00078 virtual PortableServer::POA_ptr _default_POA (void); 00079 00080 private: 00081 /// The Event Channel we belong to 00082 TAO_CEC_TypedEventChannel *typed_event_channel_; 00083 00084 /// Store the default POA. 00085 PortableServer::POA_var default_POA_; 00086 00087 /// Implement the push side of this class 00088 TAO_ESF_Proxy_Admin<TAO_CEC_TypedEventChannel,TAO_CEC_ProxyPushSupplier,CosEventChannelAdmin::ProxyPushSupplier> typed_push_admin_; 00089 }; 00090 00091 // **************************************************************** 00092 00093 class TAO_CEC_Propagate_Typed_Event : public TAO_ESF_Worker<TAO_CEC_ProxyPushSupplier> 00094 { 00095 public: 00096 TAO_CEC_Propagate_Typed_Event (const TAO_CEC_TypedEvent& typed_event, 00097 TAO_CEC_TypedEventChannel* typed_event_channel); 00098 00099 void work (TAO_CEC_ProxyPushSupplier *supplier); 00100 00101 private: 00102 /// The typed event 00103 const TAO_CEC_TypedEvent typed_event_; 00104 00105 /// The typed EC 00106 TAO_CEC_TypedEventChannel* typed_event_channel_; 00107 }; 00108 00109 TAO_END_VERSIONED_NAMESPACE_DECL 00110 00111 #if defined (__ACE_INLINE__) 00112 #include "orbsvcs/CosEvent/CEC_TypedConsumerAdmin.inl" 00113 #endif /* __ACE_INLINE__ */ 00114 00115 #include /**/ "ace/post.h" 00116 #endif /* TAO_CEC_TYPEDCONSUMERADMIN_H_ */