InnoDB Plugin
1.0
|
#include "univ.i"
Go to the source code of this file.
Data Structures | |
struct | ut_list_base< TYPE > |
struct | ut_list_node< TYPE > |
struct | NullValidate |
Macros | |
#define | IB_OFFSETOF(T, F) (reinterpret_cast<byte*>(&(T)->F) - reinterpret_cast<byte*>(T)) |
#define | UT_LIST_BASE_NODE_T(TYPE) ut_list_base<TYPE> |
#define | UT_LIST_NODE_T(TYPE) ut_list_node<TYPE> |
#define | UT_LIST_INIT(BASE) |
#define | UT_LIST_ADD_FIRST(NAME, LIST, ELEM) ut_list_prepend(LIST, *ELEM, IB_OFFSETOF(ELEM, NAME)) |
#define | UT_LIST_ADD_LAST(NAME, LIST, ELEM) ut_list_append(LIST, *ELEM, IB_OFFSETOF(ELEM, NAME)) |
#define | UT_LIST_INSERT_AFTER(NAME, LIST, ELEM1, ELEM2) ut_list_insert(LIST, *ELEM1, *ELEM2, IB_OFFSETOF(ELEM1, NAME)) |
#define | UT_LIST_REMOVE_CLEAR(N) |
#define | UT_LIST_REMOVE(NAME, LIST, ELEM) ut_list_remove(LIST, *ELEM, IB_OFFSETOF(ELEM, NAME)) |
#define | UT_LIST_GET_NEXT(NAME, N) (((N)->NAME).next) |
#define | UT_LIST_GET_PREV(NAME, N) (((N)->NAME).prev) |
#define | UT_LIST_GET_LEN(BASE) (BASE).count |
#define | UT_LIST_GET_FIRST(BASE) (BASE).start |
#define | UT_LIST_GET_LAST(BASE) (BASE).end |
#define | UT_LIST_VALIDATE(NAME, TYPE, LIST, FUNCTOR) ut_list_validate(LIST, &TYPE::NAME, FUNCTOR) |
#define | UT_LIST_CHECK(NAME, TYPE, LIST) ut_list_validate(LIST, &TYPE::NAME, NullValidate()) |
Functions | |
template<typename Type > | |
ut_list_node< Type > & | ut_elem_get_node (Type &elem, size_t offset) |
template<typename List , typename Type > | |
void | ut_list_prepend (List &list, Type &elem, size_t offset) |
template<typename List , typename Type > | |
void | ut_list_append (List &list, Type &elem, size_t offset) |
template<typename List , typename Type > | |
void | ut_list_insert (List &list, Type &elem1, Type &elem2, size_t offset) |
template<typename List , typename Type > | |
void | ut_list_remove (List &list, Type &elem, size_t offset) |
template<typename List , class Functor > | |
void | ut_list_map (List &list, ut_list_node< typename List::elem_type > List::elem_type::*node, Functor functor) |
template<typename List , class Functor > | |
void | ut_list_validate (List &list, ut_list_node< typename List::elem_type > List::elem_type::*node, Functor functor=NullValidate()) |
List utilities
Created 9/10/1995 Heikki Tuuri
#define IB_OFFSETOF | ( | T, | |
F | |||
) | (reinterpret_cast<byte*>(&(T)->F) - reinterpret_cast<byte*>(T)) |
Return offset of F in POD T.
T | - POD pointer |
F | - Field in T |
#define UT_LIST_ADD_FIRST | ( | NAME, | |
LIST, | |||
ELEM | |||
) | ut_list_prepend(LIST, *ELEM, IB_OFFSETOF(ELEM, NAME)) |
Adds the node as the first element in a two-way linked list.
NAME | list name |
LIST | the base node (not a pointer to it) |
ELEM | the element to add |
#define UT_LIST_ADD_LAST | ( | NAME, | |
LIST, | |||
ELEM | |||
) | ut_list_append(LIST, *ELEM, IB_OFFSETOF(ELEM, NAME)) |
Adds the node as the last element in a two-way linked list.
NAME | list name |
LIST | list |
ELEM | the element to add |
#define UT_LIST_GET_FIRST | ( | BASE | ) | (BASE).start |
Gets the first node in a two-way list.
BASE | the base node (not a pointer to it) |
#define UT_LIST_GET_LAST | ( | BASE | ) | (BASE).end |
Gets the last node in a two-way list.
BASE | the base node (not a pointer to it) |
#define UT_LIST_GET_LEN | ( | BASE | ) | (BASE).count |
Alternative macro to get the number of nodes in a two-way list, i.e., its length.
BASE | the base node (not a pointer to it). |
#define UT_LIST_GET_NEXT | ( | NAME, | |
N | |||
) | (((N)->NAME).next) |
Gets the next node in a two-way list.
NAME | list name |
N | pointer to a node |
#define UT_LIST_GET_PREV | ( | NAME, | |
N | |||
) | (((N)->NAME).prev) |
Gets the previous node in a two-way list.
NAME | list name |
N | pointer to a node |
#define UT_LIST_INIT | ( | BASE | ) |
Initializes the base node of a two-way list.
BASE | the list base node |
#define UT_LIST_INSERT_AFTER | ( | NAME, | |
LIST, | |||
ELEM1, | |||
ELEM2 | |||
) | ut_list_insert(LIST, *ELEM1, *ELEM2, IB_OFFSETOF(ELEM1, NAME)) |
Inserts a ELEM2 after ELEM1 in a list.
NAME | list name |
LIST | the base node |
ELEM1 | node after which ELEM2 is inserted |
ELEM2 | node being inserted after ELEM1 |
#define UT_LIST_REMOVE | ( | NAME, | |
LIST, | |||
ELEM | |||
) | ut_list_remove(LIST, *ELEM, IB_OFFSETOF(ELEM, NAME)) |
Removes a node from a two-way linked list. aram NAME list name
LIST | the base node (not a pointer to it) |
ELEM | node to be removed from the list |
#define UT_LIST_REMOVE_CLEAR | ( | N | ) |
Invalidate the pointers in a list node.
NAME | list name |
N | pointer to the node that was removed |
#define UT_LIST_VALIDATE | ( | NAME, | |
TYPE, | |||
LIST, | |||
FUNCTOR | |||
) | ut_list_validate(LIST, &TYPE::NAME, FUNCTOR) |
Checks the consistency of a two-way list.
NAME | the name of the list |
TYPE | node type |
LIST | base node (not a pointer to it) |
FUNCTOR | called for each list element |
ut_list_node<Type>& ut_elem_get_node | ( | Type & | elem, |
size_t | offset | ||
) |
Get the list node at offset.
elem | - list element |
offset | - offset within element. |
void ut_list_append | ( | List & | list, |
Type & | elem, | ||
size_t | offset | ||
) |
Adds the node as the last element in a two-way linked list.
list | list |
elem | the element to add |
offset | offset of list node in elem |
void ut_list_insert | ( | List & | list, |
Type & | elem1, | ||
Type & | elem2, | ||
size_t | offset | ||
) |
Inserts a ELEM2 after ELEM1 in a list.
list | the base node |
elem1 | node after which ELEM2 is inserted |
elem2 | node being inserted after NODE1 |
offset | offset of list node in elem1 and elem2 |
void ut_list_map | ( | List & | list, |
ut_list_node< typename List::elem_type > List::elem_type::* | node, | ||
Functor | functor | ||
) |
Iterate over all the elements and call the functor for each element.
list | base node (not a pointer to it) |
functor | Functor that is called for each element in the list node pointer to member node within list element |
void ut_list_prepend | ( | List & | list, |
Type & | elem, | ||
size_t | offset | ||
) |
Adds the node as the first element in a two-way linked list.
list | the base node (not a pointer to it) |
elem | the element to add |
offset | offset of list node in elem. |
void ut_list_remove | ( | List & | list, |
Type & | elem, | ||
size_t | offset | ||
) |
Removes a node from a two-way linked list.
list | the base node (not a pointer to it) |
elem | node to be removed from the list |
offset | offset of list node within elem |
void ut_list_validate | ( | List & | list, |
ut_list_node< typename List::elem_type > List::elem_type::* | node, | ||
Functor | functor = NullValidate() |
||
) |
Checks the consistency of a two-way list.
list | base node (not a pointer to it) |
functor | Functor that is called for each element in the list node pointer to member node within list element |