23#ifndef BOUNDED_QUEUE_INCLUDED
24#define BOUNDED_QUEUE_INCLUDED
47template <
typename Element_type,
typename Key_type,
typename Key_generator,
48 typename Key_compare = std::less<Key_type>>
52 Key_type, std::vector<Key_type, Malloc_allocator<Key_type>>, Key_compare>
58 size_t element_size =
sizeof(Element_type),
60 :
m_queue(Key_compare(), alloc),
80 Key_type *sort_keys) {
90 m_queue.m_compare_length = sort_param->max_compare_length();
92 if (sort_param->using_varlen_keys())
m_queue.m_param = sort_param;
105 template <
class Opaque>
106 [[nodiscard]]
bool push(
const Opaque &opaque) {
121 m_sort_param->make_sortkey(pq_top, element_size, opaque);
124 if (rec_sz == UINT_MAX)
return true;
133 if (rec_sz == UINT_MAX)
return true;
A priority queue with a fixed, limited size.
Definition: bounded_queue.h:49
Key_generator * m_sort_param
Definition: bounded_queue.h:147
Queue_type m_queue
Definition: bounded_queue.h:145
Queue_type::allocator_type allocator_type
Definition: bounded_queue.h:55
size_t num_elements() const
The number of elements in the queue.
Definition: bounded_queue.h:142
Priority_queue< Key_type, std::vector< Key_type, Malloc_allocator< Key_type > >, Key_compare > Queue_type
Definition: bounded_queue.h:53
Key_type * m_sort_keys
Definition: bounded_queue.h:146
bool push(const Opaque &opaque)
Pushes an element on the queue.
Definition: bounded_queue.h:106
size_t m_element_size
Definition: bounded_queue.h:148
Bounded_queue(size_t element_size=sizeof(Element_type), const allocator_type &alloc=allocator_type(PSI_NOT_INSTRUMENTED))
Definition: bounded_queue.h:57
bool init(ha_rows max_elements, Key_generator *sort_param, Key_type *sort_keys)
Initialize the queue.
Definition: bounded_queue.h:79
Implements a priority queue using a vector-based max-heap.
Definition: priority_queue.h:103
size_type capacity() const
Returns the capacity of the internal container.
Definition: priority_queue.h:408
container_type::allocator_type allocator_type
Definition: priority_queue.h:111
value_type const & top() const
Returns a const reference to the top element of the priority queue.
Definition: priority_queue.h:222
bool reserve(size_type n)
Reserves space for array elements.
Definition: priority_queue.h:416
size_type size() const
Returns the number of elements of the priority queue.
Definition: priority_queue.h:337
void update_top()
Assumes that the top element's value has changed and rebuilds the priority queue.
Definition: priority_queue.h:331
bool push(value_type const &x)
Inserts an element in the priority queue.
Definition: priority_queue.h:239
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:215
#define ME_FATALERROR
Definition: my_sys.h:154
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1139
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:170
#define MYF(v)
Definition: my_inttypes.h:96
Common header for many mysys elements.
#define EE_OUTOFMEMORY
Definition: mysys_err.h:49
#define PSI_NOT_INSTRUMENTED
Definition: validate_password_imp.cc:41