MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ut0bh.h File Reference
#include "univ.i"
#include "ut0bh.ic"
Include dependency graph for ut0bh.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ib_bh_t

Typedefs

typedef int(* ib_bh_cmp_t )(const void *p1, const void *p2)

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_tib_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)

Detailed Description

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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA

Binary min-heap interface.

Created 2010-05-28 by Sunny Bains

Definition in file ut0bh.h.

Typedef Documentation

typedef int(* ib_bh_cmp_t)(const void *p1, const void *p2)

Comparison function for objects in the binary heap.

Definition at line 32 of file ut0bh.h.

Function Documentation

UNIV_INTERN ib_bh_t* ib_bh_create ( ib_bh_cmp_t  compare,
ulint  sizeof_elem,
ulint  max_elems 
)

Create a binary heap.

Returns
a new binary heap in: max elements allowed

Create a binary heap.

Returns
a new binary heap
Parameters
comparein: comparator
sizeof_elemin: size of one element
max_elemsin: max elements allowed

Definition at line 40 of file ut0bh.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE void* ib_bh_first ( ib_bh_t ib_bh)

Return the first element from the binary heap.

Returns
pointer to first element or NULL if empty. in: instance

Here is the caller graph for this function:

UNIV_INTERN void ib_bh_free ( ib_bh_t ib_bh)

Free a binary heap.

Returns
a new binary heap in,own: instance

Free a binary heap.

Returns
a new binary heap
Parameters
ib_bhin/own: instance

Definition at line 66 of file ut0bh.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE void* ib_bh_get ( ib_bh_t ib_bh,
ulint  i 
)

Get a pointer to the element.

Returns
pointer to element in: index
Parameters
ib_bhin: instance

Here is the caller graph for this function:

UNIV_INLINE ibool ib_bh_is_empty ( const ib_bh_t ib_bh)

Test if binary heap is empty.

Returns
TRUE if empty. in: instance

Here is the caller graph for this function:

UNIV_INLINE ibool ib_bh_is_full ( const ib_bh_t ib_bh)

Test if binary heap is full.

Returns
TRUE if full. in: instance

Here is the caller graph for this function:

UNIV_INLINE void* ib_bh_last ( ib_bh_t ib_bh)

Return the last element from the binary heap.

Returns
pointer to last element or NULL if empty. in/out: instance

Here is the caller graph for this function:

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.

Parameters
ib_bhin/out: instance

Definition at line 114 of file ut0bh.cc.

Here is the call graph for this function:

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.

Returns
pointer to added element or NULL if full. in: element to add

Add an element to the binary heap. Note: The element is copied.

Returns
pointer to added element or NULL if full.
Parameters
ib_bhin/out: instance
elemin: element to add

Definition at line 78 of file ut0bh.cc.

Here is the call graph for this function:

UNIV_INLINE void* ib_bh_set ( ib_bh_t ib_bh,
ulint  i,
const void *  elem 
)

Copy an element to the binary heap.

Returns
pointer to copied element in: element to add
Parameters
ib_bhin/out: instance
iin: index

Here is the caller graph for this function:

UNIV_INLINE ulint ib_bh_size ( const ib_bh_t ib_bh)

Get the number of elements in the binary heap.

Returns
number of elements in: instance

Here is the caller graph for this function: