Tervel
1.0.0
A collection of wait-free containers and algorithms.
|
#include <array_array.h>
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... | |
ArrayElement * | get_spot (const size_t raw_pos, const bool no_add=false) |
This function returns the address of the specified position. More... | |
ArrayElement * | allocate_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 ArrayElement * | ArraySegment |
Private Attributes | |
const T | default_value_ {nullptr} |
std::atomic< ArraySegment > | array_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} |
|
private |
|
private |
|
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.
|
inline |
|
inline |
This function adds an array segment to the arrays used to hold additional elements.
pos | the slot to place the new array segment |
|
inline |
|
inline |
|
inlinevirtual |
This function returns the address of the specified position.
raw_pos | the position |
no_add | if true then it will not increase the vectors size |
Implements tervel::containers::wf::vector::VectorArray< T >.
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |