CEC_ConsumerAdmin.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //=============================================================================
00003 /**
00004  *  @file   CEC_ConsumerAdmin.h
00005  *
00006  *  $Id: CEC_ConsumerAdmin.h 80714 2008-02-24 19:45:27Z johnnyw $
00007  *
00008  *  @author Carlos O'Ryan (coryan@cs.wustl.edu)
00009  */
00010 //=============================================================================
00011 
00012 
00013 #ifndef TAO_CEC_CONSUMERADMIN_H
00014 #define TAO_CEC_CONSUMERADMIN_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_Proxy_Admin.h"
00025 
00026 #include "orbsvcs/CosEvent/CEC_ProxyPushSupplier.h"
00027 #include "orbsvcs/CosEvent/CEC_ProxyPullSupplier.h"
00028 #include "orbsvcs/CosEvent/event_serv_export.h"
00029 
00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00031 
00032 class TAO_CEC_EventChannel;
00033 
00034 /**
00035  * @class TAO_CEC_ConsumerAdmin
00036  *
00037  * @brief ConsumerAdmin
00038  *
00039  * Implements the ConsumerAdmin interface, i.e. the factory for
00040  * ProxyPushSupplier objects.
00041  * = MEMORY MANAGMENT
00042  * It does not assume ownership of the TAO_CEC_EventChannel
00043  * object; but it *does* assume ownership of the
00044  * TAO_CEC_ProxyPushSupplier_Set object.
00045  * = LOCKING
00046  * No provisions for locking, access must be serialized
00047  * externally.
00048  * = TODO
00049  */
00050 class TAO_Event_Serv_Export TAO_CEC_ConsumerAdmin
00051   : public POA_CosEventChannelAdmin::ConsumerAdmin
00052 {
00053 public:
00054   /**
00055    * constructor. If <supplier_set> is nil then it builds one using
00056    * the @a event_channel argument.
00057    * In any case it assumes ownership.
00058    */
00059   TAO_CEC_ConsumerAdmin (TAO_CEC_EventChannel* event_channel);
00060 
00061   /// destructor...
00062   virtual ~TAO_CEC_ConsumerAdmin (void);
00063 
00064   /// For each elements call <worker->work()>.
00065   void for_each (TAO_ESF_Worker<TAO_CEC_ProxyPushSupplier> *worker);
00066   void for_each (TAO_ESF_Worker<TAO_CEC_ProxyPullSupplier> *worker);
00067 
00068   /// Push the event to all the consumers
00069   void push (const CORBA::Any &event);
00070 
00071   /// Used to inform the EC that a Supplier has connected or
00072   /// disconnected from it.
00073   virtual void connected (TAO_CEC_ProxyPushSupplier*);
00074   virtual void reconnected (TAO_CEC_ProxyPushSupplier*);
00075   virtual void disconnected (TAO_CEC_ProxyPushSupplier*);
00076   virtual void connected (TAO_CEC_ProxyPullSupplier*);
00077   virtual void reconnected (TAO_CEC_ProxyPullSupplier*);
00078   virtual void disconnected (TAO_CEC_ProxyPullSupplier*);
00079 
00080   /// The event channel is shutting down, inform all the consumers of
00081   /// this
00082   virtual void shutdown (void);
00083 
00084   // = The CosEventChannelAdmin::ConsumerAdmin methods...
00085   virtual CosEventChannelAdmin::ProxyPushSupplier_ptr
00086       obtain_push_supplier (void);
00087   virtual CosEventChannelAdmin::ProxyPullSupplier_ptr
00088       obtain_pull_supplier (void);
00089 
00090   // = The PortableServer::ServantBase methods
00091   virtual PortableServer::POA_ptr _default_POA (void);
00092 
00093 private:
00094   /// The Event Channel we belong to
00095   TAO_CEC_EventChannel *event_channel_;
00096 
00097   /// Store the default POA.
00098   PortableServer::POA_var default_POA_;
00099 
00100   /// Implement the push side of this class
00101   TAO_ESF_Proxy_Admin<TAO_CEC_EventChannel,TAO_CEC_ProxyPushSupplier,CosEventChannelAdmin::ProxyPushSupplier> push_admin_;
00102 
00103   /// Implement the pull side of this class
00104   TAO_ESF_Proxy_Admin<TAO_CEC_EventChannel,TAO_CEC_ProxyPullSupplier,CosEventChannelAdmin::ProxyPullSupplier> pull_admin_;
00105 
00106 };
00107 
00108 // ****************************************************************
00109 
00110 class TAO_CEC_Propagate_Event_Push : public TAO_ESF_Worker<TAO_CEC_ProxyPushSupplier>
00111 {
00112 public:
00113   TAO_CEC_Propagate_Event_Push (const CORBA::Any& event);
00114 
00115   void work (TAO_CEC_ProxyPushSupplier *supplier);
00116 
00117 private:
00118   /// The event
00119   CORBA::Any event_;
00120 };
00121 
00122 // ****************************************************************
00123 
00124 class TAO_CEC_Propagate_Event_Pull : public TAO_ESF_Worker<TAO_CEC_ProxyPullSupplier>
00125 {
00126 public:
00127   TAO_CEC_Propagate_Event_Pull (const CORBA::Any& event);
00128 
00129   void work (TAO_CEC_ProxyPullSupplier *supplier);
00130 
00131 private:
00132   /// The event
00133   CORBA::Any event_;
00134 };
00135 
00136 TAO_END_VERSIONED_NAMESPACE_DECL
00137 
00138 #if defined (__ACE_INLINE__)
00139 #include "orbsvcs/CosEvent/CEC_ConsumerAdmin.inl"
00140 #endif /* __ACE_INLINE__ */
00141 
00142 #include /**/ "ace/post.h"
00143 
00144 #endif /* TAO_CEC_CONSUMERADMIN_H */

Generated on Tue Feb 2 17:44:50 2010 for TAO_CosEvent by  doxygen 1.4.7