#include <ESF_Proxy_RB_Tree.h>
Collaboration diagram for TAO_ESF_Proxy_RB_Tree< PROXY >:
Public Types | |
typedef ACE_RB_Tree< PROXY *, int, ACE_Less_Than< PROXY * >, ACE_Null_Mutex > | Implementation |
A typedef for the underlying implementaiton class. | |
typedef TAO_ESF_Proxy_RB_Tree_Iterator< PROXY > | Iterator |
A typedef for the underlying iterator. | |
Public Member Functions | |
TAO_ESF_Proxy_RB_Tree (void) | |
Constructor. | |
TAO_ESF_Proxy_RB_Tree_Iterator< PROXY > | begin (void) |
TAO_ESF_Proxy_RB_Tree_Iterator< PROXY > | end (void) |
Return one past the last element in the collection. | |
size_t | size (void) const |
Return the number of elements in the collection. | |
void | connected (PROXY *) |
Insert a new element to the collection. | |
void | reconnected (PROXY *) |
Insert a new element that could be there already. | |
void | disconnected (PROXY *) |
Remove an element from the collection. | |
void | shutdown (void) |
Private Attributes | |
Implementation | impl_ |
The underlying implementation object. |
The Event Service Framework provides several alternatives for the underlying proxy collections. This version is based on Red-Black trees that offer good insertion, removal and lookup performance, but the iteration is slightly degraded.
Definition at line 58 of file ESF_Proxy_RB_Tree.h.
typedef ACE_RB_Tree<PROXY*,int,ACE_Less_Than<PROXY*>,ACE_Null_Mutex> TAO_ESF_Proxy_RB_Tree< PROXY >::Implementation |
A typedef for the underlying implementaiton class.
Definition at line 62 of file ESF_Proxy_RB_Tree.h.
typedef TAO_ESF_Proxy_RB_Tree_Iterator<PROXY> TAO_ESF_Proxy_RB_Tree< PROXY >::Iterator |
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_ESF_Proxy_RB_Tree< PROXY >::TAO_ESF_Proxy_RB_Tree | ( | void | ) |
ACE_INLINE TAO_ESF_Proxy_RB_Tree_Iterator< PROXY > TAO_ESF_Proxy_RB_Tree< PROXY >::begin | ( | void | ) |
Return the first element in the collection, or end() if there are none
Definition at line 52 of file ESF_Proxy_RB_Tree.inl.
00053 { 00054 return Iterator (this->impl_.begin ()); 00055 }
void TAO_ESF_Proxy_RB_Tree< PROXY >::connected | ( | PROXY * | ) |
Insert a new element to the collection.
Definition at line 20 of file ESF_Proxy_RB_Tree.cpp.
References ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::bind(), and TAO_ESF_Proxy_RB_Tree< PROXY >::impl_.
00021 { 00022 int r = this->impl_.bind (proxy, 1); 00023 if (r == 0) 00024 return; 00025 00026 if (r == 1) 00027 { 00028 // @@ Already there, throw some user exception.. 00029 proxy->_decr_refcnt (); 00030 } 00031 if (r == -1) 00032 { 00033 // @@ Cannot insert, running out of memory? throw some other 00034 // user exception 00035 proxy->_decr_refcnt (); 00036 } 00037 }
void TAO_ESF_Proxy_RB_Tree< PROXY >::disconnected | ( | PROXY * | ) |
Remove an element from the collection.
Definition at line 62 of file ESF_Proxy_RB_Tree.cpp.
References TAO_ESF_Proxy_RB_Tree< PROXY >::impl_, and ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::unbind().
00063 { 00064 int r = this->impl_.unbind (proxy); 00065 if (r != 0) 00066 { 00067 // @@ Cannot remove, throw some other 00068 // user exception 00069 return; 00070 } 00071 proxy->_decr_refcnt (); 00072 }
ACE_INLINE TAO_ESF_Proxy_RB_Tree_Iterator< PROXY > TAO_ESF_Proxy_RB_Tree< PROXY >::end | ( | void | ) |
Return one past the last element in the collection.
Definition at line 58 of file ESF_Proxy_RB_Tree.inl.
Referenced by TAO_ESF_Proxy_RB_Tree< PROXY >::shutdown().
00059 { 00060 return Iterator (this->impl_.end ()); 00061 }
void TAO_ESF_Proxy_RB_Tree< PROXY >::reconnected | ( | PROXY * | ) |
Insert a new element that could be there already.
Definition at line 40 of file ESF_Proxy_RB_Tree.cpp.
References TAO_ESF_Proxy_RB_Tree< PROXY >::impl_, and ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::rebind().
00041 { 00042 int r = this->impl_.rebind (proxy, 1); 00043 if (r == 0) 00044 return; 00045 00046 if (r == 1) 00047 { 00048 // Reference count is incremented by the callers to [re]connected. 00049 // @@ Find out if the protocol could be simplified, and decoupling 00050 // increased. 00051 proxy->_decr_refcnt (); 00052 return; 00053 } 00054 00055 if (r == -1) 00056 { 00057 proxy->_decr_refcnt (); 00058 } 00059 }
void TAO_ESF_Proxy_RB_Tree< PROXY >::shutdown | ( | void | ) |
Shutdown the collection, i.e. remove all elements and release resources
Definition at line 75 of file ESF_Proxy_RB_Tree.cpp.
References ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::clear(), ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::end(), TAO_ESF_Proxy_RB_Tree< PROXY >::end(), and TAO_ESF_Proxy_RB_Tree< PROXY >::impl_.
00076 { 00077 Iterator end = this->impl_.end (); 00078 for (Iterator i = this->impl_.begin (); i != end; ++i) 00079 { 00080 // Decrement reference count 00081 (*i)->_decr_refcnt (); 00082 } 00083 this->impl_.clear (); 00084 }
ACE_INLINE size_t TAO_ESF_Proxy_RB_Tree< PROXY >::size | ( | void | ) | const |
Return the number of elements in the collection.
Definition at line 64 of file ESF_Proxy_RB_Tree.inl.
References ACE_RB_Tree< EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK >::current_size(), and TAO_ESF_Proxy_RB_Tree< PROXY >::impl_.
00065 { 00066 return this->impl_.current_size (); 00067 }
Implementation TAO_ESF_Proxy_RB_Tree< PROXY >::impl_ [private] |
The underlying implementation object.
Definition at line 94 of file ESF_Proxy_RB_Tree.h.
Referenced by TAO_ESF_Proxy_RB_Tree< PROXY >::connected(), TAO_ESF_Proxy_RB_Tree< PROXY >::disconnected(), TAO_ESF_Proxy_RB_Tree< PROXY >::reconnected(), TAO_ESF_Proxy_RB_Tree< PROXY >::shutdown(), and TAO_ESF_Proxy_RB_Tree< PROXY >::size().