TAO_Notify_Event_Manager Class Reference

A class that manages the Consumer and Supplier maps. More...

#include <Event_Manager.h>

Inheritance diagram for TAO_Notify_Event_Manager:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_Event_Manager:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TAO_Notify_Refcountable_Guard_T<
TAO_Notify_Event_Manager
Ptr

Public Member Functions

 TAO_Notify_Event_Manager (void)
 Constuctor.

virtual ~TAO_Notify_Event_Manager ()
 Destructor.

void release ()
 The release method is called when the refcount reaches 0.

void init ()
 Init.

void shutdown (void)
 Init.

void connect (TAO_Notify_ProxySupplier *proxy_supplier)
 Connect ProxySupplier.

void disconnect (TAO_Notify_ProxySupplier *proxy_supplier)
 Disconnect ProxySupplier.

void connect (TAO_Notify_ProxyConsumer *proxy_consumer)
 Connect ProxyConsumer.

void disconnect (TAO_Notify_ProxyConsumer *proxy_consumer)
 Disconnect ProxyConsumer.

TAO_Notify_Consumer_Mapconsumer_map (void)
 Map accessors.

TAO_Notify_Supplier_Mapsupplier_map (void)
void offer_change (TAO_Notify_ProxyConsumer *proxy_consumer, const TAO_Notify_EventTypeSeq &added, const TAO_Notify_EventTypeSeq &removed)
 Offer change received on .

void subscription_change (TAO_Notify_ProxySupplier *proxy_supplier, const TAO_Notify_EventTypeSeq &added, const TAO_Notify_EventTypeSeq &removed)
 Subscription change received on .

const TAO_Notify_EventTypeSeqoffered_types (void) const
 What are the types being offered.

const TAO_Notify_EventTypeSeqsubscription_types (void) const
 What are the types being subscribed.


Protected Member Functions

void subscribe (TAO_Notify_ProxySupplier *proxy_supplier, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &new_seq)
 Subscribe to the event type sequence list .

void un_subscribe (TAO_Notify_ProxySupplier *proxy_supplier, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &last_seq)
 Unsubscribe to the event type sequence list .

void publish (TAO_Notify_ProxyConsumer *proxy_consumer, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &new_seq)
 Subscribe to the event type sequence list .

void un_publish (TAO_Notify_ProxyConsumer *proxy_consumer, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &last_seq)
 Subscribe to the event type sequence list .


Private Member Functions

 TAO_Notify_Event_Manager (TAO_Notify_Event_Manager &)
TAO_Notify_Event_Manageroperator= (TAO_Notify_Event_Manager &)

Private Attributes

ACE_Auto_Ptr< TAO_Notify_Consumer_Mapconsumer_map_
 Consumer Map.

ACE_Auto_Ptr< TAO_Notify_Supplier_Mapsupplier_map_
 Supplier Map.


Detailed Description

A class that manages the Consumer and Supplier maps.

Definition at line 58 of file Event_Manager.h.


Member Typedef Documentation

typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_Event_Manager > TAO_Notify_Event_Manager::Ptr
 

Reimplemented from TAO_Notify_Refcountable.

Definition at line 61 of file Event_Manager.h.


Constructor & Destructor Documentation

TAO_Notify_Event_Manager::TAO_Notify_Event_Manager void   ) 
 

Constuctor.

Definition at line 64 of file Event_Manager.cpp.

00065 {
00066 }

TAO_Notify_Event_Manager::~TAO_Notify_Event_Manager  )  [virtual]
 

Destructor.

Definition at line 68 of file Event_Manager.cpp.

References ACE_DEBUG, LM_DEBUG, TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::proxy_count(), supplier_map(), and TAO_debug_level.

00069 {
00070   if (TAO_debug_level > 0)
00071     {
00072       ACE_DEBUG ((LM_DEBUG, "destroying consumer/supplier map count = %d/%d, \n",
00073                   this->consumer_map().proxy_count (), this->supplier_map().proxy_count ()));
00074     }
00075 }

TAO_Notify_Event_Manager::TAO_Notify_Event_Manager TAO_Notify_Event_Manager  )  [private]
 


Member Function Documentation

void TAO_Notify_Event_Manager::connect TAO_Notify_ProxyConsumer proxy_consumer  ) 
 

Connect ProxyConsumer.

Definition at line 132 of file Event_Manager.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::connect(), and supplier_map().

00133 {
00134   this->supplier_map().connect (proxy_consumer ACE_ENV_ARG_PARAMETER);
00135   ACE_CHECK;
00136   // Inform about subscription types.
00137   TAO_Notify_EventTypeSeq removed;
00138   proxy_consumer->types_changed (this->subscription_types (), removed ACE_ENV_ARG_PARAMETER);
00139 }

void TAO_Notify_Event_Manager::connect TAO_Notify_ProxySupplier proxy_supplier  ) 
 

Connect ProxySupplier.

Definition at line 114 of file Event_Manager.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, and consumer_map().

00115 {
00116   this->consumer_map().connect (proxy_supplier ACE_ENV_ARG_PARAMETER);
00117   ACE_CHECK;
00118 
00119   // Inform about offered types.
00120   TAO_Notify_EventTypeSeq removed;
00121   proxy_supplier->types_changed (this->offered_types (), removed ACE_ENV_ARG_PARAMETER);
00122   ACE_CHECK;
00123 }

TAO_Notify_Consumer_Map & TAO_Notify_Event_Manager::consumer_map void   ) 
 

Map accessors.

Definition at line 256 of file Event_Manager.cpp.

References ACE_ASSERT, and consumer_map_.

Referenced by connect(), disconnect(), TAO_Notify_Method_Request_Lookup::execute_i(), init(), offer_change(), subscribe(), and un_subscribe().

00257 {
00258   ACE_ASSERT( this->consumer_map_.get() != 0 );
00259   return *this->consumer_map_;
00260 }

void TAO_Notify_Event_Manager::disconnect TAO_Notify_ProxyConsumer proxy_consumer  ) 
 

Disconnect ProxyConsumer.

Definition at line 142 of file Event_Manager.cpp.

References ACE_ENV_ARG_PARAMETER, TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::disconnect(), and supplier_map().

00143 {
00144   this->supplier_map().disconnect (proxy_consumer ACE_ENV_ARG_PARAMETER);
00145 }

void TAO_Notify_Event_Manager::disconnect TAO_Notify_ProxySupplier proxy_supplier  ) 
 

Disconnect ProxySupplier.

Definition at line 126 of file Event_Manager.cpp.

References ACE_ENV_ARG_PARAMETER, and consumer_map().

Referenced by TAO_Notify_ProxySupplier::disconnect(), and TAO_Notify_ProxyConsumer::disconnect().

00127 {
00128   this->consumer_map().disconnect (proxy_supplier ACE_ENV_ARG_PARAMETER);
00129 }

void TAO_Notify_Event_Manager::init  ) 
 

Init.

Definition at line 83 of file Event_Manager.cpp.

References ACE_ASSERT, ACE_CHECK, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_NEW_THROW_EX, consumer_map(), consumer_map_, ACE_Auto_Basic_Ptr< X >::reset(), supplier_map(), supplier_map_, and TAO_Notify_Supplier_Map.

Referenced by TAO_Notify_EventChannel::init().

00084 {
00085   ACE_ASSERT (this->consumer_map_.get() == 0);
00086 
00087   TAO_Notify_Consumer_Map* consumer_map = 0;
00088   ACE_NEW_THROW_EX (consumer_map,
00089                     TAO_Notify_Consumer_Map (),
00090                     CORBA::NO_MEMORY ());
00091   ACE_CHECK;
00092   this->consumer_map_.reset( consumer_map );
00093 
00094   this->consumer_map().init (ACE_ENV_SINGLE_ARG_PARAMETER);
00095   ACE_CHECK;
00096 
00097   TAO_Notify_Supplier_Map* supplier_map = 0;
00098   ACE_NEW_THROW_EX (supplier_map,
00099                     TAO_Notify_Supplier_Map (),
00100                     CORBA::NO_MEMORY ());
00101   ACE_CHECK;
00102   this->supplier_map_.reset( supplier_map );
00103 
00104   this->supplier_map_->init (ACE_ENV_SINGLE_ARG_PARAMETER);
00105   ACE_CHECK;
00106 }

void TAO_Notify_Event_Manager::offer_change TAO_Notify_ProxyConsumer proxy_consumer,
const TAO_Notify_EventTypeSeq added,
const TAO_Notify_EventTypeSeq removed
 

Offer change received on .

Definition at line 148 of file Event_Manager.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, consumer_map(), publish(), and un_publish().

Referenced by TAO_Notify_ProxyConsumer::disconnect().

00149 {
00150   TAO_Notify_EventTypeSeq new_added, last_removed;
00151 
00152   this->publish (proxy_consumer, added, new_added ACE_ENV_ARG_PARAMETER);
00153   ACE_CHECK;
00154 
00155   this->un_publish (proxy_consumer, removed, last_removed ACE_ENV_ARG_PARAMETER);
00156   ACE_CHECK;
00157 
00158   TAO_Notify_Consumer_Map::ENTRY::COLLECTION* updates_collection = this->consumer_map().updates_collection ();
00159 
00160   TAO_Notify_ProxySupplier_Update_Worker worker (new_added, last_removed);
00161 
00162   if (updates_collection != 0)
00163     updates_collection->for_each (&worker ACE_ENV_ARG_PARAMETER);
00164 }

const TAO_Notify_EventTypeSeq & TAO_Notify_Event_Manager::offered_types void   )  const
 

What are the types being offered.

Definition at line 270 of file Event_Manager.cpp.

References supplier_map_.

00271 {
00272   return this->supplier_map_->event_types ();
00273 }

TAO_Notify_Event_Manager& TAO_Notify_Event_Manager::operator= TAO_Notify_Event_Manager  )  [private]
 

void TAO_Notify_Event_Manager::publish TAO_Notify_ProxyConsumer proxy_consumer,
const TAO_Notify_EventTypeSeq seq,
TAO_Notify_EventTypeSeq new_seq
[protected]
 

Subscribe to the event type sequence list .

Definition at line 222 of file Event_Manager.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::insert(), and supplier_map().

Referenced by offer_change().

00223 {
00224   TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq);
00225 
00226   TAO_Notify_EventType* event_type = 0;
00227 
00228   for (iter.first (); iter.next (event_type) != 0; iter.advance ())
00229     {
00230       int result = supplier_map().insert (proxy_consumer, *event_type ACE_ENV_ARG_PARAMETER);
00231       ACE_CHECK;
00232 
00233       if (result == 1)
00234         new_seq.insert (*event_type);
00235     }
00236 }

void TAO_Notify_Event_Manager::release  )  [virtual]
 

The release method is called when the refcount reaches 0.

Implements TAO_Notify_Refcountable.

Definition at line 77 of file Event_Manager.cpp.

00078 {
00079   delete this;
00080 }

void TAO_Notify_Event_Manager::shutdown void   ) 
 

Init.

Definition at line 109 of file Event_Manager.cpp.

Referenced by TAO_Notify_EventChannel::shutdown().

00110 {
00111 }

void TAO_Notify_Event_Manager::subscribe TAO_Notify_ProxySupplier proxy_supplier,
const TAO_Notify_EventTypeSeq seq,
TAO_Notify_EventTypeSeq new_seq
[protected]
 

Subscribe to the event type sequence list .

Definition at line 188 of file Event_Manager.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, and consumer_map().

Referenced by subscription_change().

00189 {
00190   TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq);
00191 
00192   TAO_Notify_EventType* event_type;
00193 
00194   for (iter.first (); iter.next (event_type) != 0; iter.advance ())
00195     {
00196       int result = this->consumer_map().insert (proxy_supplier, *event_type ACE_ENV_ARG_PARAMETER);
00197       ACE_CHECK;
00198 
00199       if (result == 1)
00200         new_seq.insert (*event_type);
00201     }
00202 }

void TAO_Notify_Event_Manager::subscription_change TAO_Notify_ProxySupplier proxy_supplier,
const TAO_Notify_EventTypeSeq added,
const TAO_Notify_EventTypeSeq removed
 

Subscription change received on .

Definition at line 167 of file Event_Manager.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, subscribe(), supplier_map(), un_subscribe(), and TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::updates_collection().

Referenced by TAO_Notify_ProxySupplier::disconnect().

00168 {
00169   TAO_Notify_EventTypeSeq new_added, last_removed;
00170 
00171   this->subscribe (proxy_supplier, added, new_added ACE_ENV_ARG_PARAMETER);
00172   ACE_CHECK;
00173   this->un_subscribe (proxy_supplier, removed, last_removed ACE_ENV_ARG_PARAMETER);
00174   ACE_CHECK;
00175 
00176   TAO_Notify_Supplier_Map::ENTRY::COLLECTION* updates_collection = this->supplier_map().updates_collection ();
00177 
00178   TAO_Notify_ProxyConsumer_Update_Worker worker (new_added, last_removed);
00179 
00180   if (updates_collection != 0)
00181     {
00182       updates_collection->for_each (&worker ACE_ENV_ARG_PARAMETER);
00183       ACE_CHECK;
00184     }
00185 }

const TAO_Notify_EventTypeSeq & TAO_Notify_Event_Manager::subscription_types void   )  const
 

What are the types being subscribed.

Definition at line 276 of file Event_Manager.cpp.

References consumer_map_.

00277 {
00278   return this->consumer_map_->event_types ();
00279 }

TAO_Notify_Supplier_Map & TAO_Notify_Event_Manager::supplier_map void   ) 
 

Definition at line 263 of file Event_Manager.cpp.

References ACE_ASSERT, and supplier_map_.

Referenced by connect(), disconnect(), init(), publish(), subscription_change(), un_publish(), and ~TAO_Notify_Event_Manager().

00264 {
00265   ACE_ASSERT( this->supplier_map_.get() != 0 );
00266   return *this->supplier_map_;
00267 }

void TAO_Notify_Event_Manager::un_publish TAO_Notify_ProxyConsumer proxy_consumer,
const TAO_Notify_EventTypeSeq seq,
TAO_Notify_EventTypeSeq last_seq
[protected]
 

Subscribe to the event type sequence list .

Definition at line 239 of file Event_Manager.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::remove(), and supplier_map().

Referenced by offer_change().

00240 {
00241   TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq);
00242 
00243   TAO_Notify_EventType* event_type = 0;
00244 
00245   for (iter.first (); iter.next (event_type) != 0; iter.advance ())
00246     {
00247       int result = supplier_map().remove (proxy_consumer, *event_type ACE_ENV_ARG_PARAMETER);
00248       ACE_CHECK;
00249 
00250       if (result == 1)
00251         last_seq.insert (*event_type);
00252     }
00253 }

void TAO_Notify_Event_Manager::un_subscribe TAO_Notify_ProxySupplier proxy_supplier,
const TAO_Notify_EventTypeSeq seq,
TAO_Notify_EventTypeSeq last_seq
[protected]
 

Unsubscribe to the event type sequence list .

Definition at line 205 of file Event_Manager.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, and consumer_map().

Referenced by subscription_change().

00206 {
00207   TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq);
00208 
00209   TAO_Notify_EventType* event_type = 0;
00210 
00211   for (iter.first (); iter.next (event_type) != 0; iter.advance ())
00212     {
00213       int result = this->consumer_map().remove (proxy_supplier, *event_type ACE_ENV_ARG_PARAMETER);
00214       ACE_CHECK;
00215 
00216       if (result == 1)
00217         last_seq.insert (*event_type);
00218     }
00219 }


Member Data Documentation

ACE_Auto_Ptr< TAO_Notify_Consumer_Map > TAO_Notify_Event_Manager::consumer_map_ [private]
 

Consumer Map.

Definition at line 126 of file Event_Manager.h.

Referenced by consumer_map(), init(), and subscription_types().

ACE_Auto_Ptr< TAO_Notify_Supplier_Map > TAO_Notify_Event_Manager::supplier_map_ [private]
 

Supplier Map.

Definition at line 129 of file Event_Manager.h.

Referenced by init(), offered_types(), and supplier_map().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:31:55 2006 for TAO_CosNotification by doxygen 1.3.6