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

# ACE_Atomic_Op_Ex Class Template Reference

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

`#include <Atomic_Op_T.h>`

Collaboration diagram for ACE_Atomic_Op_Ex:

[legend]
List of all members.

## Public Methods
| ACE_Atomic_Op_Ex (ACE_LOCK &mtx)
| Initialize <value_> to 0. More...
| ACE_Atomic_Op_Ex (ACE_LOCK &mtx, const TYPE &c)
| Initialize <value_> to c. More...
TYPE | operator++ (void)
| Atomically pre-increment <value_>. More...
TYPE | operator++ (int)
| Atomically post-increment <value_>. More...
TYPE | operator+= (const TYPE &rhs)
| Atomically increment <value_> by rhs. More...
TYPE | operator-- (void)
| Atomically pre-decrement <value_>. More...
TYPE | operator-- (int)
| Atomically post-decrement <value_>. More...
TYPE | operator-= (const TYPE &rhs)
| Atomically decrement <value_> by rhs. More...
int | operator== (const TYPE &rhs) const
| Atomically compare <value_> with rhs. More...
int | operator!= (const TYPE &rhs) const
| Atomically compare <value_> with rhs. More...
int | operator>= (const TYPE &rhs) const
| Atomically check if <value_> greater than or equal to rhs. More...
int | operator> (const TYPE &rhs) const
| Atomically check if <value_> greater than rhs. More...
int | operator<= (const TYPE &rhs) const
| Atomically check if <value_> less than or equal to rhs. More...
int | operator< (const TYPE &rhs) const
| Atomically check if <value_> less than rhs. More...
void | operator= (const TYPE &rhs)
| Atomically assign rhs to <value_>. More...
void | operator= (const ACE_Atomic_Op_Ex< ACE_LOCK, TYPE > &rhs)
| Atomically assign <rhs> to <value_>. More...
TYPE | value (void) const
| Explicitly return <value_>. More...
void | dump (void) const
| Dump the state of an object. More...
| ACE_Atomic_Op_Ex (const ACE_Atomic_Op_Ex< ACE_LOCK, TYPE > &)
| Manage copying... More...
ACE_LOCK & | mutex (void)
| Returns a reference to the underlying <ACE_LOCK>. More...
TYPE & | value_i (void)
| Explicitly return <value_> (by reference). More...
## Private Attributes
ACE_LOCK & | mutex_
| Type of synchronization mechanism. More...
TYPE | value_
| Current object decorated by the atomic op. More...

## Detailed Description

### template<class ACE_LOCK, class TYPE>
class ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >

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.

ACE_Atomic_Op_Ex objects must be constructed with a reference to an existing lock. A single lock can be shared between multiple ACE_Atomic_Op_Ex objects. If you do not require this ability consider using the ACE_Atomic_Op class instead, which may be able to take advantage of platform-specific optimisations to provide atomic operations without requiring a lock.

## Constructor & Destructor Documentation

template<class ACE_LOCK, class TYPE>
ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::ACE_Atomic_Op_Ex | ( | ACE_LOCK & | mtx | ) |

| Initialize <value_> to 0.

template<class ACE_LOCK, class TYPE>
ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::ACE_Atomic_Op_Ex | ( | ACE_LOCK & | mtx,
|  | const TYPE & | c
| ) |

| Initialize <value_> to c.

template<class ACE_LOCK, class TYPE>
ACE_INLINE ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::ACE_Atomic_Op_Ex | ( | const ACE_Atomic_Op_Ex< ACE_LOCK, TYPE > & | rhs | ) |

| Manage copying...

## Member Function Documentation

template<class ACE_LOCK, class TYPE>
void ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::dump | ( | void |  | ) | const

| Dump the state of an object.

template<class ACE_LOCK, class TYPE>
ACE_LOCK & ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::mutex | ( | void |  | ) |

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

template<class ACE_LOCK, class TYPE>
ACE_INLINE int ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator!= | ( | const TYPE & | rhs | ) | const

| Atomically compare <value_> with rhs.

template<class ACE_LOCK, class TYPE>
ACE_INLINE TYPE ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator++ | ( | int |  | ) |

| Atomically post-increment <value_>.

template<class ACE_LOCK, class TYPE>
ACE_INLINE TYPE ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator++ | ( | void |  | ) |

| Atomically pre-increment <value_>.

template<class ACE_LOCK, class TYPE>
ACE_INLINE TYPE ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator+= | ( | const TYPE & | rhs | ) |

| Atomically increment <value_> by rhs.

template<class ACE_LOCK, class TYPE>
ACE_INLINE TYPE ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator-- | ( | int |  | ) |

| Atomically post-decrement <value_>.

template<class ACE_LOCK, class TYPE>
ACE_INLINE TYPE ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator-- | ( | void |  | ) |

| Atomically pre-decrement <value_>.

template<class ACE_LOCK, class TYPE>
ACE_INLINE TYPE ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator-= | ( | const TYPE & | rhs | ) |

| Atomically decrement <value_> by rhs.

template<class ACE_LOCK, class TYPE>
ACE_INLINE int ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator< | ( | const TYPE & | rhs | ) | const

| Atomically check if <value_> less than rhs.

template<class ACE_LOCK, class TYPE>
ACE_INLINE int ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator<= | ( | const TYPE & | rhs | ) | const

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

template<class ACE_LOCK, class TYPE>
ACE_INLINE void ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator= | ( | const ACE_Atomic_Op_Ex< ACE_LOCK, TYPE > & | rhs | ) |

| Atomically assign <rhs> to <value_>.

template<class ACE_LOCK, class TYPE>
ACE_INLINE void ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator= | ( | const TYPE & | rhs | ) |

| Atomically assign rhs to <value_>.

template<class ACE_LOCK, class TYPE>
ACE_INLINE int ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator== | ( | const TYPE & | rhs | ) | const

| Atomically compare <value_> with rhs.

template<class ACE_LOCK, class TYPE>
ACE_INLINE int ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator> | ( | const TYPE & | rhs | ) | const

| Atomically check if <value_> greater than rhs.

template<class ACE_LOCK, class TYPE>
ACE_INLINE int ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::operator>= | ( | const TYPE & | rhs | ) | const

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

template<class ACE_LOCK, class TYPE>
ACE_INLINE TYPE ACE_Atomic_Op_Ex< ACE_LOCK, TYPE >::value | ( | void |  | ) | const

| Explicitly return <value_>.

template<class ACE_LOCK, class TYPE>
ACE_INLINE TYPE & ACE_Atomic_Op_Ex< 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<class ACE_LOCK, class TYPE>
ACE_LOCK& ACE_Atomic_Op_Ex::mutex_`[private]`

| Type of synchronization mechanism.

template<class ACE_LOCK, class TYPE>
TYPE ACE_Atomic_Op_Ex::value_`[private]`

| Current object decorated by the atomic op.

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

- Atomic_Op_T.h
- Atomic_Op_T.cpp
- Atomic_Op_T.i