diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Notify/Refcountable.h')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Refcountable.h | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h index 33dbbb22ed7..77a45cd16fa 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h @@ -23,12 +23,10 @@ #include "tao/orbconf.h" #include "tao/corbafwd.h" -class TAO_NS_Destroy_Callback; - /** * @class TAO_NS_Refcountable * - * @brief Thread-safe refounting, calls a Destroy_Callback when refcount falls to 0. + * @brief Thread-safe refounting, calls the <release> method when refcount falls to 0. * */ class TAO_Notify_Export TAO_NS_Refcountable @@ -38,24 +36,41 @@ public: TAO_NS_Refcountable (void); /// Destructor - ~TAO_NS_Refcountable (); - - /// Set the destroy callback. - void destroy_callback (TAO_NS_Destroy_Callback* destroy_callback); + virtual ~TAO_NS_Refcountable (); /// This method sigantures deliberately match the RefCounting methods required for ESF Proxy CORBA::ULong _incr_refcnt (void); CORBA::ULong _decr_refcnt (void); + /// The release method is called when the refcount reaches 0. + virtual void release (void) = 0; + protected: /// The reference count. CORBA::ULong refcount_; /// The mutex to serialize access to state variables. TAO_SYNCH_MUTEX lock_; +}; + +/***********************************************************************/ + +/** + * @class TAO_NS_Refcountable_Guard + * + * @brief Ref. Count Guard + * Increments the reference count in the constructor, the count is decremented when the guard's is destructor. + * + */ +class TAO_Notify_Export TAO_NS_Refcountable_Guard +{ +public: + TAO_NS_Refcountable_Guard (TAO_NS_Refcountable& refcountable); + + ~TAO_NS_Refcountable_Guard (); - /// The callback when refcount falls to 0. - TAO_NS_Destroy_Callback* destroy_callback_; +protected: + TAO_NS_Refcountable& refcountable_; }; #if defined (__ACE_INLINE__) |