33 #ifndef itkAtomicInt_h
34 #define itkAtomicInt_h
93 return static_cast<T
>(Impl::PreIncrement(&this->
m_Object));
98 return static_cast<T
>(Impl::PostIncrement(&this->
m_Object));
103 return static_cast<T
>(Impl::PreDecrement(&this->
m_Object));
108 return static_cast<T
>(Impl::PostDecrement(&this->
m_Object));
113 return static_cast<T
>(Impl::AddAndFetch(&this->
m_Object,
114 static_cast<typename Impl::ValueType>(val)));
119 return static_cast<T
>(Impl::SubAndFetch(&this->
m_Object,
120 static_cast<typename Impl::ValueType>(val)));
125 return static_cast<T
>(Impl::Load(&this->
m_Object));
130 Impl::Store(&this->
m_Object, static_cast<typename Impl::ValueType>(val));
142 return static_cast<T
>(Impl::Load(&this->
m_Object));
147 Impl::Store(&this->
m_Object, static_cast<typename Impl::ValueType>(val));
155 template <
typename T>
167 : m_Object(reinterpret_cast<typename Impl::ValueType>(val))
172 : m_Object(reinterpret_cast<typename Impl::ValueType>(ai.load()))
178 return reinterpret_cast<T*
>(Impl::AddAndFetch(&this->m_Object,
sizeof(T)));
183 T* val =
reinterpret_cast<T*
>(Impl::AddAndFetch(&this->m_Object,
sizeof(T)));
189 return reinterpret_cast<T*
>(Impl::SubAndFetch(&this->m_Object,
sizeof(T)));
194 T* val =
reinterpret_cast<T*
>(Impl::AddAndFetch(&this->m_Object,
sizeof(T)));
200 return reinterpret_cast<T*
>(Impl::AddAndFetch(&this->m_Object,
206 return reinterpret_cast<T*
>(Impl::SubAndFetch(&this->m_Object,
212 return reinterpret_cast<T*
>(Impl::Load(&this->m_Object));
217 Impl::Store(&this->m_Object,
218 reinterpret_cast<typename Impl::ValueType>(val));
224 this->store(ai.
load());
230 return reinterpret_cast<T*
>(Impl::Load(&this->m_Object));
235 Impl::Store(&this->m_Object,
236 reinterpret_cast<typename Impl::ValueType>(val));
255 : m_Object(reinterpret_cast<Impl::ValueType>(val))
260 : m_Object(reinterpret_cast<Impl::ValueType>(ai.load()))
264 operator void*()
const
266 return reinterpret_cast<void*
>(Impl::Load(&this->m_Object));
271 Impl::Store(&this->m_Object,
272 reinterpret_cast<Impl::ValueType>(val));
278 this->store(ai.
load());
284 return reinterpret_cast<void*
>(Impl::Load(&this->m_Object));
289 Impl::Store(&this->m_Object,
290 reinterpret_cast<Impl::ValueType>(val));
T * operator-=(std::ptrdiff_t val)
Detail::AtomicOps< sizeof(void *)> Impl
Provides support for atomic integers.
AtomicInt< void * > & operator=(const AtomicInt< void * > &ai)
Impl::AtomicType m_Object
void * operator=(void *val)
Detail::AtomicOps< sizeof(T *)> Impl
Detail::AtomicOps< sizeof(T)> Impl
AtomicInt(const AtomicInt< T * > &ai)
AtomicInt< T > & operator=(const AtomicInt< T > &ai)
AtomicInt(const AtomicInt< void * > &ai)
AtomicInt(const AtomicInt< T > &ai)
Impl::AtomicType m_Object
AtomicInt< T * > & operator=(const AtomicInt< T * > &ai)
#define itkConceptMacro(name, concept)
T * operator+=(std::ptrdiff_t val)
Impl::AtomicType m_Object