ACE  6.3.3
Public Types | Public Member Functions | Private Attributes | List of all members
ACE_Atomic_Op< ACE_LOCK, TYPE > Class Template Reference

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

#include <Atomic_Op_T.h>

Collaboration diagram for ACE_Atomic_Op< ACE_LOCK, TYPE >:
Collaboration graph
[legend]

Public Types

typedef ACE_Type_Traits< TYPE >::parameter_type arg_type
 

Public Member Functions

 ACE_Atomic_Op (void)
 Initialize value_ to 0. More...
 
 ACE_Atomic_Op (arg_type c)
 Initialize value_ to c. More...
 
 ACE_Atomic_Op (ACE_Atomic_Op< ACE_LOCK, TYPE > const &c)
 Manage copying... More...
 
ACE_Atomic_Op< ACE_LOCK, TYPE > & operator= (arg_type rhs)
 Atomically assign rhs to value_. More...
 
ACE_Atomic_Op< ACE_LOCK, TYPE > & operator= (ACE_Atomic_Op< ACE_LOCK, TYPE > const &rhs)
 Atomically assign rhs to value_. More...
 
TYPE operator++ (void)
 Atomically pre-increment value_. More...
 
TYPE operator++ (int)
 Atomically post-increment value_. More...
 
TYPE operator+= (arg_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-= (arg_type rhs)
 Atomically decrement value_ by rhs. More...
 
bool operator== (arg_type rhs) const
 Atomically compare value_ with rhs. More...
 
bool operator!= (arg_type rhs) const
 Atomically compare value_ with rhs. More...
 
bool operator>= (arg_type rhs) const
 Atomically check if value_ greater than or equal to rhs. More...
 
bool operator> (arg_type rhs) const
 Atomically check if value_ greater than rhs. More...
 
bool operator<= (arg_type rhs) const
 Atomically check if value_ less than or equal to rhs. More...
 
bool operator< (arg_type rhs) const
 Atomically check if value_ less than rhs. More...
 
TYPE exchange (TYPE newval)
 Exchange value with newval. More...
 
TYPE value (void) const
 Explicitly return value_. More...
 
void dump (void) const
 Dump the state of an object. More...
 
TYPE & value_i (void)
 

Private Attributes

ACE_LOCK own_mutex_
 Type of synchronization mechanism. More...
 
ACE_Atomic_Op_Ex< ACE_LOCK, TYPE > impl_
 Underlying atomic op implementation. More...
 

Detailed Description

template<class ACE_LOCK, typename TYPE>
class ACE_Atomic_Op< 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.

Certain platforms may provide a template specialization for ACE_Atomic_Op <ACE_Thread_Mutex, long> that provides optimized atomic integer operations without actually requiring a mutex.

Member Typedef Documentation

template<class ACE_LOCK, typename TYPE>
typedef ACE_Type_Traits<TYPE>::parameter_type ACE_Atomic_Op< ACE_LOCK, TYPE >::arg_type

Constructor & Destructor Documentation

template<class ACE_LOCK , class TYPE >
ACE_Atomic_Op< ACE_LOCK, TYPE >::ACE_Atomic_Op ( void  )

Initialize value_ to 0.

template<class ACE_LOCK, typename TYPE>
ACE_Atomic_Op< ACE_LOCK, TYPE >::ACE_Atomic_Op ( arg_type  c)

Initialize value_ to c.

template<class ACE_LOCK, class TYPE>
ACE_Atomic_Op< ACE_LOCK, TYPE >::ACE_Atomic_Op ( ACE_Atomic_Op< ACE_LOCK, TYPE > const &  c)
inline

Manage copying...

Member Function Documentation

template<class ACE_LOCK , class TYPE >
void ACE_Atomic_Op< ACE_LOCK, TYPE >::dump ( void  ) const
inline

Dump the state of an object.

template<class ACE_LOCK , class TYPE>
TYPE ACE_Atomic_Op< ACE_LOCK, TYPE >::exchange ( TYPE  newval)
inline

Exchange value with newval.

template<class ACE_LOCK, typename TYPE>
bool ACE_Atomic_Op< ACE_LOCK, TYPE >::operator!= ( arg_type  rhs) const
inline

Atomically compare value_ with rhs.

template<class ACE_LOCK , class TYPE >
TYPE ACE_Atomic_Op< ACE_LOCK, TYPE >::operator++ ( void  )
inline

Atomically pre-increment value_.

template<class ACE_LOCK , class TYPE >
TYPE ACE_Atomic_Op< ACE_LOCK, TYPE >::operator++ ( int  )
inline

Atomically post-increment value_.

template<class ACE_LOCK, typename TYPE>
TYPE ACE_Atomic_Op< ACE_LOCK, TYPE >::operator+= ( arg_type  rhs)
inline

Atomically increment value_ by rhs.

template<class ACE_LOCK , class TYPE >
TYPE ACE_Atomic_Op< ACE_LOCK, TYPE >::operator-- ( void  )
inline

Atomically pre-decrement value_.

template<class ACE_LOCK , class TYPE >
TYPE ACE_Atomic_Op< ACE_LOCK, TYPE >::operator-- ( int  )
inline

Atomically post-decrement value_.

template<class ACE_LOCK, typename TYPE>
TYPE ACE_Atomic_Op< ACE_LOCK, TYPE >::operator-= ( arg_type  rhs)
inline

Atomically decrement value_ by rhs.

template<class ACE_LOCK, typename TYPE>
bool ACE_Atomic_Op< ACE_LOCK, TYPE >::operator< ( arg_type  rhs) const
inline

Atomically check if value_ less than rhs.

template<class ACE_LOCK, typename TYPE>
bool ACE_Atomic_Op< ACE_LOCK, TYPE >::operator<= ( arg_type  rhs) const
inline

Atomically check if value_ less than or equal to rhs.

template<class ACE_LOCK, typename TYPE>
ACE_Atomic_Op<ACE_LOCK, TYPE>& ACE_Atomic_Op< ACE_LOCK, TYPE >::operator= ( arg_type  rhs)

Atomically assign rhs to value_.

template<class ACE_LOCK, class TYPE>
ACE_Atomic_Op< ACE_LOCK, TYPE > & ACE_Atomic_Op< ACE_LOCK, TYPE >::operator= ( ACE_Atomic_Op< ACE_LOCK, TYPE > const &  rhs)
inline

Atomically assign rhs to value_.

template<class ACE_LOCK, typename TYPE>
bool ACE_Atomic_Op< ACE_LOCK, TYPE >::operator== ( arg_type  rhs) const
inline

Atomically compare value_ with rhs.

template<class ACE_LOCK, typename TYPE>
bool ACE_Atomic_Op< ACE_LOCK, TYPE >::operator> ( arg_type  rhs) const
inline

Atomically check if value_ greater than rhs.

template<class ACE_LOCK, typename TYPE>
bool ACE_Atomic_Op< ACE_LOCK, TYPE >::operator>= ( arg_type  rhs) const
inline

Atomically check if value_ greater than or equal to rhs.

template<class ACE_LOCK , class TYPE >
TYPE ACE_Atomic_Op< ACE_LOCK, TYPE >::value ( void  ) const
inline

Explicitly return value_.

template<class ACE_LOCK , class TYPE >
TYPE & ACE_Atomic_Op< ACE_LOCK, TYPE >::value_i ( void  )
inline

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, typename TYPE>
ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> ACE_Atomic_Op< ACE_LOCK, TYPE >::impl_
private

Underlying atomic op implementation.

template<class ACE_LOCK, typename TYPE>
ACE_LOCK ACE_Atomic_Op< ACE_LOCK, TYPE >::own_mutex_
private

Type of synchronization mechanism.


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