Flat-combining queue.
More...
#include <cds/container/fcqueue.h>
|
typedef T | value_type |
| Value type.
|
|
typedef Queue | queue_type |
| Sequential queue class.
|
|
typedef Traits | traits |
| Queue type traits.
|
|
typedef traits::stat | stat |
| Internal statistics type.
|
|
|
| FCQueue () |
| Initializes empty queue object.
|
|
| FCQueue (unsigned int nCompactFactor, unsigned int nCombinePassCount) |
| Initializes empty queue object and gives flat combining parameters. More...
|
|
bool | enqueue (value_type const &val) |
| Inserts a new element at the end of the queue. More...
|
|
bool | push (value_type const &val) |
| Inserts a new element at the end of the queue (a synonym for enqueue)
|
|
bool | enqueue (value_type &&val) |
| Inserts a new element at the end of the queue (move semantics) More...
|
|
bool | push (value_type &&val) |
| Inserts a new element at the end of the queue (move semantics, synonym for enqueue )
|
|
bool | dequeue (value_type &val) |
| Removes the next element from the queue. More...
|
|
bool | pop (value_type &val) |
| Removes the next element from the queue (a synonym for dequeue)
|
|
void | clear () |
| Clears the queue.
|
|
template<typename Func > |
void | apply (Func f) |
| Exclusive access to underlying queue object. More...
|
|
template<typename Func > |
void | apply (Func f) const |
| Exclusive access to underlying queue object. More...
|
|
size_t | size () const |
| Returns the number of elements in the queue. More...
|
|
bool | empty () const |
| Checks if the queue is empty. More...
|
|
stat const & | statistics () const |
| Internal statistics.
|
|
|
static constexpr const bool | c_bEliminationEnabled = traits::enable_elimination |
| true if elimination is enabled
|
|
template<typename T, class Queue = std::queue<T>, typename Traits = fcqueue::traits>
class cds::container::FCQueue< T, Queue, Traits >
Flat-combining queue.
Flat combining sequential queue. The class can be considered as a concurrent FC-based wrapper for std::queue
.
Template parameters:
T
- a value type stored in the queue
Queue
- sequential queue implementation, default is std::queue<T>
Trats
- type traits of flat combining, default is fcqueue::traits
. fcqueue::make_traits
metafunction can be used to construct fcqueue::traits
specialization.
◆ FCQueue()
template<typename T , class Queue = std::queue<T>, typename Traits = fcqueue::traits>
Initializes empty queue object and gives flat combining parameters.
- Parameters
-
nCompactFactor | Flat combining: publication list compacting factor |
nCombinePassCount | Flat combining: number of combining passes for combiner thread |
◆ apply() [1/2]
template<typename T , class Queue = std::queue<T>, typename Traits = fcqueue::traits>
template<typename Func >
Exclusive access to underlying queue object.
The functor f
can do any operation with underlying queue_type
in exclusive mode. For example, you can iterate over the queue. Func
signature is:
◆ apply() [2/2]
template<typename T , class Queue = std::queue<T>, typename Traits = fcqueue::traits>
template<typename Func >
Exclusive access to underlying queue object.
The functor f
can do any operation with underlying queue_type
in exclusive mode. For example, you can iterate over the queue. Func
signature is:
◆ dequeue()
template<typename T , class Queue = std::queue<T>, typename Traits = fcqueue::traits>
Removes the next element from the queue.
val
takes a copy of the element
◆ empty()
template<typename T , class Queue = std::queue<T>, typename Traits = fcqueue::traits>
Checks if the queue is empty.
If the combining is in process the function waits while combining done.
◆ enqueue() [1/2]
template<typename T , class Queue = std::queue<T>, typename Traits = fcqueue::traits>
Inserts a new element at the end of the queue.
The content of the new element initialized to a copy of val
.
The function always returns true
◆ enqueue() [2/2]
template<typename T , class Queue = std::queue<T>, typename Traits = fcqueue::traits>
Inserts a new element at the end of the queue (move semantics)
val
is moved to inserted element
◆ size()
template<typename T , class Queue = std::queue<T>, typename Traits = fcqueue::traits>
Returns the number of elements in the queue.
Note that size() == 0
is not mean that the queue is empty because combining record can be in process. To check emptiness use empty function.
The documentation for this class was generated from the following file: