Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::cInterlockedVal< TYPE > Class Template Reference

#include <cInterlockedVal.h>

Public Member Functions

 cInterlockedVal (TYPE nValue=0) noexcept
 
TYPE Inc () noexcept
 
void IncV () noexcept
 
TYPE Dec () noexcept
 
void DecV () noexcept
 
TYPE AddX (TYPE nValue) noexcept
 
TYPE Exchange (TYPE nValue) noexcept
 
TYPE CompareExchange (TYPE nValue, TYPE lComparand=0) noexcept
 
bool SetIfEqual (TYPE nValue, TYPE lComparand=0) noexcept
 
TYPE operator++ () noexcept
 
TYPE operator-- () noexcept
 
TYPE get_Value () const noexcept
 
void put_Value (TYPE nVal) noexcept
 
 operator TYPE () const noexcept
 
const THIS_toperator= (TYPE nValNew) noexcept
 

Protected Attributes

TYPE volatile m_nValue
 This MUST be sizeof(TYPE) aligned?! __DECL_ALIGN(sizeof(TYPE)). More...
 

Detailed Description

template<typename TYPE = INTER32_t>
class Gray::cInterlockedVal< TYPE >

thread interlocked/safe int/long. Not needed if ! _MT thread safe unitary actions on a INT32 value (>=32 bits)

Note
This uses inline __asm code and is fast!
should use __DECL_ALIGN(X) to make sure we are aligned.

Constructor & Destructor Documentation

◆ cInterlockedVal()

template<typename TYPE = INTER32_t>
Gray::cInterlockedVal< TYPE >::cInterlockedVal ( TYPE  nValue = 0)
inlinenoexcept

Member Function Documentation

◆ AddX()

template<typename TYPE = INTER32_t>
TYPE Gray::cInterlockedVal< TYPE >::AddX ( TYPE  nValue)
inlinenoexcept
Returns
pre-add value.

◆ CompareExchange()

template<typename TYPE = INTER32_t>
TYPE Gray::cInterlockedVal< TYPE >::CompareExchange ( TYPE  nValue,
TYPE  lComparand = 0 
)
inlinenoexcept

only if current m_nValue is lComparand set the new m_nValue to nValue

Returns
previous value.

◆ Dec()

template<typename TYPE = INTER32_t>
TYPE Gray::cInterlockedVal< TYPE >::Dec ( )
inlinenoexcept
Returns
post decrement.

◆ DecV()

template<typename TYPE = INTER32_t>
void Gray::cInterlockedVal< TYPE >::DecV ( )
inlinenoexcept

◆ Exchange()

template<typename TYPE = INTER32_t>
TYPE Gray::cInterlockedVal< TYPE >::Exchange ( TYPE  nValue)
inlinenoexcept

◆ get_Value()

template<typename TYPE = INTER32_t>
TYPE Gray::cInterlockedVal< TYPE >::get_Value ( ) const
inlinenoexcept

◆ Inc()

template<typename TYPE = INTER32_t>
TYPE Gray::cInterlockedVal< TYPE >::Inc ( )
inlinenoexcept
Returns
post increment. e.g. NEVER 0

◆ IncV()

template<typename TYPE = INTER32_t>
void Gray::cInterlockedVal< TYPE >::IncV ( )
inlinenoexcept

◆ operator TYPE()

template<typename TYPE = INTER32_t>
Gray::cInterlockedVal< TYPE >::operator TYPE ( ) const
inlinenoexcept

◆ operator++()

template<typename TYPE = INTER32_t>
TYPE Gray::cInterlockedVal< TYPE >::operator++ ( )
inlinenoexcept
Returns
The value post increment. e.g. NEVER 0

◆ operator--()

template<typename TYPE = INTER32_t>
TYPE Gray::cInterlockedVal< TYPE >::operator-- ( )
inlinenoexcept
Returns
The value post decrement

◆ operator=()

template<typename TYPE = INTER32_t>
const THIS_t& Gray::cInterlockedVal< TYPE >::operator= ( TYPE  nValNew)
inlinenoexcept

◆ put_Value()

template<typename TYPE = INTER32_t>
void Gray::cInterlockedVal< TYPE >::put_Value ( TYPE  nVal)
inlinenoexcept

◆ SetIfEqual()

template<typename TYPE = INTER32_t>
bool Gray::cInterlockedVal< TYPE >::SetIfEqual ( TYPE  nValue,
TYPE  lComparand = 0 
)
inlinenoexcept

Member Data Documentation

◆ m_nValue

template<typename TYPE = INTER32_t>
TYPE volatile Gray::cInterlockedVal< TYPE >::m_nValue
protected

This MUST be sizeof(TYPE) aligned?! __DECL_ALIGN(sizeof(TYPE)).


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