Base module
icy::Queue
Thread-safe queue container.
Queue
#include <icy/queue.h>Subclassed by:
RunnableQueue< IPacket >,RunnableQueue< PacketT >,PlanarAudioPacket >,RunnableQueue< VisionFramePacket >
Thread-safe queue container.
Public Methods
| Return | Name | Description |
|---|---|---|
void | push inline | Appends an item to the back of the queue (thread-safe). |
void | push inline | Appends an item to the back of the queue by move (thread-safe). |
bool | empty const inline | #### Returns |
T | front const inline | #### Returns |
T | back const inline | #### Returns |
void | pop inline | Removes the front item from the queue (thread-safe). |
void | sort inline | Sorts all queued items using the given comparator (thread-safe). |
size_t | size const inline | #### Returns |
std::deque< T > | queue const inline | #### Returns |
push
inline
inline void push(const T & data)Appends an item to the back of the queue (thread-safe).
Parameters
dataItem to enqueue.
push
inline
inline void push(T && data)Appends an item to the back of the queue by move (thread-safe).
Parameters
dataItem to enqueue.
empty
const inline
inline bool empty() constReturns
True if the queue contains no items.
front
const inline
inline T front() constReturns
Copy of the front item.
back
const inline
inline T back() constReturns
Copy of the back item.
pop
inline
inline void pop()Removes the front item from the queue (thread-safe).
sort
inline
template<typename Compare> inline void sort()Sorts all queued items using the given comparator (thread-safe).
Parameters
CompareComparator type compatible withstd::sort.
size
const inline
inline size_t size() constReturns
Number of items currently in the queue (thread-safe).
queue
const inline
inline std::deque< T > queue() constReturns
Copy of the underlying deque.
Protected Attributes
_queue
std::deque< T > _queue_mutex
std::mutex _mutex