ITK  4.13.0
Insight Segmentation and Registration Toolkit
Public Member Functions | Private Types | 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 78 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 Attributes

Impl::AtomicType m_Object
 

Member Typedef Documentation

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

Definition at line 81 of file itkAtomicInt.h.

Constructor & Destructor Documentation

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

Definition at line 85 of file itkAtomicInt.h.

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

Definition at line 89 of file itkAtomicInt.h.

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

Definition at line 94 of file itkAtomicInt.h.

Member Function Documentation

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

Definition at line 148 of file itkAtomicInt.h.

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

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

Definition at line 131 of file itkAtomicInt.h.

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

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

Definition at line 99 of file itkAtomicInt.h.

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

Definition at line 104 of file itkAtomicInt.h.

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

Definition at line 119 of file itkAtomicInt.h.

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

Definition at line 109 of file itkAtomicInt.h.

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

Definition at line 114 of file itkAtomicInt.h.

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

Definition at line 125 of file itkAtomicInt.h.

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

Definition at line 136 of file itkAtomicInt.h.

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

Definition at line 142 of file itkAtomicInt.h.

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

Definition at line 153 of file itkAtomicInt.h.

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

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: