gdsl
1.6
|
Typedefs | |
typedef _gdsl_bintree_t | _gdsl_bstree_t |
GDSL low-level binary search tree type. | |
typedef int(* | _gdsl_bstree_map_func_t )(_gdsl_bstree_t TREE, void *USER_DATA) |
GDSL low-level binary search tree map function type. | |
typedef void(* | _gdsl_bstree_write_func_t )(_gdsl_bstree_t TREE, FILE *OUTPUT_FILE, void *USER_DATA) |
GDSL low-level binary search tree write function type. | |
Functions | |
_gdsl_bstree_t | _gdsl_bstree_alloc (const gdsl_element_t E) |
Create a new low-level binary search tree. | |
void | _gdsl_bstree_free (_gdsl_bstree_t T, const gdsl_free_func_t FREE_F) |
Destroy a low-level binary search tree. | |
_gdsl_bstree_t | _gdsl_bstree_copy (const _gdsl_bstree_t T, const gdsl_copy_func_t COPY_F) |
Copy a low-level binary search tree. | |
bool | _gdsl_bstree_is_empty (const _gdsl_bstree_t T) |
Check if a low-level binary search tree is empty. | |
bool | _gdsl_bstree_is_leaf (const _gdsl_bstree_t T) |
Check if a low-level binary search tree is reduced to a leaf. | |
gdsl_element_t | _gdsl_bstree_get_content (const _gdsl_bstree_t T) |
Get the root content of a low-level binary search tree. | |
bool | _gdsl_bstree_is_root (const _gdsl_bstree_t T) |
Check if a low-level binary search tree is a root. | |
_gdsl_bstree_t | _gdsl_bstree_get_parent (const _gdsl_bstree_t T) |
Get the parent tree of a low-level binary search tree. | |
_gdsl_bstree_t | _gdsl_bstree_get_left (const _gdsl_bstree_t T) |
Get the left sub-tree of a low-level binary search tree. | |
_gdsl_bstree_t | _gdsl_bstree_get_right (const _gdsl_bstree_t T) |
Get the right sub-tree of a low-level binary search tree. | |
ulong | _gdsl_bstree_get_size (const _gdsl_bstree_t T) |
Get the size of a low-level binary search tree. | |
ulong | _gdsl_bstree_get_height (const _gdsl_bstree_t T) |
Get the height of a low-level binary search tree. | |
_gdsl_bstree_t | _gdsl_bstree_insert (_gdsl_bstree_t *T, const gdsl_compare_func_t COMP_F, const gdsl_element_t VALUE, int *RESULT) |
Insert an element into a low-level binary search tree if it's not found or return it. | |
gdsl_element_t | _gdsl_bstree_remove (_gdsl_bstree_t *T, const gdsl_compare_func_t COMP_F, const gdsl_element_t VALUE) |
Remove an element from a low-level binary search tree. | |
_gdsl_bstree_t | _gdsl_bstree_search (const _gdsl_bstree_t T, const gdsl_compare_func_t COMP_F, const gdsl_element_t VALUE) |
Search for a particular element into a low-level binary search tree. | |
_gdsl_bstree_t | _gdsl_bstree_search_next (const _gdsl_bstree_t T, const gdsl_compare_func_t COMP_F, const gdsl_element_t VALUE) |
Search for the next element of a particular element into a low-level binary search tree, according to the binary search tree order. | |
_gdsl_bstree_t | _gdsl_bstree_map_prefix (const _gdsl_bstree_t T, const _gdsl_bstree_map_func_t MAP_F, void *USER_DATA) |
Parse a low-level binary search tree in prefixed order. | |
_gdsl_bstree_t | _gdsl_bstree_map_infix (const _gdsl_bstree_t T, const _gdsl_bstree_map_func_t MAP_F, void *USER_DATA) |
Parse a low-level binary search tree in infixed order. | |
_gdsl_bstree_t | _gdsl_bstree_map_postfix (const _gdsl_bstree_t T, const _gdsl_bstree_map_func_t MAP_F, void *USER_DATA) |
Parse a low-level binary search tree in postfixed order. | |
void | _gdsl_bstree_write (const _gdsl_bstree_t T, const _gdsl_bstree_write_func_t WRITE_F, FILE *OUTPUT_FILE, void *USER_DATA) |
Write the content of all nodes of a low-level binary search tree to a file. | |
void | _gdsl_bstree_write_xml (const _gdsl_bstree_t T, const _gdsl_bstree_write_func_t WRITE_F, FILE *OUTPUT_FILE, void *USER_DATA) |
Write the content of a low-level binary search tree to a file into XML. | |
void | _gdsl_bstree_dump (const _gdsl_bstree_t T, const _gdsl_bstree_write_func_t WRITE_F, FILE *OUTPUT_FILE, void *USER_DATA) |
Dump the internal structure of a low-level binary search tree to a file. |
typedef _gdsl_bintree_t _gdsl_bstree_t |
GDSL low-level binary search tree type.
This type is voluntary opaque. Variables of this kind could'nt be directly used, but by the functions of this module.
Definition at line 52 of file _gdsl_bstree.h.
typedef int(* _gdsl_bstree_map_func_t)(_gdsl_bstree_t TREE, void *USER_DATA) |
GDSL low-level binary search tree map function type.
TREE | The low-level binary search tree to map. |
USER_DATA | The user datas to pass to this function. |
Definition at line 61 of file _gdsl_bstree.h.
typedef void(* _gdsl_bstree_write_func_t)(_gdsl_bstree_t TREE, FILE *OUTPUT_FILE, void *USER_DATA) |
GDSL low-level binary search tree write function type.
TREE | The low-level binary search tree to write. |
OUTPUT_FILE | The file where to write TREE. |
USER_DATA | The user datas to pass to this function. |
Definition at line 71 of file _gdsl_bstree.h.
_gdsl_bstree_t _gdsl_bstree_alloc | ( | const gdsl_element_t | E | ) |
Create a new low-level binary search tree.
Allocate a new low-level binary search tree data structure. Its root content is sets to E and its left and right sons are set to NULL.
E | The root content of the new low-level binary search tree to create. |
void _gdsl_bstree_free | ( | _gdsl_bstree_t | T, |
const gdsl_free_func_t | FREE_F | ||
) |
Destroy a low-level binary search tree.
Flush and destroy the low-level binary search tree T. If FREE_F != NULL, FREE_F function is used to deallocate each T's element. Otherwise nothing is done with T's elements.
T | The low-level binary search tree to destroy. |
FREE_F | The function used to deallocate T's nodes contents. |
_gdsl_bstree_t _gdsl_bstree_copy | ( | const _gdsl_bstree_t | T, |
const gdsl_copy_func_t | COPY_F | ||
) |
Copy a low-level binary search tree.
Create and return a copy of the low-level binary search tree T using COPY_F on each T's element to copy them.
T | The low-level binary search tree to copy. |
COPY_F | The function used to copy T's nodes contents. |
bool _gdsl_bstree_is_empty | ( | const _gdsl_bstree_t | T | ) |
Check if a low-level binary search tree is empty.
T | The low-level binary search tree to check. |
bool _gdsl_bstree_is_leaf | ( | const _gdsl_bstree_t | T | ) |
Check if a low-level binary search tree is reduced to a leaf.
T | The low-level binary search tree to check. |
gdsl_element_t _gdsl_bstree_get_content | ( | const _gdsl_bstree_t | T | ) |
Get the root content of a low-level binary search tree.
T | The low-level binary search tree to use. |
bool _gdsl_bstree_is_root | ( | const _gdsl_bstree_t | T | ) |
Check if a low-level binary search tree is a root.
T | The low-level binary search tree to check. |
_gdsl_bstree_t _gdsl_bstree_get_parent | ( | const _gdsl_bstree_t | T | ) |
Get the parent tree of a low-level binary search tree.
T | The low-level binary search tree to use. |
_gdsl_bstree_t _gdsl_bstree_get_left | ( | const _gdsl_bstree_t | T | ) |
Get the left sub-tree of a low-level binary search tree.
T | The low-level binary search tree to use. |
_gdsl_bstree_t _gdsl_bstree_get_right | ( | const _gdsl_bstree_t | T | ) |
Get the right sub-tree of a low-level binary search tree.
T | The low-level binary search tree to use. |
ulong _gdsl_bstree_get_size | ( | const _gdsl_bstree_t | T | ) |
Get the size of a low-level binary search tree.
T | The low-level binary search tree to compute the size from. |
ulong _gdsl_bstree_get_height | ( | const _gdsl_bstree_t | T | ) |
Get the height of a low-level binary search tree.
Compute the height of the low-level binary search tree T (noted h(T)).
T | The low-level binary search tree to compute the height from. |
_gdsl_bstree_t _gdsl_bstree_insert | ( | _gdsl_bstree_t * | T, |
const gdsl_compare_func_t | COMP_F, | ||
const gdsl_element_t | VALUE, | ||
int * | RESULT | ||
) |
Insert an element into a low-level binary search tree if it's not found or return it.
Search for the first element E equal to VALUE into the low-level binary search tree T, by using COMP_F function to find it. If an element E equal to VALUE is found, then it's returned. If no element equal to VALUE is found, then E is inserted and its root returned.
T | The reference of the low-level binary search tree to use. |
COMP_F | The comparison function to use to compare T's elements with VALUE to find E. |
VALUE | The value used to search for the element E. |
RESULT | The address where the result code will be stored. |
gdsl_element_t _gdsl_bstree_remove | ( | _gdsl_bstree_t * | T, |
const gdsl_compare_func_t | COMP_F, | ||
const gdsl_element_t | VALUE | ||
) |
Remove an element from a low-level binary search tree.
Remove from the low-level binary search tree T the first founded element E equal to VALUE, by using COMP_F function to compare T's elements. If E is found, it is removed from T.
T | The reference of the low-level binary search tree to modify. |
COMP_F | The comparison function to use to compare T's elements with VALUE to find the element e to remove. |
VALUE | The value that must be used by COMP_F to find the element e to remove. |
_gdsl_bstree_t _gdsl_bstree_search | ( | const _gdsl_bstree_t | T, |
const gdsl_compare_func_t | COMP_F, | ||
const gdsl_element_t | VALUE | ||
) |
Search for a particular element into a low-level binary search tree.
Search the first element E equal to VALUE in the low-level binary search tree T, by using COMP_F function to find it.
T | The low-level binary search tree to use. |
COMP_F | The comparison function to use to compare T's elements with VALUE to find the element E. |
VALUE | The value that must be used by COMP_F to find the element E. |
_gdsl_bstree_t _gdsl_bstree_search_next | ( | const _gdsl_bstree_t | T, |
const gdsl_compare_func_t | COMP_F, | ||
const gdsl_element_t | VALUE | ||
) |
Search for the next element of a particular element into a low-level binary search tree, according to the binary search tree order.
Search for an element E in the low-level binary search tree T, by using COMP_F function to find the first element E equal to VALUE.
T | The low-level binary search tree to use. |
COMP_F | The comparison function to use to compare T's elements with VALUE to find the element E. |
VALUE | The value that must be used by COMP_F to find the element E. |
_gdsl_bstree_t _gdsl_bstree_map_prefix | ( | const _gdsl_bstree_t | T, |
const _gdsl_bstree_map_func_t | MAP_F, | ||
void * | USER_DATA | ||
) |
Parse a low-level binary search tree in prefixed order.
Parse all nodes of the low-level binary search tree T in prefixed order. The MAP_F function is called on each node with the USER_DATA argument. If MAP_F returns GDSL_MAP_STOP, then _gdsl_bstree_map_prefix() stops and returns its last examinated node.
T | The low-level binary search tree to map. |
MAP_F | The map function. |
USER_DATA | User's datas passed to MAP_F. |
_gdsl_bstree_t _gdsl_bstree_map_infix | ( | const _gdsl_bstree_t | T, |
const _gdsl_bstree_map_func_t | MAP_F, | ||
void * | USER_DATA | ||
) |
Parse a low-level binary search tree in infixed order.
Parse all nodes of the low-level binary search tree T in infixed order. The MAP_F function is called on each node with the USER_DATA argument. If MAP_F returns GDSL_MAP_STOP, then _gdsl_bstree_map_infix() stops and returns its last examinated node.
T | The low-level binary search tree to map. |
MAP_F | The map function. |
USER_DATA | User's datas passed to MAP_F. |
_gdsl_bstree_t _gdsl_bstree_map_postfix | ( | const _gdsl_bstree_t | T, |
const _gdsl_bstree_map_func_t | MAP_F, | ||
void * | USER_DATA | ||
) |
Parse a low-level binary search tree in postfixed order.
Parse all nodes of the low-level binary search tree T in postfixed order. The MAP_F function is called on each node with the USER_DATA argument. If MAP_F returns GDSL_MAP_STOP, then _gdsl_bstree_map_postfix() stops and returns its last examinated node.
T | The low-level binary search tree to map. |
MAP_F | The map function. |
USER_DATA | User's datas passed to MAP_F. |
void _gdsl_bstree_write | ( | const _gdsl_bstree_t | T, |
const _gdsl_bstree_write_func_t | WRITE_F, | ||
FILE * | OUTPUT_FILE, | ||
void * | USER_DATA | ||
) |
Write the content of all nodes of a low-level binary search tree to a file.
Write the nodes contents of the low-level binary search tree T to OUTPUT_FILE, using WRITE_F function. Additionnal USER_DATA argument could be passed to WRITE_F.
T | The low-level binary search tree to write. |
WRITE_F | The write function. |
OUTPUT_FILE | The file where to write T's nodes. |
USER_DATA | User's datas passed to WRITE_F. |
void _gdsl_bstree_write_xml | ( | const _gdsl_bstree_t | T, |
const _gdsl_bstree_write_func_t | WRITE_F, | ||
FILE * | OUTPUT_FILE, | ||
void * | USER_DATA | ||
) |
Write the content of a low-level binary search tree to a file into XML.
Write the nodes contents of the low-level binary search tree T to OUTPUT_FILE, into XML language. If WRITE_F != NULL, then use WRITE_F function to write T's nodes contents to OUTPUT_FILE. Additionnal USER_DATA argument could be passed to WRITE_F.
T | The low-level binary search tree to write. |
WRITE_F | The write function. |
OUTPUT_FILE | The file where to write T's nodes. |
USER_DATA | User's datas passed to WRITE_F. |
void _gdsl_bstree_dump | ( | const _gdsl_bstree_t | T, |
const _gdsl_bstree_write_func_t | WRITE_F, | ||
FILE * | OUTPUT_FILE, | ||
void * | USER_DATA | ||
) |
Dump the internal structure of a low-level binary search tree to a file.
Dump the structure of the low-level binary search tree T to OUTPUT_FILE. If WRITE_F != NULL, then use WRITE_F function to write T's nodes content to OUTPUT_FILE. Additionnal USER_DATA argument could be passed to WRITE_F.
T | The low-level binary search tree to dump. |
WRITE_F | The write function. |
OUTPUT_FILE | The file where to write T's nodes. |
USER_DATA | User's datas passed to WRITE_F. |