ESF_Proxy_RB_Tree.cpp

Go to the documentation of this file.
00001 // $Id: ESF_Proxy_RB_Tree.cpp 76589 2007-01-25 18:04:11Z elliott_c $
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.inl"
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 {
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 }
00038 
00039 template<class PROXY> void
00040 TAO_ESF_Proxy_RB_Tree<PROXY>::reconnected (PROXY *proxy)
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 }
00060 
00061 template<class PROXY> void
00062 TAO_ESF_Proxy_RB_Tree<PROXY>::disconnected (PROXY *proxy)
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 }
00073 
00074 template<class PROXY> void
00075 TAO_ESF_Proxy_RB_Tree<PROXY>::shutdown (void)
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 }
00085 
00086 TAO_END_VERSIONED_NAMESPACE_DECL
00087 
00088 #endif /* TAO_ESF_PROXY_RB_TREE_CPP */

Generated on Tue Feb 2 17:43:47 2010 for TAO_ESF by  doxygen 1.4.7