|
template<bool HasCapacity = has_capacity<LockFreeContainer>::value, typename std::enable_if_t< HasCapacity, int > = 0> |
| LockFreeQueueBase () |
| Construct a new LockFreeQueueBase object.
|
|
template<bool HasCapacity = has_capacity<LockFreeContainer>::value, typename std::enable_if_t<!HasCapacity, int > = 1> |
| LockFreeQueueBase (std::size_t capacity) |
| Construct a new LockFreeQueueBase object.
|
|
bool | pop (T &data) |
| Pop the data from the queue.
|
|
template<typename U > |
std::enable_if_t< std::is_convertible_v< T, U >, bool > | pop (U &data) |
| Pop the data from the queue.
|
|
bool | push (const T &data) |
| Push the data into the queue.
|
|
template<typename U > |
std::enable_if_t< std::is_convertible_v< T, U >, bool > | push (const U &data) |
| Push the data into the queue.
|
|
template<typename U > |
std::enable_if_t< std::is_convertible_v< T, U >, bool > | bounded_push (const U &data) |
| The bounded_push function pushes the data into the queue and pops the oldest data if the queue is full.
|
|
bool | get_latest (T &data) |
| Get the latest data from the queue.
|
|
bool | empty () const |
| Check if the queue is empty.
|
|
size_t | capacity () const |
| Get the capacity of the queue.
|
|
template<bool IsSPSCQueue = is_spsc_queue<LockFreeContainer>::value, typename std::enable_if_t< IsSPSCQueue, int > = 0> |
std::size_t | size () const |
| Get the size of the queue.
|
|
bool | is_lock_free () const |
| The method to check if the queue is lock free.
|
|
const LockFreeContainer & | get_lockfree_container () const |
| Get the lockfree container.
|
|
LockFreeContainer & | get_lockfree_container () |
| Get the lockfree container.
|
|
A base class for lock-free queues.
This class provides a base implementation for lock-free queues with various functionalities such as pushing, popping, and checking the state of the queue. It supports both single-producer single-consumer (SPSC) and multiple-producer multiple-consumer (MPMC) queues.
- Template Parameters
-
DataType | The type of data to be stored in the queue. |
LockFreeContainer | The underlying lock-free container type - Typically boost::lockfree::spsc_queue or boost::lockfree::queue with their own template parameters |