Flat-combining priority queue.
More...
#include <cds/container/fcpriority_queue.h>
|
typedef T | value_type |
| Value type.
|
|
typedef PriorityQueue | priority_queue_type |
| Sequential priority queue class.
|
|
typedef Traits | traits |
| Priority queue type traits.
|
|
typedef traits::stat | stat |
| Internal statistics type.
|
|
|
| FCPriorityQueue () |
| Initializes empty priority queue object.
|
|
| FCPriorityQueue (unsigned int nCompactFactor, unsigned int nCombinePassCount) |
| Initializes empty priority queue object and gives flat combining parameters. More...
|
|
bool | push (value_type const &val) |
| Inserts a new element in the priority queue. More...
|
|
bool | push (value_type &&val) |
| Inserts a new element in the priority queue (move semantics) More...
|
|
bool | pop (value_type &val) |
| Removes the top element from priority queue. More...
|
|
template<typename Func > |
void | apply (Func f) |
| Exclusive access to underlying priority queue object. More...
|
|
template<typename Func > |
void | apply (Func f) const |
| Exclusive access to underlying priority queue object. More...
|
|
void | clear () |
| Clears the priority queue.
|
|
size_t | size () const |
| Returns the number of elements in the priority queue. More...
|
|
bool | empty () |
| Checks if the priority queue is empty. More...
|
|
stat const & | statistics () const |
| Internal statistics.
|
|
template<typename T, class PriorityQueue = std::priority_queue<T>, typename Traits = fcpqueue::traits>
class cds::container::FCPriorityQueue< T, PriorityQueue, Traits >
Flat-combining priority queue.
Flat combining sequential priority queue. The class can be considered as a concurrent FC-based wrapper for std::priority_queue
.
Template parameters:
T
- a value type stored in the queue
PriorityQueue
- sequential priority queue implementation, default is std::priority_queue<T>
Traits
- type traits of flat combining, default is fcpqueue::traits
. fcpqueue::make_traits
metafunction can be used to construct specialized fcpqueue::traits
◆ FCPriorityQueue()
template<typename T , class PriorityQueue = std::priority_queue<T>, typename Traits = fcpqueue::traits>
Initializes empty priority 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 PriorityQueue = std::priority_queue<T>, typename Traits = fcpqueue::traits>
template<typename Func >
Exclusive access to underlying priority queue object.
The functor f
can do any operation with underlying priority_queue_type
in exclusive mode. For example, you can iterate over the queue. Func
signature is:
◆ apply() [2/2]
template<typename T , class PriorityQueue = std::priority_queue<T>, typename Traits = fcpqueue::traits>
template<typename Func >
Exclusive access to underlying priority queue object.
The functor f
can do any operation with underlying proiprity_queue_type
in exclusive mode. For example, you can iterate over the queue. Func
signature is:
◆ empty()
template<typename T , class PriorityQueue = std::priority_queue<T>, typename Traits = fcpqueue::traits>
Checks if the priority queue is empty.
If the combining is in process the function waits while combining done.
◆ pop()
template<typename T , class PriorityQueue = std::priority_queue<T>, typename Traits = fcpqueue::traits>
Removes the top element from priority queue.
The function returns false
if the queue is empty, true
otherwise. If the queue is empty val
is not changed.
- Parameters
-
val | Target to be received the copy of top element |
◆ push() [1/2]
template<typename T , class PriorityQueue = std::priority_queue<T>, typename Traits = fcpqueue::traits>
Inserts a new element in the priority queue.
The function always returns true
- Parameters
-
val | Value to be copied to inserted element |
◆ push() [2/2]
template<typename T , class PriorityQueue = std::priority_queue<T>, typename Traits = fcpqueue::traits>
Inserts a new element in the priority queue (move semantics)
The function always returns true
- Parameters
-
val | Value to be moved to inserted element |
◆ size()
template<typename T , class PriorityQueue = std::priority_queue<T>, typename Traits = fcpqueue::traits>
Returns the number of elements in the priority queue.
Note that size() == 0
does 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:
- cds/container/fcpriority_queue.h