Public Member Functions | Protected Attributes

zeus::TAtomicValueType< T > Class Template Reference

#include <AtomicValueType.hpp>

Inheritance diagram for zeus::TAtomicValueType< T >:
zeus::TZObject zeus::IZUnknown

List of all members.

Public Member Functions

 TAtomicValueType ()
 TAtomicValueType (T tValue)
 TAtomicValueType (const TAtomicValueType< T > &rValue)
virtual ~TAtomicValueType ()
addAndGet (T tValue)
bool compareAndSet (T tExpectedValue, T tUpdate)
decrementAndGet ()
divideAndGet (T tValue)
bool equals (T tExpectedValue) const
const T getAndDecrement ()
const T getAndIncrement ()
getValue ()
getValue () const
incrementAndGet ()
multiplyAndGet (T tValue)
void setValue (T tValue)
TAtomicValueType< T > & operator+= (const T tValue)
TAtomicValueType< T > & operator-= (const T tValue)
TAtomicValueType< T > & operator*= (const T tValue)
TAtomicValueType< T > & operator/= (const T tValue)
TAtomicValueType< T > & operator= (const TAtomicValueType< T > &rInVal)
TAtomicValueType< T > & operator= (T tValue)
bool operator== (const T tValue) const
bool operator== (const int iValue) const
bool operator!= (const T tValue) const
bool operator!= (const int iValue) const
const T operator++ ()
const T operator-- ()
operator++ (int)
operator-- (int)
 operator T () const

Protected Attributes

m_tValue
 internal value
TCriticalSectionm_rLock
 Lock of the atomic value.

Detailed Description

template<class T>
class zeus::TAtomicValueType< T >

An atomic value is secure for multithreading access while manipulation the content of the value.


Constructor & Destructor Documentation

template<class T >
zeus::TAtomicValueType< T >::TAtomicValueType (  ) [inline]

Creates an empty value object

template<class T>
zeus::TAtomicValueType< T >::TAtomicValueType ( tValue ) [inline]

Creates a value object out of a value value

template<class T>
zeus::TAtomicValueType< T >::TAtomicValueType ( const TAtomicValueType< T > &  rValue ) [inline]

Copy constructor of the atomic value

Parameters:
rValue: atomic value to copy
template<class T >
zeus::TAtomicValueType< T >::~TAtomicValueType (  ) [inline, virtual]

Destroys the value object


Member Function Documentation

template<class T>
T zeus::TAtomicValueType< T >::addAndGet ( tValue ) [inline]

adds a value to the atomic value

template<class T>
bool zeus::TAtomicValueType< T >::compareAndSet ( tExpectedValue,
tUpdate 
) [inline]

compares the value and updates if the value equals(tExpectedValue)

Parameters:
tExpectedValue: Value to check
tUpdate: Update if value equals(tExpectedValue)
Return values:
true: Values updated
false,:Value not updated
template<class T >
T zeus::TAtomicValueType< T >::decrementAndGet (  ) [inline]

decrements the value and returns the result

template<class T>
T zeus::TAtomicValueType< T >::divideAndGet ( tValue ) [inline]

divides a value to the atomic value

template<class T>
bool zeus::TAtomicValueType< T >::equals ( tExpectedValue ) const [inline]

equals operator to check if two values are the same

template<class T >
const T zeus::TAtomicValueType< T >::getAndDecrement (  ) [inline]

returns the value before decrementing it

template<class T >
const T zeus::TAtomicValueType< T >::getAndIncrement (  ) [inline]

returns the value before incrementing it

template<class T >
T zeus::TAtomicValueType< T >::getValue (  ) [inline]

gets the value of the value object

template<class T >
T zeus::TAtomicValueType< T >::getValue (  ) const [inline]

gets the value of the value object

template<class T >
T zeus::TAtomicValueType< T >::incrementAndGet (  ) [inline]

increments the value and returns the result

template<class T>
T zeus::TAtomicValueType< T >::multiplyAndGet ( tValue ) [inline]

multiblies a value to the atomic value

template<class T>
zeus::TAtomicValueType< T >::operator T (  ) const [inline]
template<class T>
bool zeus::TAtomicValueType< T >::operator!= ( const T  tValue ) const [inline]
template<class T>
bool zeus::TAtomicValueType< T >::operator!= ( const int  iValue ) const [inline]
template<class T>
TAtomicValueType< T > & zeus::TAtomicValueType< T >::operator*= ( const T  tValue ) [inline]

multiblies a value with this object

template<class T>
T zeus::TAtomicValueType< T >::operator++ ( int   ) [inline]
template<class T>
const T zeus::TAtomicValueType< T >::operator++ (  ) [inline]
template<class T>
TAtomicValueType< T > & zeus::TAtomicValueType< T >::operator+= ( const T  tValue ) [inline]

adds a value to this object

template<class T>
const T zeus::TAtomicValueType< T >::operator-- (  ) [inline]
template<class T>
T zeus::TAtomicValueType< T >::operator-- ( int   ) [inline]
template<class T>
TAtomicValueType< T > & zeus::TAtomicValueType< T >::operator-= ( const T  tValue ) [inline]

subtracts a value from this object

template<class T>
TAtomicValueType< T > & zeus::TAtomicValueType< T >::operator/= ( const T  tValue ) [inline]

divide a value with this object

template<class T>
TAtomicValueType<T>& zeus::TAtomicValueType< T >::operator= ( tValue ) [inline]
template<class T>
TAtomicValueType<T>& zeus::TAtomicValueType< T >::operator= ( const TAtomicValueType< T > &  rInVal ) [inline]
template<class T>
bool zeus::TAtomicValueType< T >::operator== ( const int  iValue ) const [inline]
template<class T>
bool zeus::TAtomicValueType< T >::operator== ( const T  tValue ) const [inline]
template<class T>
void zeus::TAtomicValueType< T >::setValue ( tValue ) [inline]

assigns a value to the atomic value


Member Data Documentation

template<class T>
TCriticalSection& zeus::TAtomicValueType< T >::m_rLock [protected]

Lock of the atomic value.

template<class T>
T zeus::TAtomicValueType< T >::m_tValue [protected]

internal value


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:32