ESF_Proxy_RB_Tree.cpp

Go to the documentation of this file.
00001 // ESF_Proxy_RB_Tree.cpp,v 1.7 2006/03/14 06:14:25 jtc Exp
00002 
00003 #ifndef TAO_ESF_PROXY_RB_TREE_CPP
00004 #define TAO_ESF_PROXY_RB_TREE_CPP
00005 
00006 #include "orbsvcs/ESF/ESF_Proxy_RB_Tree.h"
00007 
00008 #if ! defined (__ACE_INLINE__)
00009 #include "orbsvcs/ESF/ESF_Proxy_RB_Tree.i"
00010 #endif /* __ACE_INLINE__ */
00011 
00012 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00013 
00014 template<class PROXY>
00015 TAO_ESF_Proxy_RB_Tree<PROXY>::TAO_ESF_Proxy_RB_Tree (void)
00016 {
00017 }
00018 
00019 template<class PROXY> void
00020 TAO_ESF_Proxy_RB_Tree<PROXY>::connected (PROXY *proxy
00021                                          ACE_ENV_ARG_DECL_NOT_USED)
00022 {
00023   int r = this->impl_.bind (proxy, 1);
00024   if (r == 0)
00025     return;
00026 
00027   if (r == 1)
00028     {
00029       // @@ Already there, throw some user exception..
00030       proxy->_decr_refcnt ();
00031     }
00032   if (r == -1)
00033     {
00034       // @@ Cannot insert, running out of memory? throw some other
00035       // user exception
00036       proxy->_decr_refcnt ();
00037     }
00038 }
00039 
00040 template<class PROXY> void
00041 TAO_ESF_Proxy_RB_Tree<PROXY>::reconnected (PROXY *proxy
00042                                            ACE_ENV_ARG_DECL_NOT_USED)
00043 {
00044   int r = this->impl_.rebind (proxy, 1);
00045   if (r == 0)
00046     return;
00047 
00048   if (r == 1)
00049     {
00050       // Reference count is incremented by the callers to [re]connected.
00051       // @@ Find out if the protocol could be simplified, and decoupling
00052       //    increased.
00053       proxy->_decr_refcnt ();
00054       return;
00055     }
00056 
00057   if (r == -1)
00058     {
00059       proxy->_decr_refcnt ();
00060     }
00061 }
00062 
00063 template<class PROXY> void
00064 TAO_ESF_Proxy_RB_Tree<PROXY>::disconnected (PROXY *proxy
00065                                             ACE_ENV_ARG_DECL_NOT_USED)
00066 {
00067   int r = this->impl_.unbind (proxy);
00068   if (r != 0)
00069     {
00070       // @@ Cannot remove, throw some other
00071       // user exception
00072       return;
00073     }
00074   proxy->_decr_refcnt ();
00075 }
00076 
00077 template<class PROXY> void
00078 TAO_ESF_Proxy_RB_Tree<PROXY>::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
00079 {
00080   Iterator end = this->impl_.end ();
00081   for (Iterator i = this->impl_.begin (); i != end; ++i)
00082     {
00083       // Decrement reference count
00084       (*i)->_decr_refcnt ();
00085     }
00086   this->impl_.clear ();
00087 }
00088 
00089 TAO_END_VERSIONED_NAMESPACE_DECL
00090 
00091 #endif /* TAO_ESF_PROXY_RB_TREE_CPP */

Generated on Thu Nov 9 13:08:13 2006 for TAO_ESF by doxygen 1.3.6