Event_Manager.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 /**
00003  *  @file Event_Manager.h
00004  *
00005  *  Event_Manager.h,v 1.16 2006/03/14 06:14:34 jtc Exp
00006  *
00007  *  @author Pradeep Gore <pradeep@oomworks.com>
00008  *
00009  *
00010  */
00011 
00012 #ifndef TAO_Notify_EVENT_MANAGER_H
00013 #define TAO_Notify_EVENT_MANAGER_H
00014 
00015 #include /**/ "ace/pre.h"
00016 #include "ace/Auto_Ptr.h"
00017 
00018 #include "orbsvcs/Notify/Refcountable.h"
00019 
00020 #include "orbsvcs/Notify/notify_serv_export.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include "tao/orbconf.h"
00027 
00028 #include "ace/CORBA_macros.h"
00029 
00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00031 
00032 class TAO_Notify_ProxySupplier;
00033 class TAO_Notify_ProxyConsumer;
00034 class TAO_Notify_EventTypeSeq;
00035 
00036 template <class PROXY, class ACE_LOCK>
00037 class TAO_Notify_Event_Map_T;
00038 
00039 typedef TAO_Notify_Event_Map_T<TAO_Notify_ProxySupplier,
00040                                TAO_SYNCH_RW_MUTEX>
00041   TAO_Notify_Consumer_Map;
00042 
00043 typedef TAO_Notify_Event_Map_T<TAO_Notify_ProxyConsumer,
00044                                TAO_SYNCH_RW_MUTEX>
00045   TAO_Notify_Supplier_Map;
00046 
00047 namespace CORBA
00048 {
00049   class Environment;
00050 }
00051 
00052 /**
00053  * @class TAO_Notify_Event_Manager
00054  *
00055  * @brief A class that manages the Consumer and Supplier maps.
00056  *
00057  */
00058 class TAO_Notify_Serv_Export TAO_Notify_Event_Manager : public TAO_Notify_Refcountable
00059 {
00060 public:
00061   typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_Event_Manager > Ptr;
00062   /// Constuctor
00063   TAO_Notify_Event_Manager (void);
00064 
00065   /// Destructor
00066   virtual ~TAO_Notify_Event_Manager ();
00067 
00068   void release();
00069 
00070   /// Init
00071   void init (ACE_ENV_SINGLE_ARG_DECL);
00072 
00073   /// Init
00074   void shutdown (void);
00075 
00076   /// Connect ProxySupplier
00077   void connect (TAO_Notify_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL);
00078 
00079   /// Disconnect ProxySupplier
00080   void disconnect (TAO_Notify_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL);
00081 
00082   /// Connect ProxyConsumer
00083   void connect (TAO_Notify_ProxyConsumer* proxy_consumer ACE_ENV_ARG_DECL);
00084 
00085   /// Disconnect ProxyConsumer
00086   void disconnect (TAO_Notify_ProxyConsumer* proxy_consumer ACE_ENV_ARG_DECL);
00087 
00088   /// Map accessors.
00089   TAO_Notify_Consumer_Map& consumer_map (void);
00090   TAO_Notify_Supplier_Map& supplier_map (void);
00091 
00092   /// Offer change received on <proxy_consumer>.
00093   void offer_change (TAO_Notify_ProxyConsumer* proxy_consumer, const TAO_Notify_EventTypeSeq& added, const TAO_Notify_EventTypeSeq& removed ACE_ENV_ARG_DECL);
00094 
00095   /// Subscription change received on <proxy_supplier>.
00096   void subscription_change (TAO_Notify_ProxySupplier* proxy_supplier, const TAO_Notify_EventTypeSeq& added, const TAO_Notify_EventTypeSeq& removed ACE_ENV_ARG_DECL);
00097 
00098   /// What are the types being offered.
00099   const TAO_Notify_EventTypeSeq& offered_types (void) const;
00100 
00101   /// What are the types being subscribed.
00102   const TAO_Notify_EventTypeSeq& subscription_types (void) const;
00103 
00104 protected:
00105   /// Subscribe <proxy_supplier> to the event type sequence list <seq>.
00106   void subscribe (TAO_Notify_ProxySupplier* proxy_supplier, const TAO_Notify_EventTypeSeq& seq, TAO_Notify_EventTypeSeq& new_seq ACE_ENV_ARG_DECL);
00107 
00108   /// Unsubscribe <proxy_supplier> to the event type sequence list <seq>.
00109   void un_subscribe (TAO_Notify_ProxySupplier* proxy_supplier, const TAO_Notify_EventTypeSeq& seq, TAO_Notify_EventTypeSeq& last_seq ACE_ENV_ARG_DECL);
00110 
00111   /// Subscribe <proxy_consumer> to the event type sequence list <seq>.
00112   void publish (TAO_Notify_ProxyConsumer* proxy_consumer, const TAO_Notify_EventTypeSeq& seq, TAO_Notify_EventTypeSeq& new_seq ACE_ENV_ARG_DECL);
00113 
00114   /// Subscribe <proxy_consumer> to the event type sequence list <seq>.
00115   void un_publish (TAO_Notify_ProxyConsumer* proxy_consumer, const TAO_Notify_EventTypeSeq& seq, TAO_Notify_EventTypeSeq& last_seq ACE_ENV_ARG_DECL);
00116 
00117 private:
00118   // Disallow copying and assignment; we don't need them
00119   // and if we let the compiler generate them it needs the
00120   // full declaration of the template arguments for ACE_Auto_Ptr<>
00121   // below.
00122   TAO_Notify_Event_Manager (TAO_Notify_Event_Manager&);
00123   TAO_Notify_Event_Manager& operator= (TAO_Notify_Event_Manager&);
00124 
00125   /// Consumer Map
00126   ACE_Auto_Ptr< TAO_Notify_Consumer_Map > consumer_map_;
00127 
00128   /// Supplier Map
00129   ACE_Auto_Ptr< TAO_Notify_Supplier_Map > supplier_map_;
00130 };
00131 
00132 TAO_END_VERSIONED_NAMESPACE_DECL
00133 
00134 #include /**/ "ace/post.h"
00135 
00136 #endif /* TAO_Notify_EVENT_MANAGER_H */

Generated on Thu Nov 9 13:24:10 2006 for TAO_CosNotification by doxygen 1.3.6