24#ifndef BOUNDED_QUEUE_INCLUDED
25#define BOUNDED_QUEUE_INCLUDED
48template <
typename Element_type,
typename Key_type,
typename Key_generator,
49 typename Key_compare = std::less<Key_type>>
53 Key_type, std::vector<Key_type, Malloc_allocator<Key_type>>, Key_compare>
59 size_t element_size =
sizeof(Element_type),
61 :
m_queue(Key_compare(), alloc),
81 Key_type *sort_keys) {
91 m_queue.m_compare_length = sort_param->max_compare_length();
93 if (sort_param->using_varlen_keys())
m_queue.m_param = sort_param;
106 template <
class Opaque>
107 [[nodiscard]]
bool push(
const Opaque &opaque) {
122 m_sort_param->make_sortkey(pq_top, element_size, opaque);
125 if (rec_sz == UINT_MAX)
return true;
134 if (rec_sz == UINT_MAX)
return true;
A priority queue with a fixed, limited size.
Definition: bounded_queue.h:50
Key_generator * m_sort_param
Definition: bounded_queue.h:148
Queue_type m_queue
Definition: bounded_queue.h:146
Queue_type::allocator_type allocator_type
Definition: bounded_queue.h:56
size_t num_elements() const
The number of elements in the queue.
Definition: bounded_queue.h:143
Priority_queue< Key_type, std::vector< Key_type, Malloc_allocator< Key_type > >, Key_compare > Queue_type
Definition: bounded_queue.h:54
Key_type * m_sort_keys
Definition: bounded_queue.h:147
bool push(const Opaque &opaque)
Pushes an element on the queue.
Definition: bounded_queue.h:107
size_t m_element_size
Definition: bounded_queue.h:149
Bounded_queue(size_t element_size=sizeof(Element_type), const allocator_type &alloc=allocator_type(PSI_NOT_INSTRUMENTED))
Definition: bounded_queue.h:58
bool init(ha_rows max_elements, Key_generator *sort_param, Key_type *sort_keys)
Initialize the queue.
Definition: bounded_queue.h:80
Implements a priority queue using a vector-based max-heap.
Definition: priority_queue.h:104
size_type capacity() const
Returns the capacity of the internal container.
Definition: priority_queue.h:409
container_type::allocator_type allocator_type
Definition: priority_queue.h:112
value_type const & top() const
Returns a const reference to the top element of the priority queue.
Definition: priority_queue.h:223
bool reserve(size_type n)
Reserves space for array elements.
Definition: priority_queue.h:417
size_type size() const
Returns the number of elements of the priority queue.
Definition: priority_queue.h:338
void update_top()
Assumes that the top element's value has changed and rebuilds the priority queue.
Definition: priority_queue.h:332
bool push(value_type const &x)
Inserts an element in the priority queue.
Definition: priority_queue.h:240
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:216
#define ME_FATALERROR
Definition: my_sys.h:152
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1140
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:171
#define MYF(v)
Definition: my_inttypes.h:97
Common header for many mysys elements.
#define EE_OUTOFMEMORY
Definition: mysys_err.h:50
unsigned int uint
Definition: uca9-dump.cc:75
#define PSI_NOT_INSTRUMENTED
Definition: validate_password_imp.cc:42