ITK  4.8.0
Insight Segmentation and Registration Toolkit
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
itk::AtomicInt< T > Class Template Reference

#include <itkAtomicInt.h>

+ Inheritance diagram for itk::AtomicInt< T >:

Detailed Description

template<typename T>
class itk::AtomicInt< T >

Provides support for atomic integers.

Objects of atomic types are C++ objects that are free from data races; that is, if one thread writes to an atomic object while another thread reads from it, the behavior is well-defined. AtomicInt provides a subset of the std::atomic API and implementation, for 32 bit and 64 bit integers and pointer types. For these types, AtomicInt defines a number of operations that happen atomically - without interruption by another thread. Furthermore, these operations happen in a sequentially-consistent way and use full memory fences. This means that operations relating to atomic variables happen in the specified order and the results are made visible to other processing cores to guarantee proper sequential operation. Other memory access patterns supported by std::atomic are not currently supported.

Note that when atomic operations are not available on a particular platform or compiler, mutexes, which are significantly slower, are used as a fallback.

Definition at line 71 of file itkAtomicInt.h.

Public Member Functions

 AtomicInt ()
 
 AtomicInt (T val)
 
 AtomicInt (const AtomicInt< T > &ai)
 
load () const
 
 operator T () const
 
operator++ ()
 
operator++ (int)
 
operator+= (T val)
 
operator-- ()
 
operator-- (int)
 
operator-= (T val)
 
operator= (T val)
 
AtomicInt< T > & operator= (const AtomicInt< T > &ai)
 
void store (T val)
 

Private Types

typedef Detail::AtomicOps
< sizeof(T)> 
Impl
 

Private Member Functions

 typedef (Detail::IsAtomicSupportedIntegralType< T >) SupportedInteger
 

Private Attributes

Impl::AtomicType m_Object
 

Member Typedef Documentation

template<typename T>
typedef Detail::AtomicOps<sizeof(T)> itk::AtomicInt< T >::Impl
private

Definition at line 74 of file itkAtomicInt.h.

Constructor & Destructor Documentation

template<typename T>
itk::AtomicInt< T >::AtomicInt ( )
inline

Definition at line 77 of file itkAtomicInt.h.

template<typename T>
itk::AtomicInt< T >::AtomicInt ( val)
inline

Definition at line 81 of file itkAtomicInt.h.

template<typename T>
itk::AtomicInt< T >::AtomicInt ( const AtomicInt< T > &  ai)
inline

Definition at line 86 of file itkAtomicInt.h.

Member Function Documentation

template<typename T>
T itk::AtomicInt< T >::load ( ) const
inline

Definition at line 140 of file itkAtomicInt.h.

Referenced by itk::AtomicInt< int >::operator=().

template<typename T>
itk::AtomicInt< T >::operator T ( ) const
inline

Definition at line 123 of file itkAtomicInt.h.

References itk::AtomicInt< T >::m_Object.

template<typename T>
T itk::AtomicInt< T >::operator++ ( )
inline

Definition at line 91 of file itkAtomicInt.h.

template<typename T>
T itk::AtomicInt< T >::operator++ ( int  )
inline

Definition at line 96 of file itkAtomicInt.h.

template<typename T>
T itk::AtomicInt< T >::operator+= ( val)
inline

Definition at line 111 of file itkAtomicInt.h.

template<typename T>
T itk::AtomicInt< T >::operator-- ( )
inline

Definition at line 101 of file itkAtomicInt.h.

template<typename T>
T itk::AtomicInt< T >::operator-- ( int  )
inline

Definition at line 106 of file itkAtomicInt.h.

template<typename T>
T itk::AtomicInt< T >::operator-= ( val)
inline

Definition at line 117 of file itkAtomicInt.h.

template<typename T>
T itk::AtomicInt< T >::operator= ( val)
inline

Definition at line 128 of file itkAtomicInt.h.

template<typename T>
AtomicInt<T>& itk::AtomicInt< T >::operator= ( const AtomicInt< T > &  ai)
inline

Definition at line 134 of file itkAtomicInt.h.

template<typename T>
void itk::AtomicInt< T >::store ( val)
inline

Definition at line 145 of file itkAtomicInt.h.

Referenced by itk::AtomicInt< int >::operator=().

template<typename T>
itk::AtomicInt< T >::typedef ( Detail::IsAtomicSupportedIntegralType< T >  )
private

This class requires SupportedInteger in the form of ( Detail::IsAtomicSupportedIntegralType<T> )

Member Data Documentation

template<typename T>
Impl::AtomicType itk::AtomicInt< T >::m_Object
private

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