MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / push

Method push

sql/bounded_queue.h:182–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180
181template<typename Element_type, typename Key_type>
182void Bounded_queue<Element_type, Key_type>::push(Element_type *element)
183{
184 DBUG_ASSERT(is_initialized());
185 if (queue_is_full((&m_queue)))
186 {
187 // Replace top element with new key, and re-order the queue.
188 Key_type **pq_top= reinterpret_cast<Key_type **>(queue_top(&m_queue));
189 (*m_keymaker)(m_sort_param, *pq_top, element);
190 queue_replaced(&m_queue);
191 } else {
192 // Insert new key into the queue.
193 (*m_keymaker)(m_sort_param, m_sort_keys[m_queue.elements], element);
194 queue_insert(&m_queue,
195 reinterpret_cast<uchar*>(&m_sort_keys[m_queue.elements]));
196 }
197}
198
199#endif // BOUNDED_QUEUE_INCLUDED

Callers 2

merge_sortFunction · 0.80

Calls 2

queue_replacedFunction · 0.85
queue_insertFunction · 0.85

Tested by

no test coverage detected