Ponca
aa50bfdf187919869239c5b44b748842569114c1
Point Cloud Analysis library
|
The limited_priority_queue class is similar to std::priority_queue but has a limited capacity and handles the comparison differently. More...
#include <limitedPriorityQueue.h>
Public Types | |
using | value_type = T |
using | container_type = std::vector< T > |
using | compare = CompareT |
using | iterator = typename container_type::iterator |
using | const_iterator = typename container_type::const_iterator |
using | this_type = limited_priority_queue< T, CompareT > |
Public Member Functions | |
limited_priority_queue (const this_type &other) | |
limited_priority_queue (int capacity) | |
template<class InputIt > | |
limited_priority_queue (int capacity, InputIt first, InputIt last) | |
limited_priority_queue & | operator= (const this_type &other) |
iterator | begin () |
const_iterator | begin () const |
const_iterator | cbegin () const |
iterator | end () |
const_iterator | end () const |
const_iterator | cend () const |
const T & | top () const |
const T & | bottom () const |
T & | top () |
T & | bottom () |
bool | empty () const |
bool | full () const |
size_t | size () const |
size_t | capacity () const |
bool | push (const T &value) |
bool | push (T &&value) |
void | pop () |
void | reserve (int capacity) |
void | clear () |
const container_type & | container () const |
Protected Attributes | |
container_type | m_c |
compare | m_comp |
size_t | m_size {0} |
The limited_priority_queue class is similar to std::priority_queue but has a limited capacity and handles the comparison differently.
In case the capacity is reached, the container is full and push() do not insert a new element if its priority is lower than the current minimal one.
The comparison predicate must return true is the first argument has priority on the second one.
The element with the highest priority is the last one that is pop out, but is the first one that is iterated through.
Example 1: Using std::less as comparison predicate, we have the following situation:
full() = false empty() = false capacity() = 6 size() = 4 top() = 1 bottom() = 9 pop() removes the value 9 push(4) adds the value 4 begin end v v +---+---+---+---+---+---+ | 1 | 3 | 8 | 9 | | | +---+---+---+---+---+---+ ^ ^ top bottom
Example 2: Using std::greater as comparison predicate, we have the following situation:
full() = true empty() = false capacity() = 6 size() = 6 top() = 9 bottom() = 2 begin end v v +---+---+---+---+---+---+ | 9 | 8 | 6 | 4 | 3 | 2 | +---+---+---+---+---+---+ ^ ^ top bottom pop() removes the value 2 push(5) adds the value 5 and remove the value 2 push(0) do nothing
Definition at line 76 of file limitedPriorityQueue.h.
using Ponca::limited_priority_queue< T, CompareT >::compare = CompareT |
Definition at line 81 of file limitedPriorityQueue.h.
using Ponca::limited_priority_queue< T, CompareT >::const_iterator = typename container_type::const_iterator |
Definition at line 83 of file limitedPriorityQueue.h.
using Ponca::limited_priority_queue< T, CompareT >::container_type = std::vector<T> |
Definition at line 80 of file limitedPriorityQueue.h.
using Ponca::limited_priority_queue< T, CompareT >::iterator = typename container_type::iterator |
Definition at line 82 of file limitedPriorityQueue.h.
using Ponca::limited_priority_queue< T, CompareT >::this_type = limited_priority_queue<T,CompareT> |
Definition at line 84 of file limitedPriorityQueue.h.
using Ponca::limited_priority_queue< T, CompareT >::value_type = T |
Definition at line 79 of file limitedPriorityQueue.h.
|
inline |
Definition at line 152 of file limitedPriorityQueue.h.
|
inline |
Definition at line 161 of file limitedPriorityQueue.h.
|
inlineexplicit |
Definition at line 169 of file limitedPriorityQueue.h.
|
inline |
Definition at line 178 of file limitedPriorityQueue.h.
|
inline |
Definition at line 190 of file limitedPriorityQueue.h.
|
inline |
Definition at line 206 of file limitedPriorityQueue.h.
|
inline |
Definition at line 212 of file limitedPriorityQueue.h.
|
inline |
Definition at line 262 of file limitedPriorityQueue.h.
|
inline |
Definition at line 250 of file limitedPriorityQueue.h.
|
inline |
Definition at line 288 of file limitedPriorityQueue.h.
|
inline |
Definition at line 218 of file limitedPriorityQueue.h.
|
inline |
Definition at line 236 of file limitedPriorityQueue.h.
|
inline |
Definition at line 398 of file limitedPriorityQueue.h.
|
inline |
Definition at line 406 of file limitedPriorityQueue.h.
|
inline |
Definition at line 270 of file limitedPriorityQueue.h.
|
inline |
Definition at line 224 of file limitedPriorityQueue.h.
|
inline |
Definition at line 230 of file limitedPriorityQueue.h.
|
inline |
Definition at line 276 of file limitedPriorityQueue.h.
|
inline |
Definition at line 195 of file limitedPriorityQueue.h.
|
inline |
Definition at line 382 of file limitedPriorityQueue.h.
|
inline |
Definition at line 296 of file limitedPriorityQueue.h.
|
inline |
Definition at line 339 of file limitedPriorityQueue.h.
|
inline |
Definition at line 388 of file limitedPriorityQueue.h.
|
inline |
Definition at line 282 of file limitedPriorityQueue.h.
|
inline |
Definition at line 256 of file limitedPriorityQueue.h.
|
inline |
Definition at line 244 of file limitedPriorityQueue.h.
|
protected |
Definition at line 139 of file limitedPriorityQueue.h.
|
protected |
Definition at line 140 of file limitedPriorityQueue.h.
|
protected |
Definition at line 141 of file limitedPriorityQueue.h.