VolViz
A volume visualization tool
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Public Member Functions | Private Types | Private Attributes | List of all members
VolViz::AtomicWrapper< T, SetPolicy > Class Template Reference

#include <AtomicWrapper.h>

+ Inheritance diagram for VolViz::AtomicWrapper< T, SetPolicy >:
+ Collaboration diagram for VolViz::AtomicWrapper< T, SetPolicy >:

Public Member Functions

 AtomicWrapper (T const &obj)
 Initialized the wrapper with an object. More...
 
 AtomicWrapper (T &&obj)
 Initialized the wrapper with an object (move constructor) More...
 
 AtomicWrapper (AtomicWrapper const &)=delete
 
AtomicWrapperoperator= (AtomicWrapper const &)=delete
 
 operator T () const
 Returns a copy of the wrapped object in a thread safe manner. More...
 
AtomicWrapperoperator= (T const &rhs)
 Reassign the wrapped object in a thread safe manner. More...
 
AtomicWrapperoperator= (T &&rhs)
 Reassign the wrapped object in a thread safe manner (move version). More...
 

Private Types

using SetPol = SetPolicy< T >
 

Private Attributes

obj_
 Thre wrapped object. More...
 
std::mutex mutex_
 Mutex preventing simultaneous access. More...
 

Detailed Description

template<class T, template< class > class SetPolicy = DefaultSetPolicy>
class VolViz::AtomicWrapper< T, SetPolicy >

Wrapper class for atomic-like access for types where no std::atomic overload is available.

Template Parameters
Twrapped type
SetPolicypolicy class template, that specified the set operation
Note
this wrapper is actually slower than std::atomic since it uses a mutex and not only atomic operations. Also the wrapped object is copied at read access, so only use this wrapper for fast to copy types.

Member Typedef Documentation

template<class T, template< class > class SetPolicy = DefaultSetPolicy>
using VolViz::AtomicWrapper< T, SetPolicy >::SetPol = SetPolicy<T>
private

Constructor & Destructor Documentation

template<class T, template< class > class SetPolicy = DefaultSetPolicy>
VolViz::AtomicWrapper< T, SetPolicy >::AtomicWrapper ( T const &  obj)
inlineexplicit

Initialized the wrapper with an object.

template<class T, template< class > class SetPolicy = DefaultSetPolicy>
VolViz::AtomicWrapper< T, SetPolicy >::AtomicWrapper ( T &&  obj)
inlineexplicit

Initialized the wrapper with an object (move constructor)

template<class T, template< class > class SetPolicy = DefaultSetPolicy>
VolViz::AtomicWrapper< T, SetPolicy >::AtomicWrapper ( AtomicWrapper< T, SetPolicy > const &  )
delete

Member Function Documentation

template<class T, template< class > class SetPolicy = DefaultSetPolicy>
VolViz::AtomicWrapper< T, SetPolicy >::operator T ( ) const
inline

Returns a copy of the wrapped object in a thread safe manner.

template<class T, template< class > class SetPolicy = DefaultSetPolicy>
AtomicWrapper& VolViz::AtomicWrapper< T, SetPolicy >::operator= ( AtomicWrapper< T, SetPolicy > const &  )
delete
template<class T, template< class > class SetPolicy = DefaultSetPolicy>
AtomicWrapper& VolViz::AtomicWrapper< T, SetPolicy >::operator= ( T const &  rhs)
inline

Reassign the wrapped object in a thread safe manner.

template<class T, template< class > class SetPolicy = DefaultSetPolicy>
AtomicWrapper& VolViz::AtomicWrapper< T, SetPolicy >::operator= ( T &&  rhs)
inline

Reassign the wrapped object in a thread safe manner (move version).

Member Data Documentation

template<class T, template< class > class SetPolicy = DefaultSetPolicy>
std::mutex VolViz::AtomicWrapper< T, SetPolicy >::mutex_
mutableprivate

Mutex preventing simultaneous access.

template<class T, template< class > class SetPolicy = DefaultSetPolicy>
T VolViz::AtomicWrapper< T, SetPolicy >::obj_
private

Thre wrapped object.


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