TAO_ESF
2.2.8
|
ESF_Proxy_Collection. More...
#include <ESF_Proxy_Collection.h>
Public Member Functions | |
virtual | ~TAO_ESF_Proxy_Collection (void) |
destructor More... | |
virtual void | for_each (TAO_ESF_Worker< PROXY > *worker)=0 |
virtual void | connected (PROXY *proxy)=0 |
virtual void | reconnected (PROXY *proxy)=0 |
virtual void | disconnected (PROXY *proxy)=0 |
Remove an element from the collection. More... | |
virtual void | shutdown (void)=0 |
The EC is shutting down, must release all the elements. More... | |
ESF_Proxy_Collection.
Many components in an Event Service need to keep a collection of proxies; these collections must be able to cope with several concurrency issues:
There are several solutions to this problem (see the VARIANTS) section, and there is no single one that works bests in all cases. As usual, we wish the strategize the protocol used to serialize iterations and changes to the collection. This class encapsulates that protocol.
The usual form of the Iterator pattern does not work well in this case: in several variants the synchronization protocol and the iteration loop must collaborate to work efficiently. Exposing an external iterator would require that every other component in the system can support all the synchronization protocols. It is possible to hide some of that complexity using heavy weight iterators, but their use is ackward, specially since the Koening-style iterators have become more popular.
Regular member functions are used to insert, remove and update members of the collection and to shutdown (i.e. perform final cleanup operations).
The class must also collaborate with other components of the EC to efficiently and safely perform memory managment of the members in the collection.
The PROXY object must be reference counted with the following operations:
= VARIANTS
We identify several sources of variation:
It assumes ownership of the proxies added to the collection, it increases the reference count.
Locking is provided by derived classes.
|
virtual |
destructor
|
pure virtual |
Insert a new element into the collection. The collection assumes ownership of the element.
Implemented in TAO_ESF_Copy_On_Write< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE >, TAO_ESF_Copy_On_Read< PROXY, COLLECTION, ITERATOR, ACE_LOCK >, and TAO_ESF_Immediate_Changes< PROXY, COLLECTION, ITERATOR, ACE_LOCK >.
|
pure virtual |
Remove an element from the collection.
Implemented in TAO_ESF_Copy_On_Write< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE >, TAO_ESF_Copy_On_Read< PROXY, COLLECTION, ITERATOR, ACE_LOCK >, and TAO_ESF_Immediate_Changes< PROXY, COLLECTION, ITERATOR, ACE_LOCK >.
|
pure virtual |
Iterate over the collection and invoke worker->work() for each member of the collection. This encapsulates
Implemented in TAO_ESF_Copy_On_Write< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE >, TAO_ESF_Copy_On_Read< PROXY, COLLECTION, ITERATOR, ACE_LOCK >, and TAO_ESF_Immediate_Changes< PROXY, COLLECTION, ITERATOR, ACE_LOCK >.
|
pure virtual |
Insert an element into the collection. No errors can be raised if the element is already present. The collection assumes ownership, i.e. must invoke <proxy->_decr_refcnt()> if the element is already present in the collection.
Implemented in TAO_ESF_Copy_On_Write< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE >, TAO_ESF_Copy_On_Read< PROXY, COLLECTION, ITERATOR, ACE_LOCK >, and TAO_ESF_Immediate_Changes< PROXY, COLLECTION, ITERATOR, ACE_LOCK >.
|
pure virtual |
The EC is shutting down, must release all the elements.
Implemented in TAO_ESF_Copy_On_Write< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE >, TAO_ESF_Copy_On_Read< PROXY, COLLECTION, ITERATOR, ACE_LOCK >, and TAO_ESF_Immediate_Changes< PROXY, COLLECTION, ITERATOR, ACE_LOCK >.