cucon/rbset.h: Sets, Red-Black Tree Implementation
[Associative Containers (trees, maps, sets)]

Data Structures

struct  cucon_rbset

Functions

void cucon_rbset_init (cucon_rbset_t rbset, cu_clop(cmp, int, void *, void *))
cucon_rbset_t cucon_rbset_new (cu_clop(cmp, int, void *, void *))
cu_bool_t cucon_rbset_is_empty (cucon_rbset_t set)
void cucon_rbset_init_str_cmp (cucon_rbset_t rbset)
cucon_rbset_t cucon_rbset_new_str_cmp (void)
cu_bool_t cucon_rbset_insert (cucon_rbset_t rbset, void *key)
cu_bool_t cucon_rbset_erase (cucon_rbset_t rbset, void *key)
void * cucon_rbset_find (cucon_rbset_t rbset, void *key)
void cucon_rbset_nearest (cucon_rbset_t set, void *key, cu_ptr_ptr_t below_out, cu_ptr_ptr_t equal_out, cu_ptr_ptr_t above_out)
void cucon_rbset_iter (cucon_rbset_t set, cu_clop(cb, void, void *))
void cucon_rbset_rev_iter (cucon_rbset_t set, cu_clop(cb, void, void *))
cu_bool_t cucon_rbset_conj (cucon_rbset_t set, cu_clop(cb, cu_bool_t, void *key))
cu_bool_t cucon_rbset_rev_conj (cucon_rbset_t set, cu_clop(cb, cu_bool_t, void *))

Detailed Description

See also:
cucon/rbmap.h: Maps, Red-Black Tree Implementation
cucon/hset.h: General-Purpose Hash Set
cucon/pset.h: Poiter-Keyed Sets

Function Documentation

cu_bool_t cucon_rbset_conj ( cucon_rbset_t  set,
cu_clop(cb, cu_bool_t, void *key)   
)

Applies cb to each element of set in order, exiting with false as soon as cb returns false, otherwise returns true.

cu_bool_t cucon_rbset_erase ( cucon_rbset_t  rbset,
void *  key 
)

If key is in rbset, erase it and return true, else return false.

void* cucon_rbset_find ( cucon_rbset_t  rbset,
void *  key 
)

Return stored element of rbset equal to key if found, else NULL.

void cucon_rbset_init ( cucon_rbset_t  rbset,
cu_clop(cmp, int, void *, void *)   
)

Construct rbset as an empty set where cmp defines a total order over elements in the usual style of strcmp. That is, cmp shall return negative for ‘<’, zero for ‘=’, and positive for ‘>’.

void cucon_rbset_init_str_cmp ( cucon_rbset_t  rbset  ) 

Construct rbset as an empty set of strings, using cu_str_cmp.

cu_bool_t cucon_rbset_insert ( cucon_rbset_t  rbset,
void *  key 
)

If key is not in rbset, insert it and return true, else return false.

cu_bool_t cucon_rbset_is_empty ( cucon_rbset_t  set  ) 

True iff set is empty.

void cucon_rbset_iter ( cucon_rbset_t  set,
cu_clop(cb, void, void *)   
)

Applies cb to each element of set in order.

void cucon_rbset_nearest ( cucon_rbset_t  set,
void *  key,
cu_ptr_ptr_t  below_out,
cu_ptr_ptr_t  equal_out,
cu_ptr_ptr_t  above_out 
)

Return the elements of set below, equal, and above key in *below_out, *equal_out, and *above_out, respectively. NULL is returned where no applicable node exists if set.

cucon_rbset_t cucon_rbset_new ( cu_clop(cmp, int, void *, void *)   ) 

Return an empty set where elements are compared according to cmp.

See also:
cucon_rbset_init for details on cmp.
cucon_rbset_t cucon_rbset_new_str_cmp ( void   ) 

Return an empty set of string, using cu_str_cmp.

cu_bool_t cucon_rbset_rev_conj ( cucon_rbset_t  set,
cu_clop(cb, cu_bool_t, void *)   
)

Applies cb to each element of set in reverse order, exiting immediately with false if cb returns false, otherwise returns true.

void cucon_rbset_rev_iter ( cucon_rbset_t  set,
cu_clop(cb, void, void *)   
)

Applies cb to each element of set in reverse order.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.