Template class for storing the collection of Proxys. More...
#include <Event_Map_T.h>
Public Types | |
typedef TAO_Notify_Event_Map_Entry_T < PROXY > | ENTRY |
Public Member Functions | |
TAO_Notify_Event_Map_T (void) | |
Constructor. | |
~TAO_Notify_Event_Map_T () | |
Destructor. | |
void | init (void) |
Init. | |
void | connect (PROXY *proxy) |
Connect a PROXY. | |
void | disconnect (PROXY *proxy) |
Disconnect a PROXY. | |
int | insert (PROXY *proxy, const TAO_Notify_EventType &event_type) |
int | remove (PROXY *proxy, const TAO_Notify_EventType &event_type) |
ENTRY * | find (const TAO_Notify_EventType &event_type) |
ENTRY::COLLECTION * | broadcast_collection (void) |
Find the default broadcast list. | |
ENTRY::COLLECTION * | updates_collection (void) |
Find the update list. This is all the PROXYS connected to this Map. | |
void | release (ENTRY *entry) |
Release the usage count on this entry. | |
const TAO_Notify_EventTypeSeq & | event_types (void) |
Access all the event types available. | |
int | proxy_count (void) |
Access number of proxys connected in all. | |
Protected Attributes | |
ACE_Hash_Map_Manager < TAO_Notify_EventType, ENTRY *, ACE_SYNCH_NULL_MUTEX > | map_ |
The Map that stores eventtype to entry mapping. | |
ACE_LOCK | lock_ |
The lock to use. | |
int | proxy_count_ |
Count of proxys connected. | |
ENTRY | broadcast_entry_ |
The default broadcast list for EventType::special. | |
ENTRY | updates_entry_ |
Update Entry - Keeps a list of all PROXY's connected to this Map. Updates are send to this list. | |
TAO_Notify_EventTypeSeq | event_types_ |
The event types that are available in this map. |
Template class for storing the collection of Proxys.
Definition at line 38 of file Event_Map_T.h.
typedef TAO_Notify_Event_Map_Entry_T<PROXY> TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::ENTRY |
Definition at line 42 of file Event_Map_T.h.
TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::TAO_Notify_Event_Map_T | ( | void | ) |
TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::~TAO_Notify_Event_Map_T | ( | ) |
TAO_Notify_Event_Map_Entry_T< PROXY >::COLLECTION * TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::broadcast_collection | ( | void | ) |
Find the default broadcast list.
Definition at line 54 of file Event_Map_T.inl.
{ return this->broadcast_entry_.collection (); }
void TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::connect | ( | PROXY * | proxy | ) |
Connect a PROXY.
Definition at line 39 of file Event_Map_T.cpp.
{ this->updates_entry_.connected (proxy); ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); ++this->proxy_count_; }
void TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::disconnect | ( | PROXY * | proxy | ) |
Disconnect a PROXY.
Definition at line 48 of file Event_Map_T.cpp.
{ this->updates_entry_.disconnected (proxy); ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); --this->proxy_count_; }
const TAO_Notify_EventTypeSeq & TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::event_types | ( | void | ) |
Access all the event types available.
Definition at line 72 of file Event_Map_T.inl.
{ return this->event_types_; }
TAO_Notify_Event_Map_Entry_T< PROXY > * TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::find | ( | const TAO_Notify_EventType & | event_type | ) |
Find the collection mapped to the <event_type> The usage_count on the entry returned is incremented.
Definition at line 8 of file Event_Map_T.inl.
{ TAO_Notify_Event_Map_Entry_T<PROXY>* entry = 0; ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, 0); if (map_.find (event_type, entry) == 0) { entry->_incr_refcnt (); return entry; } else { // The event_type that we have doesn't hash directly to a particular // entry. So, we need to iterate through the map and see if any of // the event type keys are equivalent to event_type. typedef ACE_Hash_Map_Iterator_Ex <TAO_Notify_EventType, ENTRY*, ACE_Hash<TAO_Notify_EventType>, ACE_Equal_To<TAO_Notify_EventType>, ACE_SYNCH_NULL_MUTEX> Iterator_Type; Iterator_Type end = this->map_.end (); for(Iterator_Type i = this->map_.begin (); i != end; ++i) { if ((*i).ext_id_ == event_type) { entry = (*i).int_id_; entry->_incr_refcnt (); return entry; } } } return 0; }
void TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::init | ( | void | ) |
Init.
Definition at line 31 of file Event_Map_T.cpp.
{ this->broadcast_entry_.init (); this->updates_entry_.init (); }
int TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::insert | ( | PROXY * | proxy, | |
const TAO_Notify_EventType & | event_type | |||
) |
Associate PROXY and event_type. Returns 1 if <event_type> is being seem for the 1st time otherwise returns 0. Returns -1 on error.
Definition at line 57 of file Event_Map_T.cpp.
{ ENTRY* entry = 0; int result = -1; if (event_type.is_special () == 1) { entry = &this->broadcast_entry_; result = 0; } else { ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); result = this->map_.find (event_type, entry); } if (result == -1) // This type is being seen for the first time. { ACE_NEW_THROW_EX (entry, ENTRY (), CORBA::NO_MEMORY ()); entry->init (); entry->connected (proxy); ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); if (map_.bind (event_type, entry) == -1) throw CORBA::NO_MEMORY (); if (this->event_types_.insert (event_type) == -1) return -1; return 1; } else // Add to existing entry or the broadcast entry. { entry->connected (proxy); } return 0; }
int TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::proxy_count | ( | void | ) |
Access number of proxys connected in all.
Definition at line 66 of file Event_Map_T.inl.
{ return this->proxy_count_; }
void TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::release | ( | ENTRY * | entry | ) |
Release the usage count on this entry.
Definition at line 45 of file Event_Map_T.inl.
{ ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); if (entry->_decr_refcnt () == 0) delete entry; }
int TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::remove | ( | PROXY * | proxy, | |
const TAO_Notify_EventType & | event_type | |||
) |
Remove association of PROXY and event_type. Returns 1 if <event_type> is being seem for the last time otherwise returns 0. Returns -1 on error.
Exec a strategy for removing entries. Strategy 1: remove_immediately Strategy 2: remove a bunch_after crossing a threshold Strategy 3: use cached allocator and 1
Definition at line 105 of file Event_Map_T.cpp.
{ ENTRY* entry = 0; if (event_type.is_special () == 1) { entry = &this->broadcast_entry_; entry->disconnected (proxy); } else { int result = -1; { ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); result = this->map_.find (event_type, entry); } if (result == 0) { entry->disconnected (proxy); if (entry->count () == 0) { /// Exec a strategy for removing entries. /// Strategy 1: remove_immediately /// Strategy 2: remove a bunch_after crossing a threshold /// Strategy 3: use cached allocator and 1 // Strategy 1: ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); this->map_.unbind (event_type); if (entry->_decr_refcnt () == 0) delete entry; if (this->event_types_.remove (event_type) == -1) return -1; return 1; } } } return 0; }
TAO_Notify_Event_Map_Entry_T< PROXY >::COLLECTION * TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::updates_collection | ( | void | ) |
Find the update list. This is all the PROXYS connected to this Map.
Definition at line 60 of file Event_Map_T.inl.
{ return this->updates_entry_.collection (); }
ENTRY TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::broadcast_entry_ [protected] |
The default broadcast list for EventType::special.
Definition at line 99 of file Event_Map_T.h.
TAO_Notify_EventTypeSeq TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::event_types_ [protected] |
The event types that are available in this map.
Definition at line 105 of file Event_Map_T.h.
ACE_LOCK TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::lock_ [protected] |
The lock to use.
Definition at line 93 of file Event_Map_T.h.
ACE_Hash_Map_Manager<TAO_Notify_EventType, ENTRY*, ACE_SYNCH_NULL_MUTEX> TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::map_ [protected] |
The Map that stores eventtype to entry mapping.
Definition at line 90 of file Event_Map_T.h.
int TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::proxy_count_ [protected] |
Count of proxys connected.
Definition at line 96 of file Event_Map_T.h.
ENTRY TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::updates_entry_ [protected] |
Update Entry - Keeps a list of all PROXY's connected to this Map. Updates are send to this list.
Definition at line 102 of file Event_Map_T.h.