#include <ESF_Copy_On_Read.h>
Inheritance diagram for TAO_ESF_Copy_On_Read< PROXY, COLLECTION, ITERATOR, ACE_LOCK >:
Public Member Functions | |
TAO_ESF_Copy_On_Read (void) | |
Constructors. | |
TAO_ESF_Copy_On_Read (const COLLECTION &collection) | |
virtual void | for_each (TAO_ESF_Worker< PROXY > *worker) |
virtual void | connected (PROXY *proxy) |
virtual void | reconnected (PROXY *proxy) |
virtual void | disconnected (PROXY *proxy) |
Remove an element from the collection. | |
virtual void | shutdown (void) |
The EC is shutting down, must release all the elements. | |
Private Attributes | |
COLLECTION | collection_ |
ACE_LOCK | lock_ |
The class is parametric on the kind of collection and locking mechanism used.
Definition at line 38 of file ESF_Copy_On_Read.h.
|
Constructors.
Definition at line 13 of file ESF_Copy_On_Read.cpp.
00014 { 00015 } |
|
Definition at line 19 of file ESF_Copy_On_Read.cpp.
00020 : collection_ (collection) 00021 { 00022 } |
|
Insert a new element into the collection. The collection assumes ownership of the element. Implements TAO_ESF_Proxy_Collection< PROXY >. Definition at line 76 of file ESF_Copy_On_Read.cpp. References ACE_GUARD.
00077 { 00078 ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); 00079 00080 proxy->_incr_refcnt (); 00081 this->collection_.connected (proxy); 00082 } |
|
Remove an element from the collection.
Implements TAO_ESF_Proxy_Collection< PROXY >. Definition at line 96 of file ESF_Copy_On_Read.cpp. References ACE_GUARD.
00097 { 00098 ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); 00099 00100 this->collection_.disconnected (proxy); 00101 } |
|
Iterate over the collection and invoke worker->work() for each member of the collection. This encapsulates Implements TAO_ESF_Proxy_Collection< PROXY >. Definition at line 26 of file ESF_Copy_On_Read.cpp. References ACE_GUARD, ACE_NEW, TAO_ESF_Worker< Object >::set_size(), and TAO_ESF_Worker< Object >::work().
00027 { 00028 // @@ Use an allocator for this memory... 00029 PROXY **proxies = 0; 00030 size_t size = 0; 00031 try 00032 { 00033 { 00034 ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); 00035 00036 size = this->collection_.size (); 00037 ACE_NEW (proxies, PROXY*[size]); 00038 PROXY **j = proxies; 00039 00040 for (; j != proxies + size; ++j) 00041 *j = 0; 00042 00043 j = proxies; 00044 00045 ITERATOR end = this->collection_.end (); 00046 for (ITERATOR i = this->collection_.begin (); i != end; ++i) 00047 { 00048 *j = *i; 00049 (*j)->_incr_refcnt (); 00050 ++j; 00051 } 00052 } 00053 worker->set_size(size); 00054 for (PROXY **j = proxies; j != proxies + size; ++j) 00055 { 00056 worker->work (*j); 00057 (*j)->_decr_refcnt (); 00058 } 00059 delete[] proxies; 00060 } 00061 catch (const CORBA::Exception&) 00062 { 00063 for (PROXY **j = proxies; j != proxies + size; ++j) 00064 { 00065 if (*j != 0) 00066 (*j)->_decr_refcnt (); 00067 } 00068 delete[] proxies; 00069 00070 throw; 00071 } 00072 } |
|
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. Implements TAO_ESF_Proxy_Collection< PROXY >. Definition at line 86 of file ESF_Copy_On_Read.cpp. References ACE_GUARD.
00087 { 00088 ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); 00089 00090 proxy->_incr_refcnt (); 00091 this->collection_.reconnected (proxy); 00092 } |
|
The EC is shutting down, must release all the elements.
Implements TAO_ESF_Proxy_Collection< PROXY >. Definition at line 104 of file ESF_Copy_On_Read.cpp. References ACE_GUARD.
00105 { 00106 ACE_GUARD (ACE_LOCK, ace_mon, this->lock_); 00107 00108 this->collection_.shutdown (); 00109 } |
|
Definition at line 53 of file ESF_Copy_On_Read.h. |
|
Definition at line 55 of file ESF_Copy_On_Read.h. |