#include "univ.i"
Go to the source code of this file.
Classes | |
struct | ib_bh_struct |
Typedefs | |
typedef int(* | ib_bh_cmp_t )(const void *p1, const void *p2) |
typedef struct ib_bh_struct | ib_bh_t |
Functions | |
UNIV_INLINE ulint | ib_bh_size (const ib_bh_t *ib_bh) |
UNIV_INLINE ibool | ib_bh_is_empty (const ib_bh_t *ib_bh) |
UNIV_INLINE ibool | ib_bh_is_full (const ib_bh_t *ib_bh) |
UNIV_INLINE void * | ib_bh_get (ib_bh_t *ib_bh, ulint i) |
UNIV_INLINE void * | ib_bh_set (ib_bh_t *ib_bh, ulint i, const void *elem) |
UNIV_INLINE void * | ib_bh_first (ib_bh_t *ib_bh) |
UNIV_INLINE void * | ib_bh_last (ib_bh_t *ib_bh) |
UNIV_INTERN ib_bh_t * | ib_bh_create (ib_bh_cmp_t compare, ulint sizeof_elem, ulint max_elems) |
UNIV_INTERN void | ib_bh_free (ib_bh_t *ib_bh) |
UNIV_INTERN void * | ib_bh_push (ib_bh_t *ib_bh, const void *elem) |
UNIV_INTERN void | ib_bh_pop (ib_bh_t *ib_bh) |
Copyright (c) 2011, Oracle Corpn. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Binary min-heap interface.
Created 2010-05-28 by Sunny Bains
Definition in file ut0bh.h.
typedef int(* ib_bh_cmp_t)(const void *p1, const void *p2) |
UNIV_INTERN ib_bh_t* ib_bh_create | ( | ib_bh_cmp_t | compare, |
ulint | sizeof_elem, | ||
ulint | max_elems | ||
) |
Create a binary heap.
Create a binary heap.
compare | in: comparator |
sizeof_elem | in: size of one element |
max_elems | in: max elements allowed |
Definition at line 45 of file ut0bh.cc.
References ib_bh_create(), and ut_malloc().
Referenced by ib_bh_create(), and trx_sys_init_at_db_start().
UNIV_INLINE void* ib_bh_first | ( | ib_bh_t * | ib_bh) |
Return the first element from the binary heap.
Referenced by ib_bh_pop().
UNIV_INTERN void ib_bh_free | ( | ib_bh_t * | ib_bh) |
Free a binary heap.
Free a binary heap.
ib_bh | in/own: instance |
Definition at line 71 of file ut0bh.cc.
References ib_bh_free(), and ut_free().
Referenced by ib_bh_free(), and trx_purge_sys_close().
UNIV_INLINE void* ib_bh_get | ( | ib_bh_t * | ib_bh, |
ulint | i | ||
) |
Get a pointer to the element.
ib_bh | in: instance |
Referenced by ib_bh_pop(), and ib_bh_push().
UNIV_INLINE ibool ib_bh_is_empty | ( | const ib_bh_t * | ib_bh) |
Test if binary heap is empty.
Referenced by ib_bh_pop(), and ib_bh_push().
UNIV_INLINE ibool ib_bh_is_full | ( | const ib_bh_t * | ib_bh) |
UNIV_INLINE void* ib_bh_last | ( | ib_bh_t * | ib_bh) |
Return the last element from the binary heap.
Referenced by ib_bh_pop().
UNIV_INTERN void ib_bh_pop | ( | ib_bh_t * | ib_bh) |
Remove the first element from the binary heap. in/out: instance
Remove the first element from the binary heap.
ib_bh | in/out: instance |
Definition at line 119 of file ut0bh.cc.
References ib_bh_struct::compare, ib_bh_first(), ib_bh_get(), ib_bh_is_empty(), ib_bh_last(), ib_bh_pop(), ib_bh_set(), ib_bh_size(), ib_bh_struct::n_elems, and ib_bh_struct::sizeof_elem.
Referenced by ib_bh_pop().
UNIV_INTERN void* ib_bh_push | ( | ib_bh_t * | ib_bh, |
const void * | elem | ||
) |
Add an element to the binary heap. Note: The element is copied.
Add an element to the binary heap. Note: The element is copied.
ib_bh | in/out: instance |
elem | in: element to add |
Definition at line 83 of file ut0bh.cc.
References ib_bh_struct::compare, ib_bh_get(), ib_bh_is_empty(), ib_bh_is_full(), ib_bh_push(), ib_bh_set(), and ib_bh_struct::n_elems.
Referenced by ib_bh_push().
UNIV_INLINE void* ib_bh_set | ( | ib_bh_t * | ib_bh, |
ulint | i, | ||
const void * | elem | ||
) |
Copy an element to the binary heap.
ib_bh | in/out: instance |
i | in: index |
Referenced by ib_bh_pop(), and ib_bh_push().
UNIV_INLINE ulint ib_bh_size | ( | const ib_bh_t * | ib_bh) |
Get the number of elements in the binary heap.
Referenced by ib_bh_pop().