BazisLib::Win32::_AtomicInt32< _BaseType > Class Template Reference

Provides atomic operation support for 32-bit integers. More...

#include <atomic.h>

List of all members.

Public Member Functions

 _AtomicInt32 (_BaseType val)
 _AtomicInt32 ()
 operator _BaseType ()
_BaseType operator++ ()
_BaseType operator++ (int)
_BaseType operator-- ()
_BaseType operator-- (int)
_BaseType operator+= (_BaseType v)
_BaseType operator-= (_BaseType v)
_BaseType operator|= (_BaseType v)
_BaseType operator&= (_BaseType v)
_BaseType operator^= (_BaseType v)

Private Attributes

long m_Value


Detailed Description

template<class _BaseType>
class BazisLib::Win32::_AtomicInt32< _BaseType >

Provides atomic operation support for 32-bit integers.

The _AtomicInt32 template class provides support for atomic operations (such as addition and subtraction) on 32-bit integers. To use such class, simply declare a variable and apply standard operators. For example, the following code ensures atomic operation:

class Test
{
public:
	AtomicInt32 m_RefCount;

	unsigned Retain()
	{
		return ++m_RefCount;
	}

	unsigned Release()
	{
		register int r = --m_RefCount;
		if (!r)
			delete this;
		return r;
	}
};
			
Avoid using the _AtomicInt32 template directly. Instead use the AtomicInt32 and AtomicUInt32 typedefs.

Constructor & Destructor Documentation

template<class _BaseType >
BazisLib::Win32::_AtomicInt32< _BaseType >::_AtomicInt32 ( _BaseType  val  )  [inline]

template<class _BaseType >
BazisLib::Win32::_AtomicInt32< _BaseType >::_AtomicInt32 (  )  [inline]


Member Function Documentation

template<class _BaseType >
BazisLib::Win32::_AtomicInt32< _BaseType >::operator _BaseType (  )  [inline]

template<class _BaseType >
_BaseType BazisLib::Win32::_AtomicInt32< _BaseType >::operator&= ( _BaseType  v  )  [inline]

template<class _BaseType >
_BaseType BazisLib::Win32::_AtomicInt32< _BaseType >::operator++ ( int   )  [inline]

template<class _BaseType >
_BaseType BazisLib::Win32::_AtomicInt32< _BaseType >::operator++ (  )  [inline]

template<class _BaseType >
_BaseType BazisLib::Win32::_AtomicInt32< _BaseType >::operator+= ( _BaseType  v  )  [inline]

template<class _BaseType >
_BaseType BazisLib::Win32::_AtomicInt32< _BaseType >::operator-- ( int   )  [inline]

template<class _BaseType >
_BaseType BazisLib::Win32::_AtomicInt32< _BaseType >::operator-- (  )  [inline]

template<class _BaseType >
_BaseType BazisLib::Win32::_AtomicInt32< _BaseType >::operator-= ( _BaseType  v  )  [inline]

template<class _BaseType >
_BaseType BazisLib::Win32::_AtomicInt32< _BaseType >::operator^= ( _BaseType  v  )  [inline]

template<class _BaseType >
_BaseType BazisLib::Win32::_AtomicInt32< _BaseType >::operator|= ( _BaseType  v  )  [inline]


Member Data Documentation

template<class _BaseType >
long BazisLib::Win32::_AtomicInt32< _BaseType >::m_Value [private]


The documentation for this class was generated from the following file:
SourceForge.net Logo