TwiceAsNice  2019-02-18
Public Member Functions | Private Attributes | List of all members
Nice::Atomic< T > Class Template Reference

Class to make a integer type variable or a class thread save. More...

#include <Atomic.hh>

Collaboration diagram for Nice::Atomic< T >:
Collaboration graph

Public Member Functions

 Atomic ()
 Initialize <m_value> to 0. More...
 
 Atomic (T c)
 Initialize <m_value> to c. More...
 
 Atomic (const Atomic &_c)
 Manage copying... More...
 
void operator= (T rhs)
 Atomically assign rhs to <m_value>. More...
 
void operator= (const Atomic &rhs)
 Atomically assign <rhs> to <m_value>. More...
 
 operator T ()
 Implicitly return <m_value>. More...
 
value (void) const
 Explicitly return <m_value>. More...
 
get (void) const
 Explicitly return <m_value>. More...
 
operator! ()
 Atomically negate <m_value>. More...
 
operator++ (void)
 Atomically pre-increment <m_value>. More...
 
operator++ (int)
 Atomically post-increment <m_value>. More...
 
operator+= (T rhs)
 Atomically increment <m_value> by rhs. More...
 
operator-- (void)
 Atomically pre-decrement <m_value>. More...
 
operator-- (int)
 Atomically post-decrement <m_value>. More...
 
operator-= (T rhs)
 Atomically decrement <m_value> by rhs. More...
 
int operator== (T rhs) const
 Atomically compare <m_value> with rhs. More...
 
int operator!= (T rhs) const
 Atomically compare <m_value> with rhs. More...
 
int operator>= (T rhs) const
 Atomically check if <m_value> greater than or equal to rhs. More...
 
int operator> (T rhs) const
 Atomically check if <m_value> greater than rhs. More...
 
int operator<= (T rhs) const
 Atomically check if <m_value> less than or equal to rhs. More...
 
int operator< (T rhs) const
 Atomically check if <m_value> less than rhs. More...
 
template<typename TypeMemFn >
void change (TypeMemFn _memfun)
 
template<typename TypeMemFn , typename TypeVal1 >
void change (TypeMemFn _memfun, const TypeVal1 &_val1)
 
template<typename TypeMemFn , typename TypeVal1 , typename TypeVal2 >
void change (TypeMemFn _memfun, const TypeVal1 &_val1, const TypeVal2 _val2)
 
 Atomic ()
 Initialize <m_value> to 0. More...
 
 Atomic (T c)
 Initialize <m_value> to c. More...
 
 Atomic (const Atomic &_c)
 Manage copying... More...
 
void operator= (T rhs)
 Atomically assign rhs to <m_value>. More...
 
void operator= (const Atomic &rhs)
 Atomically assign <rhs> to <m_value>. More...
 
 operator T ()
 Implicitly return <m_value>. More...
 
value (void) const
 Explicitly return <m_value>. More...
 
get (void) const
 Explicitly return <m_value>. More...
 
operator! ()
 Atomically negate <m_value>. More...
 
operator++ (void)
 Atomically pre-increment <m_value>. More...
 
operator++ (int)
 Atomically post-increment <m_value>. More...
 
operator+= (T rhs)
 Atomically increment <m_value> by rhs. More...
 
operator-- (void)
 Atomically pre-decrement <m_value>. More...
 
operator-- (int)
 Atomically post-decrement <m_value>. More...
 
operator-= (T rhs)
 Atomically decrement <m_value> by rhs. More...
 
int operator== (T rhs) const
 Atomically compare <m_value> with rhs. More...
 
int operator!= (T rhs) const
 Atomically compare <m_value> with rhs. More...
 
int operator>= (T rhs) const
 Atomically check if <m_value> greater than or equal to rhs. More...
 
int operator> (T rhs) const
 Atomically check if <m_value> greater than rhs. More...
 
int operator<= (T rhs) const
 Atomically check if <m_value> less than or equal to rhs. More...
 
int operator< (T rhs) const
 Atomically check if <m_value> less than rhs. More...
 
template<typename TypeMemFn >
void change (TypeMemFn _memfun)
 
template<typename TypeMemFn , typename TypeVal1 >
void change (TypeMemFn _memfun, const TypeVal1 &_val1)
 
template<typename TypeMemFn , typename TypeVal1 , typename TypeVal2 >
void change (TypeMemFn _memfun, const TypeVal1 &_val1, const TypeVal2 _val2)
 

Private Attributes

m_value
 Current object decorated by the atomic op. More...
 
Nice::Mutex m_mutex
 the mutex that protects the variable More...
 

Detailed Description

template<class T>
class Nice::Atomic< T >

Class to make a integer type variable or a class thread save.

Author
Florian Briegel
Version
11.02.04
Date
2012-08-10 11:04:58 AM

Constructor & Destructor Documentation

◆ Atomic() [1/6]

template<class T>
Nice::Atomic< T >::Atomic ( )
inline

Initialize <m_value> to 0.

◆ Atomic() [2/6]

template<class T>
Nice::Atomic< T >::Atomic ( c)
inline

Initialize <m_value> to c.

◆ Atomic() [3/6]

template<class T>
Nice::Atomic< T >::Atomic ( const Atomic< T > &  _c)
inline

Manage copying...

◆ Atomic() [4/6]

template<class T>
Nice::Atomic< T >::Atomic ( )
inline

Initialize <m_value> to 0.

◆ Atomic() [5/6]

template<class T>
Nice::Atomic< T >::Atomic ( c)
inline

Initialize <m_value> to c.

◆ Atomic() [6/6]

template<class T>
Nice::Atomic< T >::Atomic ( const Atomic< T > &  _c)
inline

Manage copying...

Member Function Documentation

◆ change() [1/6]

template<class T>
template<typename TypeMemFn >
void Nice::Atomic< T >::change ( TypeMemFn  _memfun)
inline

◆ change() [2/6]

template<class T>
template<typename TypeMemFn >
void Nice::Atomic< T >::change ( TypeMemFn  _memfun)
inline

◆ change() [3/6]

template<class T>
template<typename TypeMemFn , typename TypeVal1 >
void Nice::Atomic< T >::change ( TypeMemFn  _memfun,
const TypeVal1 &  _val1 
)
inline

◆ change() [4/6]

template<class T>
template<typename TypeMemFn , typename TypeVal1 >
void Nice::Atomic< T >::change ( TypeMemFn  _memfun,
const TypeVal1 &  _val1 
)
inline

◆ change() [5/6]

template<class T>
template<typename TypeMemFn , typename TypeVal1 , typename TypeVal2 >
void Nice::Atomic< T >::change ( TypeMemFn  _memfun,
const TypeVal1 &  _val1,
const TypeVal2  _val2 
)
inline

◆ change() [6/6]

template<class T>
template<typename TypeMemFn , typename TypeVal1 , typename TypeVal2 >
void Nice::Atomic< T >::change ( TypeMemFn  _memfun,
const TypeVal1 &  _val1,
const TypeVal2  _val2 
)
inline

◆ get() [1/2]

template<class T>
T Nice::Atomic< T >::get ( void  ) const
inline

Explicitly return <m_value>.

◆ get() [2/2]

template<class T>
T Nice::Atomic< T >::get ( void  ) const
inline

Explicitly return <m_value>.

◆ operator T() [1/2]

template<class T>
Nice::Atomic< T >::operator T ( )
inline

Implicitly return <m_value>.

◆ operator T() [2/2]

template<class T>
Nice::Atomic< T >::operator T ( )
inline

Implicitly return <m_value>.

◆ operator!() [1/2]

template<class T>
T Nice::Atomic< T >::operator! ( )
inline

Atomically negate <m_value>.

◆ operator!() [2/2]

template<class T>
T Nice::Atomic< T >::operator! ( )
inline

Atomically negate <m_value>.

◆ operator!=() [1/2]

template<class T>
int Nice::Atomic< T >::operator!= ( rhs) const
inline

Atomically compare <m_value> with rhs.

◆ operator!=() [2/2]

template<class T>
int Nice::Atomic< T >::operator!= ( rhs) const
inline

Atomically compare <m_value> with rhs.

◆ operator++() [1/4]

template<class T>
T Nice::Atomic< T >::operator++ ( void  )
inline

Atomically pre-increment <m_value>.

◆ operator++() [2/4]

template<class T>
T Nice::Atomic< T >::operator++ ( void  )
inline

Atomically pre-increment <m_value>.

◆ operator++() [3/4]

template<class T>
T Nice::Atomic< T >::operator++ ( int  )
inline

Atomically post-increment <m_value>.

◆ operator++() [4/4]

template<class T>
T Nice::Atomic< T >::operator++ ( int  )
inline

Atomically post-increment <m_value>.

◆ operator+=() [1/2]

template<class T>
T Nice::Atomic< T >::operator+= ( rhs)
inline

Atomically increment <m_value> by rhs.

◆ operator+=() [2/2]

template<class T>
T Nice::Atomic< T >::operator+= ( rhs)
inline

Atomically increment <m_value> by rhs.

◆ operator--() [1/4]

template<class T>
T Nice::Atomic< T >::operator-- ( void  )
inline

Atomically pre-decrement <m_value>.

◆ operator--() [2/4]

template<class T>
T Nice::Atomic< T >::operator-- ( void  )
inline

Atomically pre-decrement <m_value>.

◆ operator--() [3/4]

template<class T>
T Nice::Atomic< T >::operator-- ( int  )
inline

Atomically post-decrement <m_value>.

◆ operator--() [4/4]

template<class T>
T Nice::Atomic< T >::operator-- ( int  )
inline

Atomically post-decrement <m_value>.

◆ operator-=() [1/2]

template<class T>
T Nice::Atomic< T >::operator-= ( rhs)
inline

Atomically decrement <m_value> by rhs.

◆ operator-=() [2/2]

template<class T>
T Nice::Atomic< T >::operator-= ( rhs)
inline

Atomically decrement <m_value> by rhs.

◆ operator<() [1/2]

template<class T>
int Nice::Atomic< T >::operator< ( rhs) const
inline

Atomically check if <m_value> less than rhs.

◆ operator<() [2/2]

template<class T>
int Nice::Atomic< T >::operator< ( rhs) const
inline

Atomically check if <m_value> less than rhs.

◆ operator<=() [1/2]

template<class T>
int Nice::Atomic< T >::operator<= ( rhs) const
inline

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

◆ operator<=() [2/2]

template<class T>
int Nice::Atomic< T >::operator<= ( rhs) const
inline

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

◆ operator=() [1/4]

template<class T>
void Nice::Atomic< T >::operator= ( rhs)
inline

Atomically assign rhs to <m_value>.

◆ operator=() [2/4]

template<class T>
void Nice::Atomic< T >::operator= ( rhs)
inline

Atomically assign rhs to <m_value>.

◆ operator=() [3/4]

template<class T>
void Nice::Atomic< T >::operator= ( const Atomic< T > &  rhs)
inline

Atomically assign <rhs> to <m_value>.

◆ operator=() [4/4]

template<class T>
void Nice::Atomic< T >::operator= ( const Atomic< T > &  rhs)
inline

Atomically assign <rhs> to <m_value>.

◆ operator==() [1/2]

template<class T>
int Nice::Atomic< T >::operator== ( rhs) const
inline

Atomically compare <m_value> with rhs.

◆ operator==() [2/2]

template<class T>
int Nice::Atomic< T >::operator== ( rhs) const
inline

Atomically compare <m_value> with rhs.

◆ operator>() [1/2]

template<class T>
int Nice::Atomic< T >::operator> ( rhs) const
inline

Atomically check if <m_value> greater than rhs.

◆ operator>() [2/2]

template<class T>
int Nice::Atomic< T >::operator> ( rhs) const
inline

Atomically check if <m_value> greater than rhs.

◆ operator>=() [1/2]

template<class T>
int Nice::Atomic< T >::operator>= ( rhs) const
inline

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

◆ operator>=() [2/2]

template<class T>
int Nice::Atomic< T >::operator>= ( rhs) const
inline

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

◆ value() [1/2]

template<class T>
T Nice::Atomic< T >::value ( void  ) const
inline

Explicitly return <m_value>.

◆ value() [2/2]

template<class T>
T Nice::Atomic< T >::value ( void  ) const
inline

Explicitly return <m_value>.

Member Data Documentation

◆ m_mutex

template<class T>
Nice::Mutex Nice::Atomic< T >::m_mutex
private

the mutex that protects the variable


◆ m_value

template<class T>
T Nice::Atomic< T >::m_value
private

Current object decorated by the atomic op.


the value that is read-writable secured by a mutex.


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