CEC_ProxyPushSupplier.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   CEC_ProxyPushSupplier.h
00006  *
00007  *  CEC_ProxyPushSupplier.h,v 1.23 2006/03/15 07:52:21 jtc Exp
00008  *
00009  *  @author Carlos O'Ryan (coryan@cs.wustl.edu)
00010  *  @author Jon Astle (jon@astle45.fsnet.co.uk)
00011  */
00012 //=============================================================================
00013 
00014 
00015 #ifndef TAO_CEC_PROXYPUSHSUPPLIER_H
00016 #define TAO_CEC_PROXYPUSHSUPPLIER_H
00017 
00018 #include /**/ "ace/pre.h"
00019 
00020 #include "orbsvcs/CosEventChannelAdminS.h"
00021 
00022 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00023 #include "orbsvcs/CosTypedEventChannelAdminS.h"
00024 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00025 
00026 #include "orbsvcs/CosEvent/event_serv_export.h"
00027 
00028 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00029 # pragma once
00030 #endif /* ACE_LACKS_PRAGMA_ONCE */
00031 
00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00033 
00034 class TAO_CEC_EventChannel;
00035 class TAO_CEC_ProxyPushConsumer;
00036 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00037 class TAO_CEC_TypedEvent;
00038 class TAO_CEC_TypedEventChannel;
00039 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00040 
00041 /**
00042  * @class TAO_CEC_ProxyPushSupplier
00043  *
00044  * @brief ProxyPushSupplier
00045  *
00046  * Implement the CosEventChannelAdmin::ProxyPushSupplier interface,
00047  * remember that this class is used to communicate with a
00048  * PushConsumer, so, in effect, this is the ambassador for a
00049  * consumer inside the event channel.
00050  * = MEMORY MANAGMENT
00051  * It does not assume ownership of the TAO_CEC_Dispatching object.
00052  * It makes a copy of the ConsumerQOS and the consumer object
00053  * reference.
00054  * = LOCKING
00055  * Locking is strategized, the event channel acts as a factory for
00056  * the locking strategies.
00057  */
00058 class TAO_Event_Serv_Export TAO_CEC_ProxyPushSupplier : public POA_CosEventChannelAdmin::ProxyPushSupplier
00059 {
00060 public:
00061   typedef CosEventChannelAdmin::ProxyPushSupplier_ptr _ptr_type;
00062   typedef CosEventChannelAdmin::ProxyPushSupplier_var _var_type;
00063 
00064   /// constructor...
00065   TAO_CEC_ProxyPushSupplier (TAO_CEC_EventChannel* event_channel);
00066 
00067   /// typed ec constructor
00068 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00069   TAO_CEC_ProxyPushSupplier (TAO_CEC_TypedEventChannel* typed_event_channel);
00070 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00071 
00072   /// destructor...
00073   virtual ~TAO_CEC_ProxyPushSupplier (void);
00074 
00075   /// Activate in the POA
00076   virtual void activate (
00077       CosEventChannelAdmin::ProxyPushSupplier_ptr &
00078       ACE_ENV_ARG_DECL)
00079     ACE_THROW_SPEC ((CORBA::SystemException));
00080 
00081   /// Deactivate from the POA
00082   virtual void deactivate (ACE_ENV_SINGLE_ARG_DECL)
00083     ACE_THROW_SPEC ((CORBA::SystemException));
00084 
00085   /// Return 0 if no consumer is connected...
00086   CORBA::Boolean is_connected (void) const;
00087 
00088   /**
00089    * Return the consumer object reference. It returns nil() if it has
00090    * not connected yet.
00091    * NOTE: This method does not return a new reference!!! Doing so
00092    * will increase the locking overhead on the critical path.
00093    */
00094   CosEventComm::PushConsumer_ptr consumer (void) const;
00095 
00096   /// The event channel is shutting down
00097   virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL);
00098 
00099   /// Internal methods to push an event to each consumer.
00100   virtual void push (const CORBA::Any &event
00101                      ACE_ENV_ARG_DECL);
00102   virtual void push_nocopy (CORBA::Any &event
00103                             ACE_ENV_ARG_DECL);
00104   /// Internal methods to invoke a typed event to each consumer.
00105 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00106   virtual void invoke (const TAO_CEC_TypedEvent& typed_event
00107                        ACE_ENV_ARG_DECL);
00108 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00109 
00110   /// Pushes to the consumer, verifies that it is connected.
00111   void push_to_consumer (const CORBA::Any &event
00112                          ACE_ENV_ARG_DECL);
00113   void reactive_push_to_consumer (const CORBA::Any &event
00114                                   ACE_ENV_ARG_DECL);
00115 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00116   void invoke_to_consumer (const TAO_CEC_TypedEvent &typed_event
00117                            ACE_ENV_ARG_DECL);
00118   void reactive_invoke_to_consumer (const TAO_CEC_TypedEvent &typed_event
00119                                     ACE_ENV_ARG_DECL);
00120 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00121 
00122   /**
00123    * Invoke the _non_existent() pseudo-operation on the consumer. If
00124    * it is disconnected then it returns true and sets the
00125    * <disconnected> flag.
00126    */
00127   CORBA::Boolean consumer_non_existent (CORBA::Boolean_out disconnected
00128                                         ACE_ENV_ARG_DECL);
00129 
00130   // = The CosEventChannelAdmin::ProxyPushSupplier methods...
00131   virtual void connect_push_consumer (
00132                 CosEventComm::PushConsumer_ptr push_consumer
00133                 ACE_ENV_ARG_DECL_NOT_USED)
00134       ACE_THROW_SPEC ((CORBA::SystemException,
00135                        CosEventChannelAdmin::AlreadyConnected,
00136                        CosEventChannelAdmin::TypeError));
00137   virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00138       ACE_THROW_SPEC ((CORBA::SystemException));
00139 
00140   /// Increment and decrement the reference count.
00141   CORBA::ULong _incr_refcnt (void);
00142   CORBA::ULong _decr_refcnt (void);
00143 
00144   // = The Servant methods
00145   virtual PortableServer::POA_ptr _default_POA (ACE_ENV_SINGLE_ARG_DECL);
00146   virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL);
00147   virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL);
00148 
00149 protected:
00150   /// Set the consumer, used by some implementations to change the
00151   /// policies used when invoking operations on the consumer.
00152   void consumer (CosEventComm::PushConsumer_ptr consumer);
00153   void consumer_i (CosEventComm::PushConsumer_ptr consumer);
00154 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00155   void consumer (CosTypedEventComm::TypedPushConsumer_ptr typed_consumer);
00156   void consumer_i (CosTypedEventComm::TypedPushConsumer_ptr typed_consumer);
00157 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00158 
00159   /// The private version (without locking) of is_connected().
00160   CORBA::Boolean is_connected_i (void) const;
00161 
00162   /// Release the child and the consumer
00163   void cleanup_i (void);
00164 
00165 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00166   CORBA::Boolean is_typed_ec (void) const;
00167 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00168 
00169 private:
00170   /// The Event Channel that owns this object.
00171   TAO_CEC_EventChannel* event_channel_;
00172 
00173   /// The Typed Event Channel that owns this object.
00174 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00175   TAO_CEC_TypedEventChannel *typed_event_channel_;
00176 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00177 
00178   /// The locking strategy.
00179   ACE_Lock* lock_;
00180 
00181   /// The reference count.
00182   CORBA::ULong refcount_;
00183 
00184   /// The consumer....
00185   CosEventComm::PushConsumer_var consumer_;
00186 
00187 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00188   /// The typed consumer....
00189   CosTypedEventComm::TypedPushConsumer_var typed_consumer_;
00190 
00191   /// The consumer object returned from get_typed_consumer()
00192   CORBA::Object_var typed_consumer_obj_;
00193 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00194 
00195   /// Store the default POA.
00196   PortableServer::POA_var default_POA_;
00197 };
00198 
00199 TAO_END_VERSIONED_NAMESPACE_DECL
00200 
00201 #if defined (__ACE_INLINE__)
00202 #include "orbsvcs/CosEvent/CEC_ProxyPushSupplier.i"
00203 #endif /* __ACE_INLINE__ */
00204 
00205 #include /**/ "ace/post.h"
00206 
00207 #endif /* TAO_CEC_PROXYPUSHSUPPLIER_H */

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