00001 // -*- C++ -*- 00002 00003 /** 00004 * @file ProxyConsumer.h 00005 * 00006 * $Id: ProxyConsumer.h 84703 2009-03-04 03:01:13Z mesnier_p $ 00007 * 00008 * @author Pradeep Gore <pradeep@oomworks.com> 00009 */ 00010 00011 #ifndef TAO_Notify_PROXYCONSUMER_H 00012 #define TAO_Notify_PROXYCONSUMER_H 00013 00014 #include /**/ "ace/pre.h" 00015 00016 #include "orbsvcs/Notify/notify_serv_export.h" 00017 #include "orbsvcs/Notify/Event.h" 00018 #include "orbsvcs/Notify/Proxy.h" 00019 #include "orbsvcs/Notify/SupplierAdmin.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "orbsvcs/CosEventChannelAdminC.h" 00026 00027 #include "ace/Auto_Ptr.h" 00028 00029 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00030 00031 class TAO_Notify_Supplier; 00032 00033 /** 00034 * @class TAO_Notify_ProxyConsumer 00035 * 00036 * @brief Base class for all types of ProxyConsumer implementations. 00037 * 00038 */ 00039 class TAO_Notify_Serv_Export TAO_Notify_ProxyConsumer 00040 : public virtual TAO_Notify_Proxy 00041 { 00042 public: 00043 typedef TAO_Notify_Refcountable_Guard_T<TAO_Notify_ProxyConsumer> Ptr; 00044 /// Constructor 00045 TAO_Notify_ProxyConsumer (void); 00046 00047 /// Destructor 00048 virtual ~TAO_Notify_ProxyConsumer (void); 00049 00050 /// init: overrides Topology_Object method 00051 virtual void init (TAO_Notify::Topology_Parent * topology_parent); 00052 00053 /// Connect 00054 void connect (TAO_Notify_Supplier* supplier); 00055 00056 /// Disconnect 00057 void disconnect (void); 00058 00059 /// Shutdown (TAO_Notify_Container_T method) 00060 virtual int shutdown (void); 00061 00062 /// Destroy this object. 00063 virtual void destroy (void); 00064 00065 /// Return true if connected 00066 bool is_connected (void) const; 00067 00068 /// The SA parent. 00069 TAO_Notify_SupplierAdmin& supplier_admin (void); 00070 00071 ACE_Time_Value last_ping() const; 00072 void last_ping(const ACE_Time_Value& tv); 00073 00074 protected: 00075 /// Access the Supplier 00076 TAO_Notify_Supplier* supplier (void); 00077 00078 /// Accept an event from the Supplier 00079 void push_i (TAO_Notify_Event * event); 00080 00081 /// Last time either push an event or validate connection 00082 /// via _non_exist call. 00083 ACE_Atomic_Op<TAO_SYNCH_MUTEX, ACE_Time_Value> last_ping_; 00084 00085 private: 00086 /// Is this part of a reliable channel 00087 bool supports_reliable_events () const; 00088 00089 ///= Data Members. 00090 /// The SA parent. 00091 TAO_Notify_SupplierAdmin::Ptr supplier_admin_; 00092 00093 /// The Supplier that we're connect to. 00094 ACE_Auto_Ptr<TAO_Notify_Supplier> supplier_; 00095 00096 /// Access our Peer. 00097 virtual TAO_Notify_Peer* peer (void); 00098 00099 }; 00100 00101 TAO_END_VERSIONED_NAMESPACE_DECL 00102 00103 #if defined (__ACE_INLINE__) 00104 #include "orbsvcs/Notify/ProxyConsumer.inl" 00105 #endif /* __ACE_INLINE__ */ 00106 00107 #include /**/ "ace/post.h" 00108 #endif /* TAO_Notify_PROXYCONSUMER_H */