61#if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION)
62# error "Header files shouldn't be included directly, consider using <plibsys.h> instead."
65#ifndef PLIBSYS_HEADER_PTREE_H
66#define PLIBSYS_HEADER_PTREE_H
#define P_BEGIN_DECLS
Starts .h file declarations to be exported as C functions.
#define P_END_DECLS
Closes .h file declarations to be exported as C functions, should be always used after P_BEGIN_DECLS.
#define P_LIB_API
Exports a symbol from a shared library.
P_LIB_API PTreeType p_tree_get_type(const PTree *tree)
Gets a tree algorithm type.
P_LIB_API void p_tree_clear(PTree *tree)
Clears a tree.
PTreeType_
Internal data organization algorithm for PTree.
@ P_TREE_TYPE_RB
Red-black self-balancing tree.
@ P_TREE_TYPE_BINARY
Unbalanced binary tree.
@ P_TREE_TYPE_AVL
AVL self-balancing tree.
P_LIB_API void p_tree_foreach(PTree *tree, PTraverseFunc traverse_func, ppointer user_data)
Iterates in-order through the tree nodes.
enum PTreeType_ PTreeType
Internal data organization algorithm for PTree.
struct PTree_ PTree
Tree opaque data structure.
P_LIB_API PTree * p_tree_new_with_data(PTreeType type, PCompareDataFunc func, ppointer data)
Initializes new PTree with additional data.
P_LIB_API PTree * p_tree_new_full(PTreeType type, PCompareDataFunc func, ppointer data, PDestroyFunc key_destroy, PDestroyFunc value_destroy)
Initializes new PTree with additional data and memory management.
P_LIB_API ppointer p_tree_lookup(PTree *tree, pconstpointer key)
Lookups a value by a given key.
P_LIB_API pboolean p_tree_remove(PTree *tree, pconstpointer key)
Removes a key from a tree.
P_LIB_API pint p_tree_get_nnodes(const PTree *tree)
Gets node count.
P_LIB_API PTree * p_tree_new(PTreeType type, PCompareFunc func)
Initializes new PTree.
P_LIB_API void p_tree_free(PTree *tree)
Frees a previously initialized tree object.
P_LIB_API void p_tree_insert(PTree *tree, ppointer key, ppointer value)
Inserts a new key-value pair into a tree.
void(* PDestroyFunc)(ppointer data)
Object destroy notification function.
pint(* PCompareDataFunc)(pconstpointer a, pconstpointer b, ppointer data)
Compares two values with additional data.
const void * pconstpointer
Type for a const pointer.
void * ppointer
Type for a pointer.
pint(* PCompareFunc)(pconstpointer a, pconstpointer b)
Compares two values.
pboolean(* PTraverseFunc)(ppointer key, ppointer value, ppointer user_data)
Function to traverse through a key-value container.
signed int pboolean
Type for a bool.