Class LoFFLi

Nested Relationships

Nested Types

Class Documentation

class LoFFLi

Public Types

using Index_t = uint32_t

Public Functions

LoFFLi() noexcept = default
void init(cxx::not_null<Index_t*> freeIndicesMemory, const uint32_t capacity) noexcept

Todo:

: why init not in ctor

Initializes the lock-free free-list

Parameters:
  • freeIndicesMemory[in] pointer to a memory with the capacity calculated by requiredMemorySize()

  • capacity[in] is the number of elements of the free-list; must be the same used at requiredMemorySize()

bool pop(Index_t &index) noexcept

Pop a value from the free-list

Parameters:

index[out] for an element to use

Returns:

true if index is valid, false otherwise

bool push(const Index_t index) noexcept

Push previously poped element

Parameters:

index[in] to previously poped element

Returns:

true if index is valid or not yet pushed, false otherwise

Public Static Functions

static inline constexpr std::size_t requiredIndexMemorySize(const uint32_t capacity) noexcept

Calculates the required memory size for a free-list

Parameters:

capacity[in] is the number of elements of the free-list

Returns:

the required memory size for a free-list with the requested capacity