Home
Base module

Queue

Thread-safe queue container.

Queue

#include <icy/queue.h>
template<typename T>
class Queue

Defined in src/base/include/icy/queue.h:30

Subclassed by: RunnableQueue< IPacket >, RunnableQueue< PacketT >, PlanarAudioPacket >, RunnableQueue< VisionFramePacket >

Thread-safe queue container.

List of all members

NameKindOwner
pushfunctionDeclared here
pushfunctionDeclared here
emptyfunctionDeclared here
frontfunctionDeclared here
backfunctionDeclared here
popfunctionDeclared here
sortfunctionDeclared here
sizefunctionDeclared here
queuefunctionDeclared here
_queuevariableDeclared here
_mutexvariableDeclared here

Public Methods

ReturnNameDescription
voidpush inlineAppends an item to the back of the queue (thread-safe).
voidpush inlineAppends an item to the back of the queue by move (thread-safe).
boolempty const inline
Tfront const inline
Tback const inline
voidpop inlineRemoves the front item from the queue (thread-safe).
voidsort inlineSorts all queued items using the given comparator (thread-safe).
size_tsize const inline
std::deque< T >queue const inline

push

inline

inline void push(const T & data)

Defined in src/base/include/icy/queue.h:35

Appends an item to the back of the queue (thread-safe).

Parameters

  • data Item to enqueue.

push

inline

inline void push(T && data)

Defined in src/base/include/icy/queue.h:43

Appends an item to the back of the queue by move (thread-safe).

Parameters

  • data Item to enqueue.

empty

const inline

inline bool empty() const

Defined in src/base/include/icy/queue.h:50

Returns

True if the queue contains no items.


front

const inline

inline T front() const

Defined in src/base/include/icy/queue.h:57

Returns

Copy of the front item.


back

const inline

inline T back() const

Defined in src/base/include/icy/queue.h:64

Returns

Copy of the back item.


pop

inline

inline void pop()

Defined in src/base/include/icy/queue.h:71

Removes the front item from the queue (thread-safe).


sort

inline

template<typename Compare> inline void sort()

Defined in src/base/include/icy/queue.h:80

Sorts all queued items using the given comparator (thread-safe).

Parameters

  • Compare Comparator type compatible with std::sort.

size

const inline

inline size_t size() const

Defined in src/base/include/icy/queue.h:87

Returns

Number of items currently in the queue (thread-safe).


queue

const inline

inline std::deque< T > queue() const

Defined in src/base/include/icy/queue.h:94

Returns

Copy of the underlying deque.

Protected Attributes

ReturnNameDescription
std::deque< T >_queue
std::mutex_mutex

_queue

std::deque< T > _queue

Defined in src/base/include/icy/queue.h:101


_mutex

std::mutex _mutex

Defined in src/base/include/icy/queue.h:102