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

ACE_Atomic_Op Class Template Reference

Transparently parameterizes synchronization into basic arithmetic operations. More...

#include <Synch_T.h>

List of all members.

Public Methods

 ACE_Atomic_Op (void)
 Initialize <value_> to 0.

 ACE_Atomic_Op (const TYPE &c)
 Initialize <value_> to c.

TYPE operator++ (void)
 Atomically pre-increment <value_>.

TYPE operator++ (int)
 Atomically post-increment <value_>.

TYPE operator+= (const TYPE &i)
 Atomically increment <value_> by i.

TYPE operator-- (void)
 Atomically pre-decrement <value_>.

TYPE operator-- (int)
 Atomically post-decrement <value_>.

TYPE operator-= (const TYPE &i)
 Atomically decrement <value_> by i.

int operator== (const TYPE &i) const
 Atomically compare <value_> with i.

int operator!= (const TYPE &i) const
 Atomically compare <value_> with i.

int operator>= (const TYPE &i) const
 Atomically check if <value_> greater than or equal to i.

int operator> (const TYPE &rhs) const
 Atomically check if <value_> greater than i.

int operator<= (const TYPE &rhs) const
 Atomically check if <value_> less than or equal to i.

int operator< (const TYPE &rhs) const
 Atomically check if <value_> less than i.

void operator= (const TYPE &i)
 Atomically assign i to <value_>.

void operator= (const ACE_Atomic_Op<ACE_LOCK, TYPE> &rhs)
 Atomically assign <rhs> to <value_>.

TYPE value (void) const
 Explicitly return <value_>.

void dump (void) const
 Dump the state of an object.

 ACE_Atomic_Op (const ACE_Atomic_Op<ACE_LOCK, TYPE> &)
 Manage copying...

ACE_LOCK& mutex (void)
TYPE& value_i (void)

Private Attributes

ACE_LOCK mutex_
 Type of synchronization mechanism.

TYPE value_
 Current object decorated by the atomic op.


Detailed Description

template<class ACE_LOCK, class TYPE> template class ACE_Atomic_Op

Transparently parameterizes synchronization into basic arithmetic operations.

This class is described in an article in the July/August 1994 issue of the C++ Report magazine. It implements a templatized version of the Decorator pattern from the GoF book.


Constructor & Destructor Documentation

template<classACE_LOCK, classTYPE>
ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op<ACE_LOCK, TYPE> ( void )
 

Initialize <value_> to 0.

template<classACE_LOCK, classTYPE>
ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op<ACE_LOCK, TYPE> ( const TYPE & c )
 

Initialize <value_> to c.

template<classACE_LOCK, classTYPE>
ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op<ACE_LOCK, TYPE> ( const ACE_Atomic_Op< ACE_LOCK,TYPE >& rhs )
 

Manage copying...


Member Function Documentation

template<classACE_LOCK, classTYPE>
void ACE_Atomic_Op<ACE_LOCK, TYPE>::dump ( void ) const
 

Dump the state of an object.

template<classACE_LOCK, classTYPE>
ACE_LOCK & ACE_Atomic_Op<ACE_LOCK, TYPE>::mutex ( void )
 

Returns a reference to the underlying . This makes it possible to acquire the lock explicitly, which can be useful in some cases if you instantiate the with an or . NOTE: the right name would be lock_, but HP/C++ will choke on that!

template<classACE_LOCK, classTYPE>
int ACE_Atomic_Op<ACE_LOCK, TYPE>::operator!= ( const TYPE & i ) const
 

Atomically compare <value_> with i.

template<classACE_LOCK, classTYPE>
TYPE ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ ( int )
 

Atomically post-increment <value_>.

template<classACE_LOCK, classTYPE>
TYPE ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ ( void )
 

Atomically pre-increment <value_>.

template<classACE_LOCK, classTYPE>
TYPE ACE_Atomic_Op<ACE_LOCK, TYPE>::operator+= ( const TYPE & i )
 

Atomically increment <value_> by i.

template<classACE_LOCK, classTYPE>
TYPE ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- ( int )
 

Atomically post-decrement <value_>.

template<classACE_LOCK, classTYPE>
TYPE ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- ( void )
 

Atomically pre-decrement <value_>.

template<classACE_LOCK, classTYPE>
TYPE ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-= ( const TYPE & i )
 

Atomically decrement <value_> by i.

template<classACE_LOCK, classTYPE>
int ACE_Atomic_Op<ACE_LOCK, TYPE>::operator< ( const TYPE & rhs ) const
 

Atomically check if <value_> less than i.

template<classACE_LOCK, classTYPE>
int ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<= ( const TYPE & rhs ) const
 

Atomically check if <value_> less than or equal to i.

template<classACE_LOCK, classTYPE>
void ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= ( const ACE_Atomic_Op< ACE_LOCK,TYPE >& rhs )
 

Atomically assign <rhs> to <value_>.

template<classACE_LOCK, classTYPE>
void ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= ( const TYPE & i )
 

Atomically assign i to <value_>.

template<classACE_LOCK, classTYPE>
int ACE_Atomic_Op<ACE_LOCK, TYPE>::operator== ( const TYPE & i ) const
 

Atomically compare <value_> with i.

template<classACE_LOCK, classTYPE>
int ACE_Atomic_Op<ACE_LOCK, TYPE>::operator> ( const TYPE & rhs ) const
 

Atomically check if <value_> greater than i.

template<classACE_LOCK, classTYPE>
int ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>= ( const TYPE & i ) const
 

Atomically check if <value_> greater than or equal to i.

template<classACE_LOCK, classTYPE>
TYPE ACE_Atomic_Op<ACE_LOCK, TYPE>::value ( void ) const
 

Explicitly return <value_>.

template<classACE_LOCK, classTYPE>
TYPE & ACE_Atomic_Op<ACE_LOCK, TYPE>::value_i ( void )
 

Explicitly return <value_> (by reference). This gives the user full, unrestricted access to the underlying value. This method will usually be used in conjunction with explicit access to the lock. Use with care ;-)


Member Data Documentation

template<classACE_LOCK, classTYPE>
ACE_LOCK ACE_Atomic_Op<ACE_LOCK, TYPE>::mutex_ [private]
 

Type of synchronization mechanism.

template<classACE_LOCK, classTYPE>
TYPE ACE_Atomic_Op<ACE_LOCK, TYPE>::value_ [private]
 

Current object decorated by the atomic op.


The documentation for this class was generated from the following files:
Generated at Fri Oct 5 07:01:20 2001 for ACE by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000