#include <Event_Manager.h>
Inheritance diagram for TAO_Notify_Event_Manager:
Public Types | |
typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_Event_Manager > | Ptr |
Public Member Functions | |
TAO_Notify_Event_Manager (void) | |
Constructor. | |
virtual | ~TAO_Notify_Event_Manager () |
Destructor. | |
void | release () |
The release method is called when the refcount reaches 0. | |
void | init (void) |
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_Map & | consumer_map (void) |
Map accessors. | |
TAO_Notify_Supplier_Map & | supplier_map (void) |
void | offer_change (TAO_Notify_ProxyConsumer *proxy_consumer, const TAO_Notify_EventTypeSeq &added, const TAO_Notify_EventTypeSeq &removed) |
Offer change received on <proxy_consumer>. | |
void | subscription_change (TAO_Notify_ProxySupplier *proxy_supplier, const TAO_Notify_EventTypeSeq &added, const TAO_Notify_EventTypeSeq &removed) |
Subscription change received on <proxy_supplier>. | |
const TAO_Notify_EventTypeSeq & | offered_types (void) const |
What are the types being offered. | |
const TAO_Notify_EventTypeSeq & | subscription_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 <proxy_supplier> to the event type sequence list <seq>. | |
void | un_subscribe (TAO_Notify_ProxySupplier *proxy_supplier, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &last_seq) |
Unsubscribe <proxy_supplier> to the event type sequence list <seq>. | |
void | publish (TAO_Notify_ProxyConsumer *proxy_consumer, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &new_seq) |
Subscribe <proxy_consumer> to the event type sequence list <seq>. | |
void | un_publish (TAO_Notify_ProxyConsumer *proxy_consumer, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &last_seq) |
Subscribe <proxy_consumer> to the event type sequence list <seq>. | |
Private Member Functions | |
TAO_Notify_Event_Manager (TAO_Notify_Event_Manager &) | |
TAO_Notify_Event_Manager & | operator= (TAO_Notify_Event_Manager &) |
Private Attributes | |
ACE_Auto_Ptr< TAO_Notify_Consumer_Map > | consumer_map_ |
Consumer Map. | |
ACE_Auto_Ptr< TAO_Notify_Supplier_Map > | supplier_map_ |
Supplier Map. |
Definition at line 58 of file Event_Manager.h.
TAO_Notify_Event_Manager::TAO_Notify_Event_Manager | ( | void | ) |
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] |
void TAO_Notify_Event_Manager::connect | ( | TAO_Notify_ProxyConsumer * | proxy_consumer | ) |
Connect ProxyConsumer.
Definition at line 126 of file Event_Manager.cpp.
References TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::connect(), supplier_map(), and TAO_Notify_Proxy::types_changed().
00127 { 00128 this->supplier_map().connect (proxy_consumer); 00129 // Inform about subscription types. 00130 TAO_Notify_EventTypeSeq removed; 00131 proxy_consumer->types_changed (this->subscription_types (), removed); 00132 }
void TAO_Notify_Event_Manager::connect | ( | TAO_Notify_ProxySupplier * | proxy_supplier | ) |
Connect ProxySupplier.
Definition at line 110 of file Event_Manager.cpp.
References consumer_map(), and TAO_Notify_Proxy::types_changed().
Referenced by TAO_Notify_ProxySupplier::connect(), and TAO_Notify_ProxyConsumer::connect().
00111 { 00112 this->consumer_map().connect (proxy_supplier); 00113 00114 // Inform about offered types. 00115 TAO_Notify_EventTypeSeq removed; 00116 proxy_supplier->types_changed (this->offered_types (), removed); 00117 }
TAO_Notify_Consumer_Map & TAO_Notify_Event_Manager::consumer_map | ( | void | ) |
Map accessors.
Definition at line 240 of file Event_Manager.cpp.
References ACE_ASSERT, and consumer_map_.
Referenced by connect(), disconnect(), TAO_Notify_Method_Request_Lookup::execute_i(), init(), and offer_change().
00241 { 00242 ACE_ASSERT( this->consumer_map_.get() != 0 ); 00243 return *this->consumer_map_; 00244 }
void TAO_Notify_Event_Manager::disconnect | ( | TAO_Notify_ProxyConsumer * | proxy_consumer | ) |
Disconnect ProxyConsumer.
Definition at line 135 of file Event_Manager.cpp.
References TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::disconnect(), and supplier_map().
00136 { 00137 this->supplier_map().disconnect (proxy_consumer); 00138 }
void TAO_Notify_Event_Manager::disconnect | ( | TAO_Notify_ProxySupplier * | proxy_supplier | ) |
Disconnect ProxySupplier.
Definition at line 120 of file Event_Manager.cpp.
References consumer_map().
Referenced by TAO_Notify_ProxySupplier::disconnect(), and TAO_Notify_ProxyConsumer::disconnect().
00121 { 00122 this->consumer_map().disconnect (proxy_supplier); 00123 }
void TAO_Notify_Event_Manager::init | ( | void | ) |
Init.
Definition at line 83 of file Event_Manager.cpp.
References ACE_ASSERT, ACE_NEW_THROW_EX, consumer_map(), consumer_map_, ACE_Auto_Basic_Ptr< X >::reset(), supplier_map(), and 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 this->consumer_map_.reset( consumer_map ); 00092 00093 this->consumer_map().init (); 00094 00095 TAO_Notify_Supplier_Map* supplier_map = 0; 00096 ACE_NEW_THROW_EX (supplier_map, 00097 TAO_Notify_Supplier_Map (), 00098 CORBA::NO_MEMORY ()); 00099 this->supplier_map_.reset( supplier_map ); 00100 00101 this->supplier_map_->init (); 00102 }
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 <proxy_consumer>.
Definition at line 141 of file Event_Manager.cpp.
References consumer_map(), publish(), and un_publish().
Referenced by TAO_Notify_ProxyConsumer::connect(), TAO_Notify_ProxyConsumer::disconnect(), and TAO_Notify_ProxyConsumer_T< SERVANT_TYPE >::offer_change().
00142 { 00143 TAO_Notify_EventTypeSeq new_added, last_removed; 00144 00145 this->publish (proxy_consumer, added, new_added); 00146 00147 this->un_publish (proxy_consumer, removed, last_removed); 00148 00149 TAO_Notify_Consumer_Map::ENTRY::COLLECTION* updates_collection = this->consumer_map().updates_collection (); 00150 00151 TAO_Notify_ProxySupplier_Update_Worker worker (new_added, last_removed); 00152 00153 if (updates_collection != 0) 00154 updates_collection->for_each (&worker); 00155 }
const TAO_Notify_EventTypeSeq & TAO_Notify_Event_Manager::offered_types | ( | void | ) | const |
What are the types being offered.
Definition at line 254 of file Event_Manager.cpp.
References supplier_map_.
00255 { 00256 return this->supplier_map_->event_types (); 00257 }
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 <proxy_consumer> to the event type sequence list <seq>.
Definition at line 208 of file Event_Manager.cpp.
References ACE_Unbounded_Set_Ex< T, C >::insert(), TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::insert(), and supplier_map().
Referenced by offer_change().
00209 { 00210 TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq); 00211 00212 TAO_Notify_EventType* event_type = 0; 00213 00214 for (iter.first (); iter.next (event_type) != 0; iter.advance ()) 00215 { 00216 int result = supplier_map().insert (proxy_consumer, *event_type); 00217 00218 if (result == 1) 00219 new_seq.insert (*event_type); 00220 } 00221 }
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.
void TAO_Notify_Event_Manager::shutdown | ( | void | ) |
Init.
Definition at line 105 of file Event_Manager.cpp.
Referenced by TAO_Notify_EventChannel::shutdown().
void TAO_Notify_Event_Manager::subscribe | ( | TAO_Notify_ProxySupplier * | proxy_supplier, | |
const TAO_Notify_EventTypeSeq & | seq, | |||
TAO_Notify_EventTypeSeq & | new_seq | |||
) | [protected] |
Subscribe <proxy_supplier> to the event type sequence list <seq>.
Definition at line 176 of file Event_Manager.cpp.
References ACE_Unbounded_Set_Ex< T, C >::insert().
Referenced by subscription_change().
00177 { 00178 TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq); 00179 00180 TAO_Notify_EventType* event_type; 00181 00182 for (iter.first (); iter.next (event_type) != 0; iter.advance ()) 00183 { 00184 int result = this->consumer_map().insert (proxy_supplier, *event_type); 00185 00186 if (result == 1) 00187 new_seq.insert (*event_type); 00188 } 00189 }
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 <proxy_supplier>.
Definition at line 158 of file Event_Manager.cpp.
References subscribe(), supplier_map(), un_subscribe(), and TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::updates_collection().
Referenced by TAO_Notify_ProxySupplier::connect(), TAO_Notify_ProxySupplier::disconnect(), and TAO_Notify_ProxySupplier_T< SERVANT_TYPE >::subscription_change().
00159 { 00160 TAO_Notify_EventTypeSeq new_added, last_removed; 00161 00162 this->subscribe (proxy_supplier, added, new_added); 00163 this->un_subscribe (proxy_supplier, removed, last_removed); 00164 00165 TAO_Notify_Supplier_Map::ENTRY::COLLECTION* updates_collection = this->supplier_map().updates_collection (); 00166 00167 TAO_Notify_ProxyConsumer_Update_Worker worker (new_added, last_removed); 00168 00169 if (updates_collection != 0) 00170 { 00171 updates_collection->for_each (&worker); 00172 } 00173 }
const TAO_Notify_EventTypeSeq & TAO_Notify_Event_Manager::subscription_types | ( | void | ) | const |
What are the types being subscribed.
Definition at line 260 of file Event_Manager.cpp.
References consumer_map_.
00261 { 00262 return this->consumer_map_->event_types (); 00263 }
TAO_Notify_Supplier_Map & TAO_Notify_Event_Manager::supplier_map | ( | void | ) |
Definition at line 247 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().
00248 { 00249 ACE_ASSERT( this->supplier_map_.get() != 0 ); 00250 return *this->supplier_map_; 00251 }
void TAO_Notify_Event_Manager::un_publish | ( | TAO_Notify_ProxyConsumer * | proxy_consumer, | |
const TAO_Notify_EventTypeSeq & | seq, | |||
TAO_Notify_EventTypeSeq & | last_seq | |||
) | [protected] |
Subscribe <proxy_consumer> to the event type sequence list <seq>.
Definition at line 224 of file Event_Manager.cpp.
References ACE_Unbounded_Set_Ex< T, C >::insert(), TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::remove(), and supplier_map().
Referenced by offer_change().
00225 { 00226 TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq); 00227 00228 TAO_Notify_EventType* event_type = 0; 00229 00230 for (iter.first (); iter.next (event_type) != 0; iter.advance ()) 00231 { 00232 int result = supplier_map().remove (proxy_consumer, *event_type); 00233 00234 if (result == 1) 00235 last_seq.insert (*event_type); 00236 } 00237 }
void TAO_Notify_Event_Manager::un_subscribe | ( | TAO_Notify_ProxySupplier * | proxy_supplier, | |
const TAO_Notify_EventTypeSeq & | seq, | |||
TAO_Notify_EventTypeSeq & | last_seq | |||
) | [protected] |
Unsubscribe <proxy_supplier> to the event type sequence list <seq>.
Definition at line 192 of file Event_Manager.cpp.
References ACE_Unbounded_Set_Ex< T, C >::insert().
Referenced by subscription_change().
00193 { 00194 TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq); 00195 00196 TAO_Notify_EventType* event_type = 0; 00197 00198 for (iter.first (); iter.next (event_type) != 0; iter.advance ()) 00199 { 00200 int result = this->consumer_map().remove (proxy_supplier, *event_type); 00201 00202 if (result == 1) 00203 last_seq.insert (*event_type); 00204 } 00205 }
Consumer Map.
Definition at line 126 of file Event_Manager.h.
Referenced by consumer_map(), init(), and subscription_types().
Supplier Map.
Definition at line 129 of file Event_Manager.h.
Referenced by init(), offered_types(), and supplier_map().