CbmRoot
Loading...
Searching...
No Matches
cbm::algo::PaddedValue< T, N > Class Template Reference

A class that represents a value with padding to a certain size. More...

#include <PaddedValue.h>

Public Member Functions

XPU_D PaddedValue ()=default
 
XPU_D PaddedValue (const T &value)
 
XPU_D PaddedValue (const PaddedValue &other)
 
XPU_D PaddedValueoperator= (const PaddedValue &other)
 
XPU_D PaddedValue (PaddedValue &&other)
 
XPU_D PaddedValueoperator= (PaddedValue &&other)
 
XPU_D T & operator= (const T &value)
 
XPU_D T & Get ()
 
XPU_D const T & Get () const
 
XPU_D T * operator& ()
 
XPU_D const T * operator& () const
 
XPU_D T & operator* ()
 
XPU_D const T & operator* () const
 
XPU_D operator T& ()
 
XPU_D operator const T & () const
 
XPU_D operator T* ()
 
XPU_D operator const T * () const
 
XPU_D T * operator-> ()
 
XPU_D const T * operator-> () const
 

Private Attributes

fValue
 
unsigned char fPadding [N - sizeof(T)]
 

Detailed Description

template<typename T, size_t N>
class cbm::algo::PaddedValue< T, N >

A class that represents a value with padding to a certain size.

Template Parameters
TThe type of the value.
NNumber of bytes the value should be padded to.
Note
This class is useful for aligning values to a certain size, e.g. to ensure that atomic counters are spread across different cache lines. (Prevent false sharing)

Definition at line 27 of file PaddedValue.h.

Constructor & Destructor Documentation

◆ PaddedValue() [1/4]

template<typename T , size_t N>
XPU_D cbm::algo::PaddedValue< T, N >::PaddedValue ( )
default

◆ PaddedValue() [2/4]

template<typename T , size_t N>
XPU_D cbm::algo::PaddedValue< T, N >::PaddedValue ( const T & value)
inline

Definition at line 32 of file PaddedValue.h.

◆ PaddedValue() [3/4]

template<typename T , size_t N>
XPU_D cbm::algo::PaddedValue< T, N >::PaddedValue ( const PaddedValue< T, N > & other)
inline

Definition at line 34 of file PaddedValue.h.

◆ PaddedValue() [4/4]

template<typename T , size_t N>
XPU_D cbm::algo::PaddedValue< T, N >::PaddedValue ( PaddedValue< T, N > && other)
inline

Definition at line 41 of file PaddedValue.h.

Member Function Documentation

◆ Get() [1/2]

template<typename T , size_t N>
XPU_D T & cbm::algo::PaddedValue< T, N >::Get ( )
inline

Definition at line 54 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ Get() [2/2]

template<typename T , size_t N>
XPU_D const T & cbm::algo::PaddedValue< T, N >::Get ( ) const
inline

Definition at line 55 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator const T &()

template<typename T , size_t N>
XPU_D cbm::algo::PaddedValue< T, N >::operator const T & ( ) const
inline

Definition at line 64 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator const T *()

template<typename T , size_t N>
XPU_D cbm::algo::PaddedValue< T, N >::operator const T * ( ) const
inline

Definition at line 67 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator T&()

template<typename T , size_t N>
XPU_D cbm::algo::PaddedValue< T, N >::operator T& ( )
inline

Definition at line 63 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator T*()

template<typename T , size_t N>
XPU_D cbm::algo::PaddedValue< T, N >::operator T* ( )
inline

Definition at line 66 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator&() [1/2]

template<typename T , size_t N>
XPU_D T * cbm::algo::PaddedValue< T, N >::operator& ( )
inline

Definition at line 57 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator&() [2/2]

template<typename T , size_t N>
XPU_D const T * cbm::algo::PaddedValue< T, N >::operator& ( ) const
inline

Definition at line 58 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator*() [1/2]

template<typename T , size_t N>
XPU_D T & cbm::algo::PaddedValue< T, N >::operator* ( )
inline

Definition at line 60 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator*() [2/2]

template<typename T , size_t N>
XPU_D const T & cbm::algo::PaddedValue< T, N >::operator* ( ) const
inline

Definition at line 61 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator->() [1/2]

template<typename T , size_t N>
XPU_D T * cbm::algo::PaddedValue< T, N >::operator-> ( )
inline

Definition at line 69 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator->() [2/2]

template<typename T , size_t N>
XPU_D const T * cbm::algo::PaddedValue< T, N >::operator-> ( ) const
inline

Definition at line 70 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator=() [1/3]

template<typename T , size_t N>
XPU_D PaddedValue & cbm::algo::PaddedValue< T, N >::operator= ( const PaddedValue< T, N > & other)
inline

Definition at line 35 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator=() [2/3]

template<typename T , size_t N>
XPU_D T & cbm::algo::PaddedValue< T, N >::operator= ( const T & value)
inline

Definition at line 48 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

◆ operator=() [3/3]

template<typename T , size_t N>
XPU_D PaddedValue & cbm::algo::PaddedValue< T, N >::operator= ( PaddedValue< T, N > && other)
inline

Definition at line 42 of file PaddedValue.h.

References cbm::algo::PaddedValue< T, N >::fValue.

Member Data Documentation

◆ fPadding

template<typename T , size_t N>
unsigned char cbm::algo::PaddedValue< T, N >::fPadding[N - sizeof(T)]
private

Definition at line 74 of file PaddedValue.h.

◆ fValue


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