LibCapy - tree

Generic tree class.

Macros:

Iterator for generic tree structure. Declaration macro for an iterator structure named 'name' ## Iterator, associated to a tree named 'name' containing elements of type 'type'

Create an iterator on a generic tree

Input argument(s):

tree: the generic tree on which to iterate
type: the type of iterator

Output and side effect(s):

Return the iterator

Allocate memory and create an iterator on a generic tree

Input argument(s):

tree: the generic tree on which to iterate
type: the type of iterator

Output and side effect(s):

Return the iterator

Free the memory used by an iterator.

Input argument(s):

that: the iterator to free

Free the memory used by a pointer to an iterator and reset '*that' to NULL

Input argument(s):

that: a pointer to the iterator to free

Reset the iterator

Output and side effect(s):

Return the first element of the iteration

Move the iterator to the next element (breadth first)

Output and side effect(s):

Return the next element of the iteration

Move the iterator to the next element (depth first)

Output and side effect(s):

Return the next element of the iteration

Check if the iterator is on a valid element

Output and side effect(s):

Return true if the iterator is on a valid element, else false

Get the current element of the iteration

Output and side effect(s):

Return a pointer to the current element

Set the type of the iterator and reset it

Input argument(s):

type: the new type of the iterator

Definition macro calling all the submacros at once for an iterator on an array structure named 'name', containing elements of type 'type'

Generic tree structure. Declaration macro for a tree structure named 'name', containing data of type 'type'

Generic tree structure. Definition macro and submacros for a tree structure named 'name', containing data of type 'type' Create a tree

Output and side effect(s):

Return a tree containing data of type 'type'

Allocate memory for a new tree and create it

Output and side effect(s):

Return a tree containing data of type 'type'

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a tree.

Input argument(s):

that: the tree to free

Free the memory used by a pointer to a tree and reset '*that' to NULL

Input argument(s):

that: a pointer to the tree to free

Set the data of the tree node

Input argument(s):

val: the value to set

Get the data of the tree node

Output and side effect(s):

Return the data value

Get a pointer to the data of the tree node

Output and side effect(s):

Return the pointer to the data

Get a pointer to the parent of the tree node

Output and side effect(s):

Return the pointer to the parent node

Get a pointer to the first child of the tree node

Output and side effect(s):

Return the pointer to the first child node

Get a pointer to the next brother of the tree node

Output and side effect(s):

Return the pointer to the next brother node

Initialise the iterator of the tree, must be called after the creation of the tree when it is created with Create(), Alloc() automatically initialise the iterator.

Add a child to the tree node. The child is added to the brothers of the current child, or become the cild if there isn't yet. The new child is returned.

Add a brother to the tree node. The brother is added to the end of the list. The new brother is returned.

Definition macro calling all the submacros at once for an array structure named 'name', containing 'size_' elements of type 'type'

Enumerations:

Enumeration for the types of iterator on generic tree

Typedefs:

None.

Functions:

None.

2024-03-20
in LibCapy,
21 views
Copyright 2021-2024 Baillehache Pascal