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

Data Structures

struct  cucon_rbmap

Functions

void cucon_rbmap_init (cucon_rbmap_t map, cu_clop(cmp, int, void *, void *))
cucon_rbmap_t cucon_rbmap_new (cu_clop(cmp, int, void *, void *))
size_t cucon_rbmap_size (cucon_rbmap_t map)
void * cucon_rbmap_find_mem (cucon_rbmap_t map, void *key)
void * cucon_rbmap_find_ptr (cucon_rbmap_t map, void *key)
cu_bool_t cucon_rbmap_insert_mem (cucon_rbmap_t map, void *key, size_t slot_size, cu_ptr_ptr_t slot)
cu_bool_t cucon_rbmap_insert_ptr (cucon_rbmap_t map, void *key, void *val)
cu_bool_t cucon_rbmap_erase (cucon_rbmap_t map, void *key)
cu_bool_t cucon_rbmap_conj_mem (cucon_rbmap_t map, cu_clop(cb, cu_bool_t, void *key, void *val))
cu_bool_t cucon_rbmap_conj_ptr (cucon_rbmap_t map, cu_clop(cb, cu_bool_t, void *key, void *val))

Detailed Description

See also:
cucon/rbset.h: Sets, Red-Black Tree Implementation
cucon/pmap.h: Pointer-Keyed Hash Map

Function Documentation

cu_bool_t cucon_rbmap_conj_mem ( cucon_rbmap_t  map,
cu_clop(cb, cu_bool_t, void *key, void *val)   
)

Sequentially conjunct cb over (key, slotptr)-pairs of map in order as given by the ordering operator of map.

cu_bool_t cucon_rbmap_conj_ptr ( cucon_rbmap_t  map,
cu_clop(cb, cu_bool_t, void *key, void *val)   
)

Sequantially conjunct cb over pairs of keys and defererenced pointer slots of map in order as given by the ordering operator of map.

cu_bool_t cucon_rbmap_erase ( cucon_rbmap_t  map,
void *  key 
)

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

void* cucon_rbmap_find_mem ( cucon_rbmap_t  map,
void *  key 
)

Return the slot for key in map, or NULL if not found.

void* cucon_rbmap_find_ptr ( cucon_rbmap_t  map,
void *  key 
)

Return the pointer value of the slot of key in map, or NULL if not found.

void cucon_rbmap_init ( cucon_rbmap_t  map,
cu_clop(cmp, int, void *, void *)   
)

Construct map as an empty map where keps are totally ordered according to cmp, where cmp(x, y) shall return

  • negative to indicate that x precedes y
  • positive to indicate that x succeeds y
  • zero to indicate that x = y.
cu_bool_t cucon_rbmap_insert_mem ( cucon_rbmap_t  map,
void *  key,
size_t  slot_size,
cu_ptr_ptr_t  slot 
)

If key is not in map, then insert it with an associated slot of slot_size bytes. Returns true iff key was inserted. In any case, return the slot in *slot.

cu_bool_t cucon_rbmap_insert_ptr ( cucon_rbmap_t  map,
void *  key,
void *  val 
)

If key is not in map, then insert it with a pointer-valued slot set to val. Returns true iff key was inserted.

cucon_rbmap_t cucon_rbmap_new ( cu_clop(cmp, int, void *, void *)   ) 

Return a map where keys are ordered according to cmp.

See also:
cucon_rbmap_init for the meaning of cmp.
size_t cucon_rbmap_size ( cucon_rbmap_t  map  ) 

The number of elements in map.

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