BioDynaMo  v1.03.58-27764645
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 34 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 cachline size, e.g sizeof(Data[i]) = N*BDM_CACHE_LINE_SIZE.

Definition at line 44 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 47 of file shared_data.h.

Member Function Documentation

◆ begin() [1/2]

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

Definition at line 79 of file shared_data.h.

◆ begin() [2/2]

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

Definition at line 81 of file shared_data.h.

◆ end() [1/2]

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

Definition at line 80 of file shared_data.h.

◆ end() [2/2]

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

Definition at line 84 of file shared_data.h.

◆ operator[]() [1/2]

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

Definition at line 53 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 54 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 60 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 57 of file shared_data.h.

Member Data Documentation

◆ data_

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

Definition at line 89 of file shared_data.h.


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