CEC_ProxyPullConsumer.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   CEC_ProxyPullConsumer.h
00006  *
00007  *  CEC_ProxyPullConsumer.h,v 1.19 2006/03/15 07:52:21 jtc Exp
00008  *
00009  *  @author Carlos O'Ryan (coryan@cs.wustl.edu)
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_CEC_PROXYPULLCONSUMER_H
00014 #define TAO_CEC_PROXYPULLCONSUMER_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "orbsvcs/CosEventChannelAdminS.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "orbsvcs/ESF/ESF_Worker.h"
00025 #include "orbsvcs/CosEvent/event_serv_export.h"
00026 
00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 class TAO_CEC_EventChannel;
00030 class TAO_CEC_Dispatching;
00031 class TAO_CEC_ProxyPullSupplier;
00032 
00033 /**
00034  * @class TAO_CEC_ProxyPullConsumer
00035  *
00036  * @brief ProxyPullConsumer
00037  *
00038  * Implement the CosEventChannelAdmin::ProxyPullConsumer interface,
00039  * remember that this class is used to communicate with a
00040  * PullSupplier, so, in effect, this is the ambassador for a
00041  * supplier inside the event channel.
00042  * = MEMORY MANAGMENT
00043  * The object commits suicide when disconnect_pull_consumer() is
00044  * called.
00045  */
00046 class TAO_Event_Serv_Export TAO_CEC_ProxyPullConsumer : public POA_CosEventChannelAdmin::ProxyPullConsumer
00047 {
00048 public:
00049   typedef CosEventChannelAdmin::ProxyPullConsumer_ptr _ptr_type;
00050   typedef CosEventChannelAdmin::ProxyPullConsumer_var _var_type;
00051 
00052   /// constructor...
00053   TAO_CEC_ProxyPullConsumer (TAO_CEC_EventChannel* event_channel);
00054 
00055   /// destructor...
00056   virtual ~TAO_CEC_ProxyPullConsumer (void);
00057 
00058   /// Activate in the POA
00059   virtual void  activate (
00060       CosEventChannelAdmin::ProxyPullConsumer_ptr &activated_proxy
00061       ACE_ENV_ARG_DECL)
00062     ACE_THROW_SPEC ((CORBA::SystemException));
00063 
00064   /// Deactivate from the POA
00065   virtual void deactivate (ACE_ENV_SINGLE_ARG_DECL)
00066     ACE_THROW_SPEC ((CORBA::SystemException));
00067 
00068   /// Return 0 if no supplier is connected...
00069   CORBA::Boolean is_connected (void) const;
00070 
00071   /// Return the consumer object reference. It returns nil() if it has
00072   /// not connected yet.
00073   CosEventComm::PullSupplier_ptr supplier (void) const;
00074 
00075   /// Pulls from the supplier, verifies that it is connected.
00076   CORBA::Any* try_pull_from_supplier (CORBA::Boolean_out has_event
00077                                       ACE_ENV_ARG_DECL);
00078   CORBA::Any* pull_from_supplier (ACE_ENV_SINGLE_ARG_DECL);
00079 
00080   /**
00081    * Invoke the _non_existent() pseudo-operation on the supplier. If
00082    * it is disconnected then it returns true and sets the
00083    * <disconnected> flag.
00084    */
00085   CORBA::Boolean supplier_non_existent (CORBA::Boolean_out disconnected
00086                                         ACE_ENV_ARG_DECL);
00087 
00088   /// The event channel is shutting down
00089   virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED);
00090 
00091   /// Increment and decrement the reference count.
00092   CORBA::ULong _incr_refcnt (void);
00093   CORBA::ULong _decr_refcnt (void);
00094 
00095   // = The CosEventChannelAdmin::ProxyPullConsumer methods...
00096   virtual void connect_pull_supplier (
00097                 CosEventComm::PullSupplier_ptr pull_supplier
00098                 ACE_ENV_ARG_DECL_NOT_USED)
00099       ACE_THROW_SPEC ((CORBA::SystemException,
00100                        CosEventChannelAdmin::AlreadyConnected));
00101   virtual void disconnect_pull_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00102       ACE_THROW_SPEC ((CORBA::SystemException));
00103 
00104   // = The Servant methods
00105   virtual PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL);
00106   virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
00107   virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
00108 
00109 protected:
00110   /// Set the supplier, used by some implementations to change the
00111   /// policies used when invoking operations on the supplier.
00112   void supplier (CosEventComm::PullSupplier_ptr supplier);
00113   void supplier_i (CosEventComm::PullSupplier_ptr supplier);
00114 
00115   /// The private version (without locking) of is_connected().
00116   CORBA::Boolean is_connected_i (void) const;
00117 
00118   /// Release the supplier
00119   void cleanup_i (void);
00120 
00121 private:
00122   /// The supplier admin, used for activation and memory managment.
00123   TAO_CEC_EventChannel* event_channel_;
00124 
00125   /// The locking strategy.
00126   ACE_Lock* lock_;
00127 
00128   /// The reference count.
00129   CORBA::ULong refcount_;
00130 
00131   /// The supplier....
00132   CosEventComm::PullSupplier_var supplier_;
00133 
00134   /// Store the default POA.
00135   PortableServer::POA_var default_POA_;
00136 };
00137 
00138 TAO_END_VERSIONED_NAMESPACE_DECL
00139 
00140 #if defined (__ACE_INLINE__)
00141 #include "orbsvcs/CosEvent/CEC_ProxyPullConsumer.i"
00142 #endif /* __ACE_INLINE__ */
00143 
00144 #include /**/ "ace/post.h"
00145 
00146 #endif /* TAO_CEC_PROXYPULLCONSUMER_H */

Generated on Thu Nov 9 13:18:17 2006 for TAO_CosEvent by doxygen 1.3.6