00001 // $Id: ESF_Proxy_List.cpp 76589 2007-01-25 18:04:11Z elliott_c $ 00002 00003 #ifndef TAO_ESF_PROXY_LIST_CPP 00004 #define TAO_ESF_PROXY_LIST_CPP 00005 00006 #include "orbsvcs/ESF/ESF_Proxy_List.h" 00007 00008 #if ! defined (__ACE_INLINE__) 00009 #include "orbsvcs/ESF/ESF_Proxy_List.inl" 00010 #endif /* __ACE_INLINE__ */ 00011 00012 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00013 00014 template<class PROXY> 00015 TAO_ESF_Proxy_List<PROXY>::TAO_ESF_Proxy_List (void) 00016 { 00017 } 00018 00019 template<class PROXY> void 00020 TAO_ESF_Proxy_List<PROXY>::connected (PROXY *proxy) 00021 { 00022 int r = this->impl_.insert (proxy); 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 } 00038 00039 template<class PROXY> void 00040 TAO_ESF_Proxy_List<PROXY>::reconnected (PROXY *proxy) 00041 { 00042 int r = this->impl_.insert (proxy); 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 // @@ Cannot insert, running out of memory? throw some other 00058 // user exception 00059 proxy->_decr_refcnt (); 00060 } 00061 } 00062 00063 template<class PROXY> void 00064 TAO_ESF_Proxy_List<PROXY>::disconnected (PROXY *proxy) 00065 { 00066 int r = this->impl_.remove (proxy); 00067 if (r != 0) 00068 { 00069 // @@ Cannot remove, throw some other 00070 // user exception 00071 return; 00072 } 00073 proxy->_decr_refcnt (); 00074 } 00075 00076 template<class PROXY> void 00077 TAO_ESF_Proxy_List<PROXY>::shutdown (void) 00078 { 00079 Iterator end = this->impl_.end (); 00080 for (Iterator i = this->impl_.begin (); i != end; ++i) 00081 { 00082 // Decrement reference count 00083 (*i)->_decr_refcnt (); 00084 } 00085 this->impl_.reset (); 00086 } 00087 00088 TAO_END_VERSIONED_NAMESPACE_DECL 00089 00090 #endif /* TAO_ESF_PROXY_LIST_CPP */