TAO_RefCountServantBase Class Reference

Reference counting mix-in class. More...

#include <Servant_Base.h>

Inheritance diagram for TAO_RefCountServantBase:

Inheritance graph
[legend]
Collaboration diagram for TAO_RefCountServantBase:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ~TAO_RefCountServantBase (void)
 Destructor.
virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
 Increase reference count by one.
virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
virtual CORBA::ULong _refcount_value (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const

Protected Member Functions

 TAO_RefCountServantBase (void)
 Constructor: initial reference count is one.
 TAO_RefCountServantBase (const TAO_RefCountServantBase &)
TAO_RefCountServantBaseoperator= (const TAO_RefCountServantBase &)

Private Attributes

ACE_Atomic_Op< TAO_SYNCH_MUTEX,
CORBA::ULong
ref_count_
 Reference counter.

Detailed Description

Reference counting mix-in class.

The RefCountServantBase mix-in class overrides the inherited _add_ref and _remove_ref functions it inherits from ServantBase, implementing them to provide true reference counting. An instance of a servant class derived from RefCountServantBase initially has a reference count of one. Invoking _add_ref on the servant instance increases its reference count by one. Invoking _remove_ref on the servant instance decreases its reference count by one; if the resulting reference count equals zero, _remove_ref invokes delete on its this pointer in order to destroy the servant. For ORBs that operate in multi-threaded environments, the implementations of _add_ref and _remove_ref that the RefCountServantBase class provides shall be thread-safe.

Like ServantBase, RefCountServantBase supports copy construction and the default assignment operation. Copy construction always sets the reference count of the new servant instance to one. The default assignment implementation merely returns *this and does not affect the reference count.


Constructor & Destructor Documentation

TAO_RefCountServantBase::~TAO_RefCountServantBase void   ) 
 

Destructor.

TAO_RefCountServantBase::TAO_RefCountServantBase void   )  [protected]
 

Constructor: initial reference count is one.

TAO_RefCountServantBase::TAO_RefCountServantBase const TAO_RefCountServantBase  )  [protected]
 

Copy Constructor: Always sets the reference count of the new servant instance to one.


Member Function Documentation

virtual void TAO_RefCountServantBase::_add_ref ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS   )  [virtual]
 

Increase reference count by one.

virtual CORBA::ULong TAO_RefCountServantBase::_refcount_value ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS   )  const [virtual]
 

Returns the current reference count value.

virtual void TAO_RefCountServantBase::_remove_ref ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS   )  [virtual]
 

Decreases reference count by one; if the resulting reference count equals zero, _remove_ref invokes delete on its this pointer in order to destroy the servant.

TAO_RefCountServantBase & TAO_RefCountServantBase::operator= const TAO_RefCountServantBase  )  [protected]
 

The default assignment implementation merely returns *this and does not affect the reference count.


Member Data Documentation

ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> TAO_RefCountServantBase::ref_count_ [private]
 

Reference counter.


The documentation for this class was generated from the following files:
Generated on Wed Nov 23 16:09:57 2005 for TAO_PortableServer by  doxygen 1.4.5