BioDynaMo  v1.05.120-25dc9790
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
bdm::SharedData< T > Class Template Reference

The SharedData class avoids false sharing between threads. More...

#include <shared_data.h>

Classes

struct  AlignedT
 Wrapper for a chacheline-size aligned T. More...
 
struct  Iterator
 

Public Types

using Data = std::vector< AlignedT >
 

Public Member Functions

 SharedData ()=default
 
 SharedData (size_t size, const T &value=T())
 
T & operator[] (size_t index)
 
const T & operator[] (size_t index) const
 
size_t size () const
 Get the size of the SharedData.data_ vector. More...
 
void resize (size_t new_size)
 Resize the SharedData.data_ vector. More...
 
Iterator begin ()
 
Iterator end ()
 
const Iterator begin () const
 
const Iterator end () const
 

Private Attributes

Data data_
 

Detailed Description

template<typename T>
class bdm::SharedData< T >

The SharedData class avoids false sharing between threads.

Definition at line 48 of file shared_data.h.

Member Typedef Documentation

◆ Data

template<typename T >
using bdm::SharedData< T >::Data = std::vector<AlignedT>

Data type definition for a vector whose entries fill full cache lines. A vector whose components' sizes are a multiple of the cacheline size, e.g sizeof(Data[i]) = N*hardware_destructive_interference_size.

Definition at line 58 of file shared_data.h.

Constructor & Destructor Documentation

◆ SharedData() [1/2]

template<typename T >
bdm::SharedData< T >::SharedData ( )
default

◆ SharedData() [2/2]

template<typename T >
bdm::SharedData< T >::SharedData ( size_t  size,
const T &  value = T() 
)
inline

Definition at line 61 of file shared_data.h.

Member Function Documentation

◆ begin() [1/2]

template<typename T >
Iterator bdm::SharedData< T >::begin ( )
inline

Definition at line 93 of file shared_data.h.

◆ begin() [2/2]

template<typename T >
const Iterator bdm::SharedData< T >::begin ( ) const
inline

Definition at line 95 of file shared_data.h.

◆ end() [1/2]

template<typename T >
Iterator bdm::SharedData< T >::end ( )
inline

Definition at line 94 of file shared_data.h.

◆ end() [2/2]

template<typename T >
const Iterator bdm::SharedData< T >::end ( ) const
inline

Definition at line 98 of file shared_data.h.

◆ operator[]() [1/2]

template<typename T >
T& bdm::SharedData< T >::operator[] ( size_t  index)
inline

Definition at line 67 of file shared_data.h.

◆ operator[]() [2/2]

template<typename T >
const T& bdm::SharedData< T >::operator[] ( size_t  index) const
inline

Definition at line 68 of file shared_data.h.

◆ resize()

template<typename T >
void bdm::SharedData< T >::resize ( size_t  new_size)
inline

Resize the SharedData.data_ vector.

Definition at line 74 of file shared_data.h.

◆ size()

template<typename T >
size_t bdm::SharedData< T >::size ( ) const
inline

Get the size of the SharedData.data_ vector.

Definition at line 71 of file shared_data.h.

Member Data Documentation

◆ data_

template<typename T >
Data bdm::SharedData< T >::data_
private

Definition at line 103 of file shared_data.h.


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