Tervel  1.0.0
A collection of wait-free containers and algorithms.
Public Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
tervel::containers::wf::vector::ArrayArray< T > Class Template Reference

#include <array_array.h>

Inheritance diagram for tervel::containers::wf::vector::ArrayArray< T >:
tervel::containers::wf::vector::VectorArray< T >

Public Member Functions

 ArrayArray (size_t capacity, T default_value=nullptr)
 This class contains code related to managing elements stored in the vector It stores elements on a series of array segments, which are stored into a global vector. More...
 
 ~ArrayArray ()
 
ArraySegment add_segment (const size_t pos)
 This function adds an array segment to the arrays used to hold additional elements. More...
 
ArrayElementget_spot (const size_t raw_pos, const bool no_add=false)
 This function returns the address of the specified position. More...
 
ArrayElementallocate_array_segment (const size_t capacity)
 
size_t capacity ()
 
- Public Member Functions inherited from tervel::containers::wf::vector::VectorArray< T >
 VectorArray ()
 
 VectorArray (size_t capacity)
 
virtual ~VectorArray ()
 
virtual bool is_valid (T value)
 
virtual bool is_descriptor (T &expected, std::atomic< T > *spot)
 Overridden by SingleArray model to detect resize. More...
 

Private Types

typedef std::atomic< T > ArrayElement
 
typedef ArrayElementArraySegment
 

Private Attributes

const T default_value_ {nullptr}
 
std::atomic< ArraySegmentarray_of_arrays [k_max_array_segments_]
 
size_t offset_
 
size_t offset_pow_
 
std::atomic< size_t > current_capacity_
 

Static Private Attributes

static const size_t k_max_array_segments_ {64}
 

Member Typedef Documentation

template<typename T >
typedef std::atomic<T> tervel::containers::wf::vector::ArrayArray< T >::ArrayElement
private
template<typename T >
typedef ArrayElement* tervel::containers::wf::vector::ArrayArray< T >::ArraySegment
private

Constructor & Destructor Documentation

template<typename T >
tervel::containers::wf::vector::ArrayArray< T >::ArrayArray ( size_t  capacity,
default_value = nullptr 
)
inline

This class contains code related to managing elements stored in the vector It stores elements on a series of array segments, which are stored into a global vector.

TODO: Remove atomic type of array replace it with explicit atomic loads This will remove unnecessary memory barriers since it is a single transition type.

template<typename T >
tervel::containers::wf::vector::ArrayArray< T >::~ArrayArray ( )
inline

Member Function Documentation

template<typename T >
ArraySegment tervel::containers::wf::vector::ArrayArray< T >::add_segment ( const size_t  pos)
inline

This function adds an array segment to the arrays used to hold additional elements.

Parameters
posthe slot to place the new array segment
Returns
the current array segment at the specified position
template<typename T >
ArrayElement* tervel::containers::wf::vector::ArrayArray< T >::allocate_array_segment ( const size_t  capacity)
inline
template<typename T >
size_t tervel::containers::wf::vector::ArrayArray< T >::capacity ( )
inline
template<typename T >
ArrayElement* tervel::containers::wf::vector::ArrayArray< T >::get_spot ( const size_t  raw_pos,
const bool  no_add = false 
)
inlinevirtual

This function returns the address of the specified position.

Parameters
raw_posthe position
no_addif true then it will not increase the vectors size
Returns
the address of the specified positon

Implements tervel::containers::wf::vector::VectorArray< T >.

Member Data Documentation

template<typename T >
std::atomic<ArraySegment> tervel::containers::wf::vector::ArrayArray< T >::array_of_arrays[k_max_array_segments_]
private
template<typename T >
std::atomic<size_t> tervel::containers::wf::vector::ArrayArray< T >::current_capacity_
private
template<typename T >
const T tervel::containers::wf::vector::ArrayArray< T >::default_value_ {nullptr}
private
template<typename T >
const size_t tervel::containers::wf::vector::ArrayArray< T >::k_max_array_segments_ {64}
staticprivate
template<typename T >
size_t tervel::containers::wf::vector::ArrayArray< T >::offset_
private
template<typename T >
size_t tervel::containers::wf::vector::ArrayArray< T >::offset_pow_
private

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