NAME
ACE_Atomic_Op -
Transparently parameterizes synchronization into basic
arithmetic operations.
SYNOPSIS
#include <ace/Synch_T.h>
template<class LOCK, class TYPE>
class ACE_Atomic_Op
{
public:
ACE_Atomic_Op (void);
ACE_Atomic_Op (TYPE c);
TYPE operator++ (void);
TYPE operator++ (int);
TYPE operator+= (const TYPE i);
TYPE operator-- (void);
TYPE operator-- (int);
TYPE operator-= (const TYPE i);
TYPE operator== (const TYPE i) const;
TYPE operator>= (const TYPE i) const;
TYPE operator> (const TYPE rhs) const;
TYPE operator<= (const TYPE rhs) const;
TYPE operator< (const TYPE rhs) const;
void operator= (const TYPE i);
void operator= (const ACE_Atomic_Op<LOCK, TYPE> &rhs);
operator TYPE () const;
void dump (void) const;
ACE_Atomic_Op (const ACE_Atomic_Op<LOCK, TYPE> &);
private:
LOCK lock_;
TYPE value_;
};
DESCRIPTION
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.
PUBLIC MEMBERS
ACE_Atomic_Op (void);
ACE_Atomic_Op (TYPE c);
TYPE operator++ (void);
Atomically pre-increment count_.
TYPE operator++ (int);
Atomically post-increment count_.
TYPE operator+= (const TYPE i);
Atomically increment count_ by inc.
TYPE operator-- (void);
Atomically pre-decrement count_.
TYPE operator-- (int);
Atomically post-decrement count_.
TYPE operator-= (const TYPE i);
Atomically decrement count_ by dec.
TYPE operator== (const TYPE i) const;
Atomically compare count_ with rhs.
TYPE operator>= (const TYPE i) const;
Atomically check if count_ greater than or equal to rhs.
TYPE operator> (const TYPE rhs) const;
Atomically check if count_ greater than rhs.
TYPE operator<= (const TYPE rhs) const;
Atomically check if count_ less than or equal to rhs.
TYPE operator< (const TYPE rhs) const;
Atomically check if count_ less than rhs.
void operator= (const TYPE i);
Atomically assign rhs to count_.
void operator= (const ACE_Atomic_Op<LOCK, TYPE> &rhs);
Atomically assign rhs to count_.
operator TYPE () const;
Atomically return count_.
void dump (void) const;
Dump the state of an object.
ACE_Atomic_Op (const ACE_Atomic_Op<LOCK, TYPE> &);
PRIVATE MEMBERS
LOCK lock_;
Type of synchronization mechanism.
TYPE value_;
Current object decorated by the atomic op.
AUTHOR
Doug Schmidt
LIBRARY
ace