Skip to content

iox::concurrent::IndexQueue🔗

lockfree queue capable of storing indices 0,1,... Capacity-1 More...

#include <index_queue.hpp>

Public Classes🔗

Name
struct ConstructEmpty_t
struct ConstructFull_t

Public Types🔗

Name
using ValueType value_t

Public Functions🔗

Name
~IndexQueue() =default
IndexQueue(const IndexQueue & )
IndexQueue(IndexQueue && )
IndexQueue & operator=(const IndexQueue & )
IndexQueue & operator=(IndexQueue && )
IndexQueue(ConstructEmpty_t =ConstructEmpty)
constructs an empty IndexQueue
IndexQueue(ConstructFull_t )
constructs IndexQueue filled with all indices 0,1,...capacity-1
constexpr uint64_t capacity() const
get the capacity of the IndexQueue
bool empty() const
check whether the queue is empty
void push(const ValueType index)
push index into the queue in FIFO order
cxx::optional< ValueType > pop()
pop an index from the queue in FIFO order if the queue not empty
cxx::optional< ValueType > popIfFull()
pop an index from the queue in FIFO order if the queue is full
cxx::optional< ValueType > popIfSizeIsAtLeast(uint64_t size)
pop an index from the queue in FIFO order if the queue contains at least a specified number number of elements

Public Attributes🔗

Name
constexpr ConstructFull_t ConstructFull
constexpr ConstructEmpty_t ConstructEmpty

Friends🔗

Name
class LockFreeQueue
class ResizeableLockFreeQueue

Detailed Description🔗

template <uint64_t Capacity,
typename ValueType  =uint64_t>
class iox::concurrent::IndexQueue;

lockfree queue capable of storing indices 0,1,... Capacity-1

Public Types Documentation🔗

using value_t🔗

using iox::concurrent::IndexQueue< Capacity, ValueType >::value_t =  ValueType;

Public Functions Documentation🔗

function ~IndexQueue🔗

~IndexQueue() =default

function IndexQueue🔗

IndexQueue(
    const IndexQueue & 
)

function IndexQueue🔗

IndexQueue(
    IndexQueue && 
)

function operator=🔗

IndexQueue & operator=(
    const IndexQueue & 
)

function operator=🔗

IndexQueue & operator=(
    IndexQueue && 
)

function IndexQueue🔗

IndexQueue(
    ConstructEmpty_t  =ConstructEmpty
)

constructs an empty IndexQueue

function IndexQueue🔗

IndexQueue(
    ConstructFull_t 
)

constructs IndexQueue filled with all indices 0,1,...capacity-1

function capacity🔗

constexpr uint64_t capacity() const

get the capacity of the IndexQueue

Return: capacity of the IndexQueue threadsafe, lockfree

function empty🔗

bool empty() const

check whether the queue is empty

Return: true iff the queue is empty note that if the queue is used concurrently it might not be empty anymore after the call (but it was at some point during the call)

function push🔗

void push(
    const ValueType index
)

push index into the queue in FIFO order

Parameters:

  • index to be pushed note that do the way it is supposed to be used we cannot overflow (the number of indices available is bounded and the capacity is large enough to hold them all)

function pop🔗

cxx::optional< ValueType > pop()

pop an index from the queue in FIFO order if the queue not empty

Return: index if the queue was is empty, nullopt oterwise

function popIfFull🔗

cxx::optional< ValueType > popIfFull()

pop an index from the queue in FIFO order if the queue is full

Return: index if the queue was full, nullopt otherwise

function popIfSizeIsAtLeast🔗

cxx::optional< ValueType > popIfSizeIsAtLeast(
    uint64_t size
)

pop an index from the queue in FIFO order if the queue contains at least a specified number number of elements

Parameters:

  • size the number of elements needed to successfully perform the pop

Return: index if the queue contains size elements, nullopt otherwise

Public Attributes Documentation🔗

variable ConstructFull🔗

static constexpr ConstructFull_t ConstructFull {};

variable ConstructEmpty🔗

static constexpr ConstructEmpty_t ConstructEmpty {};

Friends🔗

friend LockFreeQueue🔗

friend class LockFreeQueue;

friend ResizeableLockFreeQueue🔗

friend class ResizeableLockFreeQueue;

Updated on 17 June 2021 at 11:15:26 CEST