gdsl
1.7
|
Typedefs | |
typedef struct _gdsl_bintree * | _gdsl_bintree_t |
GDSL low-level binary tree type. | |
typedef int(* | _gdsl_bintree_map_func_t )(const _gdsl_bintree_t TREE, void *USER_DATA) |
GDSL low-level binary tree map function type. | |
typedef void(* | _gdsl_bintree_write_func_t )(const _gdsl_bintree_t TREE, FILE *OUTPUT_FILE, void *USER_DATA) |
GDSL low-level binary tree write function type. | |
Functions | |
_gdsl_bintree_t | _gdsl_bintree_alloc (const gdsl_element_t E, const _gdsl_bintree_t LEFT, const _gdsl_bintree_t RIGHT) |
Create a new low-level binary tree. | |
void | _gdsl_bintree_free (_gdsl_bintree_t T, const gdsl_free_func_t FREE_F) |
Destroy a low-level binary tree. | |
_gdsl_bintree_t | _gdsl_bintree_copy (const _gdsl_bintree_t T, const gdsl_copy_func_t COPY_F) |
Copy a low-level binary tree. | |
bool | _gdsl_bintree_is_empty (const _gdsl_bintree_t T) |
Check if a low-level binary tree is empty. | |
bool | _gdsl_bintree_is_leaf (const _gdsl_bintree_t T) |
Check if a low-level binary tree is reduced to a leaf. | |
bool | _gdsl_bintree_is_root (const _gdsl_bintree_t T) |
Check if a low-level binary tree is a root. | |
gdsl_element_t | _gdsl_bintree_get_content (const _gdsl_bintree_t T) |
Get the root content of a low-level binary tree. | |
_gdsl_bintree_t | _gdsl_bintree_get_parent (const _gdsl_bintree_t T) |
Get the parent tree of a low-level binary tree. | |
_gdsl_bintree_t | _gdsl_bintree_get_left (const _gdsl_bintree_t T) |
Get the left sub-tree of a low-level binary tree. | |
_gdsl_bintree_t | _gdsl_bintree_get_right (const _gdsl_bintree_t T) |
Get the right sub-tree of a low-level binary tree. | |
_gdsl_bintree_t * | _gdsl_bintree_get_left_ref (const _gdsl_bintree_t T) |
Get the left sub-tree reference of a low-level binary tree. | |
_gdsl_bintree_t * | _gdsl_bintree_get_right_ref (const _gdsl_bintree_t T) |
Get the right sub-tree reference of a low-level binary tree. | |
ulong | _gdsl_bintree_get_height (const _gdsl_bintree_t T) |
Get the height of a low-level binary tree. | |
ulong | _gdsl_bintree_get_size (const _gdsl_bintree_t T) |
Get the size of a low-level binary tree. | |
void | _gdsl_bintree_set_content (_gdsl_bintree_t T, const gdsl_element_t E) |
Set the root element of a low-level binary tree. | |
void | _gdsl_bintree_set_parent (_gdsl_bintree_t T, const _gdsl_bintree_t P) |
Set the parent tree of a low-level binary tree. | |
void | _gdsl_bintree_set_left (_gdsl_bintree_t T, const _gdsl_bintree_t L) |
Set left sub-tree of a low-level binary tree. | |
void | _gdsl_bintree_set_right (_gdsl_bintree_t T, const _gdsl_bintree_t R) |
Set right sub-tree of a low-level binary tree. | |
_gdsl_bintree_t | _gdsl_bintree_rotate_left (_gdsl_bintree_t *T) |
Left rotate a low-level binary tree. | |
_gdsl_bintree_t | _gdsl_bintree_rotate_right (_gdsl_bintree_t *T) |
Right rotate a low-level binary tree. | |
_gdsl_bintree_t | _gdsl_bintree_rotate_left_right (_gdsl_bintree_t *T) |
Left-right rotate a low-level binary tree. | |
_gdsl_bintree_t | _gdsl_bintree_rotate_right_left (_gdsl_bintree_t *T) |
Right-left rotate a low-level binary tree. | |
_gdsl_bintree_t | _gdsl_bintree_map_prefix (const _gdsl_bintree_t T, const _gdsl_bintree_map_func_t MAP_F, void *USER_DATA) |
Parse a low-level binary tree in prefixed order. | |
_gdsl_bintree_t | _gdsl_bintree_map_infix (const _gdsl_bintree_t T, const _gdsl_bintree_map_func_t MAP_F, void *USER_DATA) |
Parse a low-level binary tree in infixed order. | |
_gdsl_bintree_t | _gdsl_bintree_map_postfix (const _gdsl_bintree_t T, const _gdsl_bintree_map_func_t MAP_F, void *USER_DATA) |
Parse a low-level binary tree in postfixed order. | |
void | _gdsl_bintree_write (const _gdsl_bintree_t T, const _gdsl_bintree_write_func_t WRITE_F, FILE *OUTPUT_FILE, void *USER_DATA) |
Write the content of all nodes of a low-level binary tree to a file. | |
void | _gdsl_bintree_write_xml (const _gdsl_bintree_t T, const _gdsl_bintree_write_func_t WRITE_F, FILE *OUTPUT_FILE, void *USER_DATA) |
Write the content of a low-level binary tree to a file into XML. | |
void | _gdsl_bintree_dump (const _gdsl_bintree_t T, const _gdsl_bintree_write_func_t WRITE_F, FILE *OUTPUT_FILE, void *USER_DATA) |
Dump the internal structure of a low-level binary tree to a file. |
typedef struct _gdsl_bintree* _gdsl_bintree_t |
GDSL low-level binary 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 54 of file _gdsl_bintree.h.
typedef int(* _gdsl_bintree_map_func_t)(const _gdsl_bintree_t TREE, void *USER_DATA) |
GDSL low-level binary tree map function type.
TREE | The low-level binary tree to map. |
USER_DATA | The user datas to pass to this function. |
Definition at line 63 of file _gdsl_bintree.h.
typedef void(* _gdsl_bintree_write_func_t)(const _gdsl_bintree_t TREE, FILE *OUTPUT_FILE, void *USER_DATA) |
GDSL low-level binary tree write function type.
TREE | The low-level binary tree to write. |
OUTPUT_FILE | The file where to write TREE. |
USER_DATA | The user datas to pass to this function. |
Definition at line 73 of file _gdsl_bintree.h.
_gdsl_bintree_t _gdsl_bintree_alloc | ( | const gdsl_element_t | E, |
const _gdsl_bintree_t | LEFT, | ||
const _gdsl_bintree_t | RIGHT | ||
) |
Create a new low-level binary tree.
Allocate a new low-level binary tree data structure. Its root content is set to E and its left son (resp. right) is set to LEFT (resp. RIGHT).
E | The root content of the new low-level binary tree to create. |
LEFT | The left sub-tree of the new low-level binary tree to create. |
RIGHT | The right sub-tree of the new low-level binary tree to create. |
void _gdsl_bintree_free | ( | _gdsl_bintree_t | T, |
const gdsl_free_func_t | FREE_F | ||
) |
Destroy a low-level binary tree.
Flush and destroy the low-level binary 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 tree to destroy. |
FREE_F | The function used to deallocate T's nodes contents. |
_gdsl_bintree_t _gdsl_bintree_copy | ( | const _gdsl_bintree_t | T, |
const gdsl_copy_func_t | COPY_F | ||
) |
Copy a low-level binary tree.
Create and return a copy of the low-level binary tree T using COPY_F on each T's element to copy them.
T | The low-level binary tree to copy. |
COPY_F | The function used to copy T's nodes contents. |
bool _gdsl_bintree_is_empty | ( | const _gdsl_bintree_t | T | ) |
Check if a low-level binary tree is empty.
T | The low-level binary tree to check. |
bool _gdsl_bintree_is_leaf | ( | const _gdsl_bintree_t | T | ) |
Check if a low-level binary tree is reduced to a leaf.
T | The low-level binary tree to check. |
bool _gdsl_bintree_is_root | ( | const _gdsl_bintree_t | T | ) |
Check if a low-level binary tree is a root.
T | The low-level binary tree to check. |
Get the root content of a low-level binary tree.
T | The low-level binary tree to use. |
Get the parent tree of a low-level binary tree.
T | The low-level binary tree to use. |
_gdsl_bintree_t _gdsl_bintree_get_left | ( | const _gdsl_bintree_t | T | ) |
Get the left sub-tree of a low-level binary tree.
Return the left subtree of the low-level binary tree T (noted l(T)).
T | The low-level binary tree to use. |
Get the right sub-tree of a low-level binary tree.
Return the right subtree of the low-level binary tree T (noted r(T)).
T | The low-level binary tree to use. |
_gdsl_bintree_t* _gdsl_bintree_get_left_ref | ( | const _gdsl_bintree_t | T | ) |
Get the left sub-tree reference of a low-level binary tree.
T | The low-level binary tree to use. |
Get the right sub-tree reference of a low-level binary tree.
T | The low-level binary tree to use. |
ulong _gdsl_bintree_get_height | ( | const _gdsl_bintree_t | T | ) |
Get the height of a low-level binary tree.
Compute the height of the low-level binary tree T (noted h(T)).
T | The low-level binary tree to use. |
ulong _gdsl_bintree_get_size | ( | const _gdsl_bintree_t | T | ) |
Get the size of a low-level binary tree.
T | The low-level binary tree to use. |
void _gdsl_bintree_set_content | ( | _gdsl_bintree_t | T, |
const gdsl_element_t | E | ||
) |
Set the root element of a low-level binary tree.
Modify the root element of the low-level binary tree T to E.
T | The low-level binary tree to modify. |
E | The new T's root content. |
void _gdsl_bintree_set_parent | ( | _gdsl_bintree_t | T, |
const _gdsl_bintree_t | P | ||
) |
Set the parent tree of a low-level binary tree.
Modify the parent of the low-level binary tree T to P.
T | The low-level binary tree to modify. |
P | The new T's parent. |
void _gdsl_bintree_set_left | ( | _gdsl_bintree_t | T, |
const _gdsl_bintree_t | L | ||
) |
Set left sub-tree of a low-level binary tree.
Modify the left sub-tree of the low-level binary tree T to L.
T | The low-level binary tree to modify. |
L | The new T's left sub-tree. |
void _gdsl_bintree_set_right | ( | _gdsl_bintree_t | T, |
const _gdsl_bintree_t | R | ||
) |
Set right sub-tree of a low-level binary tree.
Modify the right sub-tree of the low-level binary tree T to R.
T | The low-level binary tree to modify. |
R | The new T's right sub-tree. |
Left rotate a low-level binary tree.
Do a left rotation of the low-level binary tree T.
T | The low-level binary tree to rotate. |
Right rotate a low-level binary tree.
Do a right rotation of the low-level binary tree T.
T | The low-level binary tree to rotate. |
Left-right rotate a low-level binary tree.
Do a double left-right rotation of the low-level binary tree T.
T | The low-level binary tree to rotate. |
Right-left rotate a low-level binary tree.
Do a double right-left rotation of the low-level binary tree T.
T | The low-level binary tree to rotate. |
_gdsl_bintree_t _gdsl_bintree_map_prefix | ( | const _gdsl_bintree_t | T, |
const _gdsl_bintree_map_func_t | MAP_F, | ||
void * | USER_DATA | ||
) |
Parse a low-level binary tree in prefixed order.
Parse all nodes of the low-level binary 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_bintree_map_prefix() stops and returns its last examinated node.
T | The low-level binary tree to map. |
MAP_F | The map function. |
USER_DATA | User's datas. |
_gdsl_bintree_t _gdsl_bintree_map_infix | ( | const _gdsl_bintree_t | T, |
const _gdsl_bintree_map_func_t | MAP_F, | ||
void * | USER_DATA | ||
) |
Parse a low-level binary tree in infixed order.
Parse all nodes of the low-level binary 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_bintree_map_infix() stops and returns its last examinated node.
T | The low-level binary tree to map. |
MAP_F | The map function. |
USER_DATA | User's datas. |
_gdsl_bintree_t _gdsl_bintree_map_postfix | ( | const _gdsl_bintree_t | T, |
const _gdsl_bintree_map_func_t | MAP_F, | ||
void * | USER_DATA | ||
) |
Parse a low-level binary tree in postfixed order.
Parse all nodes of the low-level binary 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_bintree_map_postfix() stops and returns its last examinated node.
T | The low-level binary tree to map. |
MAP_F | The map function. |
USER_DATA | User's datas. |
void _gdsl_bintree_write | ( | const _gdsl_bintree_t | T, |
const _gdsl_bintree_write_func_t | WRITE_F, | ||
FILE * | OUTPUT_FILE, | ||
void * | USER_DATA | ||
) |
Write the content of all nodes of a low-level binary tree to a file.
Write the nodes contents of the low-level binary tree T to OUTPUT_FILE, using WRITE_F function. Additionnal USER_DATA argument could be passed to WRITE_F.
T | The low-level binary 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_bintree_write_xml | ( | const _gdsl_bintree_t | T, |
const _gdsl_bintree_write_func_t | WRITE_F, | ||
FILE * | OUTPUT_FILE, | ||
void * | USER_DATA | ||
) |
Write the content of a low-level binary tree to a file into XML.
Write the nodes contents of the low-level binary tree T to OUTPUT_FILE, into XML language. If WRITE_F != NULL, then uses 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 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_bintree_dump | ( | const _gdsl_bintree_t | T, |
const _gdsl_bintree_write_func_t | WRITE_F, | ||
FILE * | OUTPUT_FILE, | ||
void * | USER_DATA | ||
) |
Dump the internal structure of a low-level binary tree to a file.
Dump the structure of the low-level binary tree T to OUTPUT_FILE. 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 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. |