Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# TAO_RefCountServantBase Class Reference

Reference counting mix-in class. More...

`#include <Servant_Base.h>`

Inheritance diagram for TAO_RefCountServantBase:

[legend]
Collaboration diagram for TAO_RefCountServantBase:

[legend]
List of all members.

## Public Methods
| ~TAO_RefCountServantBase (void)
| Destructor.
virtual void | _add_ref (ACE_ENV_SINGLE_ARG_DECL)
| Increase reference count by one.
virtual void | _remove_ref (ACE_ENV_SINGLE_ARG_DECL)
virtual long | _ref_count (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const
## Protected Methods
| TAO_RefCountServantBase (void)
| Constructor: initial reference count is one.
| TAO_RefCountServantBase (const TAO_RefCountServantBase &)
TAO_RefCountServantBase & | operator= (const TAO_RefCountServantBase &)
## Private Attributes
ACE_Atomic_Op< TAO_SYNCH_MUTEX, long > | 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

void TAO_RefCountServantBase::_add_ref | ( | ACE_ENV_SINGLE_ARG_DECL |  | ) | `[virtual]`

| Increase reference count by one. Reimplemented from TAO_Abstract_ServantBase.

long TAO_RefCountServantBase::_ref_count | ( | ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS |  | ) | const`[virtual]`

| Returns the current reference count value. This method is non-standard and is only here to simplify debugging.

void TAO_RefCountServantBase::_remove_ref | ( | ACE_ENV_SINGLE_ARG_DECL |  | ) | `[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. Reimplemented from TAO_Abstract_ServantBase.

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, long> TAO_RefCountServantBase::ref_count_`[private]`

| Reference counter.

The documentation for this class was generated from the following files:

- Servant_Base.h
- Servant_Base.cpp