40 typedef psplaynode* PSplaynode;
47 #define PSPLAYNODE_INITIALIZER {NULL, NULL} 73 typedef const void* (*psplay_key_fn)(
const PSplaynode node);
82 typedef psplay* PSplay;
87 PSplaynode* found_parent;
105 return self->elem_cnt;
171 psplay_insert (PSplay
self, PSplaynode node,
int splayfactor);
183 psplay_find (PSplay
self,
const void* key,
int splayfactor);
228 enum psplay_order_enum
277 psplay_dump (PSplay
self, FILE* dest);
PSplaynode psplay_remove(PSplay self, PSplaynode node)
Remove a node from a splay tree.
Type and handle for a psplay root structure This structure shall be treated opaque, its only defined in the header to allow one to integrate it directly instead referencing it.
PSplaynode psplay_remove_key(PSplay self, void *key)
Remove a node by key from a splay tree.
psplay_delete_fn(* psplay_action_fn)(PSplaynode node, const enum psplay_order_enum which, int level, void *data)
Traverse a splay tree Traversing a tree calls a user supplied action three times An 'action' must not...
Type and handle for a psplay tree node This node have to be placed inside users data.
PSplaynode psplay_find(PSplay self, const void *key, int splayfactor)
Find a element in a splay tree.
PSplay psplay_init(PSplay self, psplay_cmp_fn cmp, psplay_key_fn key, psplay_delete_fn del)
Initialize a splay tree.
const void *(* psplay_key_fn)(const PSplaynode node)
Retrieve the key from a user datastructure.
PSplaynode psplaynode_init(PSplaynode self)
Initialise a splay tree node The user has to place this nodes within his datastructure and must Initi...
PSplay psplay_new(psplay_cmp_fn cmp, psplay_key_fn key, psplay_delete_fn del)
Allocate a splay tree.
int psplay_walk(PSplay self, PSplaynode node, psplay_action_fn action, int level, void *data)
Start a tree traversal.
void psplay_delete(PSplay self)
Delete a splay tree Frees all elements and associated resources of a splay tree and then itseld...
PSplay psplay_destroy(PSplay self)
Destroy a splay tree Frees all elements and associated resources of a splay tree. ...
static size_t psplay_nelements(PSplay self)
Number of elements in tree.
int(* psplay_cmp_fn)(const void *a, const void *b)
Function use to compare keys.
PSplaynode psplay_insert(PSplay self, PSplaynode node, int splayfactor)
Insert a element into a splay tree.
void psplay_delete_node(PSplay self, PSplaynode node)
Delete a node from a splay tree.
void psplay_delete_key(PSplay self, void *key)
Delete a node by key from a splay tree.
void(* psplay_delete_fn)(PSplaynode node)
Destructor for user defined data Called when an element got removed from a splay tree.