00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TAO_CEC_PROXYPULLSUPPLIER_H
00015 #define TAO_CEC_PROXYPULLSUPPLIER_H
00016
00017 #include "ace/pre.h"
00018
00019 #include "orbsvcs/CosEventChannelAdminS.h"
00020
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif
00024
00025 #include "ace/Message_Queue.h"
00026 #include "ace/Condition_Thread_Mutex.h"
00027 #include "ace/Unbounded_Queue.h"
00028
00029 #include "orbsvcs/CosEvent/event_serv_export.h"
00030
00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00032
00033 class TAO_CEC_EventChannel;
00034 class TAO_CEC_ProxyPullConsumer;
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 class TAO_Event_Serv_Export TAO_CEC_ProxyPullSupplier : public POA_CosEventChannelAdmin::ProxyPullSupplier
00054 {
00055 public:
00056 typedef CosEventChannelAdmin::ProxyPullSupplier_ptr _ptr_type;
00057 typedef CosEventChannelAdmin::ProxyPullSupplier_var _var_type;
00058
00059
00060 TAO_CEC_ProxyPullSupplier (TAO_CEC_EventChannel* event_channel,
00061 const ACE_Time_Value &timeout);
00062
00063
00064 virtual ~TAO_CEC_ProxyPullSupplier (void);
00065
00066
00067 virtual void activate (
00068 CosEventChannelAdmin::ProxyPullSupplier_ptr &activated_proxy);
00069
00070
00071 virtual void deactivate (void);
00072
00073
00074 CORBA::Boolean is_connected (void) const;
00075
00076
00077
00078
00079
00080
00081
00082 CosEventComm::PullConsumer_ptr consumer (void) const;
00083
00084
00085 virtual void shutdown (void);
00086
00087
00088
00089
00090
00091
00092 CORBA::Boolean consumer_non_existent (CORBA::Boolean_out disconnected);
00093
00094
00095 void push (const CORBA::Any &event);
00096
00097
00098 virtual void connect_pull_consumer (
00099 CosEventComm::PullConsumer_ptr pull_consumer);
00100 virtual CORBA::Any * pull (void);
00101 virtual CORBA::Any * try_pull (CORBA::Boolean_out has_event);
00102 virtual void disconnect_pull_supplier (void);
00103
00104
00105 CORBA::ULong _incr_refcnt (void);
00106 CORBA::ULong _decr_refcnt (void);
00107
00108
00109 virtual PortableServer::POA_ptr _default_POA (void);
00110 virtual void _add_ref (void);
00111 virtual void _remove_ref (void);
00112
00113 protected:
00114
00115
00116 void consumer (CosEventComm::PullConsumer_ptr consumer);
00117 void consumer_i (CosEventComm::PullConsumer_ptr consumer);
00118
00119
00120 CORBA::Boolean is_connected_i (void) const;
00121
00122
00123 void cleanup_i (void);
00124
00125
00126
00127 CosEventComm::PullConsumer_ptr apply_policy
00128 (CosEventComm::PullConsumer_ptr c);
00129
00130 private:
00131
00132 TAO_CEC_EventChannel* event_channel_;
00133
00134 ACE_Time_Value timeout_;
00135
00136
00137 ACE_Lock* lock_;
00138
00139
00140 CORBA::ULong refcount_;
00141
00142
00143
00144 CosEventComm::PullConsumer_var consumer_;
00145
00146
00147 CosEventComm::PullConsumer_var nopolicy_consumer_;
00148
00149
00150
00151 int connected_;
00152
00153
00154 PortableServer::POA_var default_POA_;
00155
00156
00157 TAO_SYNCH_MUTEX queue_lock_;
00158 TAO_SYNCH_CONDITION wait_not_empty_;
00159 ACE_Unbounded_Queue<CORBA::Any> queue_;
00160 };
00161
00162 TAO_END_VERSIONED_NAMESPACE_DECL
00163
00164 #if defined (__ACE_INLINE__)
00165 #include "orbsvcs/CosEvent/CEC_ProxyPullSupplier.inl"
00166 #endif
00167
00168 #include "ace/post.h"
00169
00170 #endif