|
Ponca
bab7704293a2c36e5bed9dea40def7ba839bfe08
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>
Inheritance diagram for Ponca::limited_priority_queue< T, CompareT >:
Collaboration diagram for Ponca::limited_priority_queue< T, CompareT >: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 77 of file limitedPriorityQueue.h.
| using Ponca::limited_priority_queue< T, CompareT >::compare = CompareT |
Definition at line 82 of file limitedPriorityQueue.h.
| using Ponca::limited_priority_queue< T, CompareT >::const_iterator = typename container_type::const_iterator |
Definition at line 84 of file limitedPriorityQueue.h.
| using Ponca::limited_priority_queue< T, CompareT >::container_type = std::vector<T> |
Definition at line 81 of file limitedPriorityQueue.h.
| using Ponca::limited_priority_queue< T, CompareT >::iterator = typename container_type::iterator |
Definition at line 83 of file limitedPriorityQueue.h.
| using Ponca::limited_priority_queue< T, CompareT >::this_type = limited_priority_queue<T, CompareT> |
Definition at line 85 of file limitedPriorityQueue.h.
| using Ponca::limited_priority_queue< T, CompareT >::value_type = T |
Definition at line 80 of file limitedPriorityQueue.h.
|
inline |
Definition at line 153 of file limitedPriorityQueue.h.
|
inline |
Definition at line 158 of file limitedPriorityQueue.h.
|
inlineexplicit |
Definition at line 164 of file limitedPriorityQueue.h.
|
inline |
Definition at line 170 of file limitedPriorityQueue.h.
|
inline |
Definition at line 180 of file limitedPriorityQueue.h.
|
inline |
Definition at line 196 of file limitedPriorityQueue.h.
|
inline |
Definition at line 202 of file limitedPriorityQueue.h.
|
inline |
Definition at line 252 of file limitedPriorityQueue.h.
|
inline |
Definition at line 240 of file limitedPriorityQueue.h.
|
inline |
Definition at line 278 of file limitedPriorityQueue.h.
|
inline |
Definition at line 208 of file limitedPriorityQueue.h.
|
inline |
Definition at line 226 of file limitedPriorityQueue.h.
|
inline |
Definition at line 388 of file limitedPriorityQueue.h.
|
inline |
Definition at line 396 of file limitedPriorityQueue.h.
|
inline |
Definition at line 260 of file limitedPriorityQueue.h.
|
inline |
Definition at line 214 of file limitedPriorityQueue.h.
|
inline |
Definition at line 220 of file limitedPriorityQueue.h.
|
inline |
Definition at line 266 of file limitedPriorityQueue.h.
|
inline |
Definition at line 185 of file limitedPriorityQueue.h.
|
inline |
Definition at line 372 of file limitedPriorityQueue.h.
|
inline |
Definition at line 286 of file limitedPriorityQueue.h.
|
inline |
Definition at line 329 of file limitedPriorityQueue.h.
|
inline |
Definition at line 378 of file limitedPriorityQueue.h.
|
inline |
Definition at line 272 of file limitedPriorityQueue.h.
|
inline |
Definition at line 246 of file limitedPriorityQueue.h.
|
inline |
Definition at line 234 of file limitedPriorityQueue.h.
|
protected |
Definition at line 140 of file limitedPriorityQueue.h.
|
protected |
Definition at line 141 of file limitedPriorityQueue.h.
|
protected |
Definition at line 142 of file limitedPriorityQueue.h.