|
TaPAS
0.2
|
Generic not ordered tree structure. More...
Go to the source code of this file.
Data Structures | |
| struct | ccl_tree_st |
| Structure storing a node of a generic tree. More... | |
Typedefs | |
| typedef struct ccl_tree_st | ccl_tree |
| Structure storing a node of a generic tree. | |
Functions | |
| ccl_tree * | ccl_tree_create (void *obj, ccl_delete_proc *del) |
| Create a leaf node label with the object obj. More... | |
| ccl_tree * | ccl_tree_add_reference (ccl_tree *t) |
| Increments the counter of references to the tree t. More... | |
| void | ccl_tree_del_reference (ccl_tree *t) |
| Suppresses one reference to t. When no more reference exists the node is deleted. More... | |
| int | ccl_tree_get_depth (const ccl_tree *t) |
| Returns the depth of the tree t. More... | |
| int | ccl_tree_is_leaf (const ccl_tree *t) |
| Checks if the node t is a leaf. More... | |
| int | ccl_tree_get_nb_siblings (const ccl_tree *t) |
| Returns the number of siblings of t. More... | |
| int | ccl_tree_get_nb_childs (const ccl_tree *t) |
| Returns the number of childs of t. More... | |
| ccl_tree * | ccl_tree_get_child (ccl_tree *t, int index) |
| Returns the index th child of t. More... | |
| void | ccl_tree_add_child (ccl_tree *t, ccl_tree *child) |
| Add a new child to the tree t The child is added at the end of the liust of sons of t. A new reference is added to child. More... | |
| void | ccl_tree_set_label (ccl_tree *t, void *obj, ccl_delete_proc *del) |
| Changes the label of t with the object obj. More... | |
Generic not ordered tree structure.
This module implements a generic tree whose nodes are labelled with objects pointed by void pointers.
Definition in file ccl-tree.h.
Add a new child to the tree t The child is added at the end of the liust of sons of t. A new reference is added to child.
| t | the tree |
| child | the new child |
Increments the counter of references to the tree t.
| t | the tree |
| ccl_tree* ccl_tree_create | ( | void * | obj, |
| ccl_delete_proc * | del | ||
| ) |
Create a leaf node label with the object obj.
| obj | the object that labels the node |
| del | the deletion procedure applyed to obj when the node is deleted or the label replaced. |
| void ccl_tree_del_reference | ( | ccl_tree * | t | ) |
Suppresses one reference to t. When no more reference exists the node is deleted.
| t | the tree |
Returns the index th child of t.
| t | the tree |
| index | the index of the child |
| int ccl_tree_get_depth | ( | const ccl_tree * | t | ) |
Returns the depth of the tree t.
The depth of t is the number of nodes in the maximal path from the root t to one of its leaves.
| t | the tree |
| int ccl_tree_get_nb_childs | ( | const ccl_tree * | t | ) |
Returns the number of childs of t.
| t | the tree |
| int ccl_tree_get_nb_siblings | ( | const ccl_tree * | t | ) |
Returns the number of siblings of t.
The function counts only siblings accessible from t not those placed before t in the linked list of sons.
| t | the tree |
| int ccl_tree_is_leaf | ( | const ccl_tree * | t | ) |
Checks if the node t is a leaf.
| t | the tree |
| void ccl_tree_set_label | ( | ccl_tree * | t, |
| void * | obj, | ||
| ccl_delete_proc * | del | ||
| ) |
Changes the label of t with the object obj.
| t | the tree |
| obj | the new object |
| del | the deletion procedure applied to obj |
1.8.5