cucon/hzset.h: Hash Set of Flat Fixed-Sized Keys
[Associative Containers (trees, maps, sets)]

Data Structures

struct  cucon_hzset_node
struct  cucon_hzset
struct  cucon_hzset_itr

Functions

size_t cucon_hzset_size (cucon_hzset_t set)
size_t cucon_hzset_capacity (cucon_hzset_t set)
void cucon_hzset_init (cucon_hzset_t set, cu_shortsize_t key_size_w)
cucon_hzset_t cucon_hzset_new (cu_shortsize_t key_size_w)
cu_bool_t cucon_hzset_insert_node (cucon_hzset_t set, cucon_hzset_node_t node)
cu_bool_t cucon_hzset_insert (cucon_hzset_t set, void const *key)
cu_bool_t cucon_hzset_erase (cucon_hzset_t set, void const *key)
cu_bool_t cucon_hzset_step_erase (cucon_hzset_t set, void const *key)
void cucon_hzset_finish_erase (cucon_hzset_t set)
cu_bool_t cucon_hzset_contains (cucon_hzset_t set, void const *key)
cu_bool_t cucon_hzset_1w_contains (cucon_hzset_t set, void const *key)
cu_bool_t cucon_hzset_2w_contains (cucon_hzset_t set, void const *key)
cu_bool_t cucon_hzset_forall (cu_clop(f, cu_bool_t, void const *key), cucon_hzset_t set)
void cucon_hzset_filter (cu_clop(f, cu_bool_t, void const *key), cucon_hzset_t set)
void cucon_hzset_itr_init (cucon_hzset_itr_t itr, cucon_hzset_t set)
void const * cucon_hzset_itr_get (cucon_hzset_itr_t itr)

Detailed Description

This is a thin layer over cucon/hzmap.h specialised for the case when there is no value associated with the keys.


Function Documentation

cu_bool_t cucon_hzset_1w_contains ( cucon_hzset_t  set,
void const *  key 
)

A variant of cucon_hzset_contains which is specialised for the case when the keys size is known to be 1 word.

cu_bool_t cucon_hzset_2w_contains ( cucon_hzset_t  set,
void const *  key 
)

A variant of cucon_hzset_contains which is specialised for the case when the keys size is known to be 2 words.

size_t cucon_hzset_capacity ( cucon_hzset_t  set  ) 

The size of the underlying array of set.

cu_bool_t cucon_hzset_contains ( cucon_hzset_t  set,
void const *  key 
)

True iff set contains key.

cu_bool_t cucon_hzset_erase ( cucon_hzset_t  set,
void const *  key 
)

If set contains key, inserts it and returns true, else returns false.

void cucon_hzset_filter ( cu_clop(f, cu_bool_t, void const *key)  ,
cucon_hzset_t  set 
)

Filter out all elements of set which f maps to false.

void cucon_hzset_finish_erase ( cucon_hzset_t  set  ) 

Adjust the capacity after a series of cucon_hzset_step_erase.

cu_bool_t cucon_hzset_forall ( cu_clop(f, cu_bool_t, void const *key)  ,
cucon_hzset_t  set 
)

True iff f maps all elements of set to true, otherwise returns immediately on the first element which f maps to false.

void cucon_hzset_init ( cucon_hzset_t  set,
cu_shortsize_t  key_size_w 
)

Initialise set an an empty hash set of keys of key_size_w words.

cu_bool_t cucon_hzset_insert ( cucon_hzset_t  set,
void const *  key 
)

If set does not contain key, inserts it and returns true, else returns false.

cu_bool_t cucon_hzset_insert_node ( cucon_hzset_t  set,
cucon_hzset_node_t  node 
)

Given that node is initialised with a key of suitable size for set, if the key exists in set, returns false, else inserts node into set and returns true. The cucon_hzset_node base struct of node is initialised by this call if the insert takes place.

void const* cucon_hzset_itr_get ( cucon_hzset_itr_t  itr  ) 

Returns the next element of the sequence initialised by cucon_hzset_itr_init, or NULL if there are no more elements.

void cucon_hzset_itr_init ( cucon_hzset_itr_t  itr,
cucon_hzset_t  set 
)

Initialise itr for iterating over all elements of set.

cucon_hzset_t cucon_hzset_new ( cu_shortsize_t  key_size_w  ) 

Returns an empty hash set of keys of key_size_w words.

size_t cucon_hzset_size ( cucon_hzset_t  set  ) 

The number of elements in set.

cu_bool_t cucon_hzset_step_erase ( cucon_hzset_t  set,
void const *  key 
)

As cucon_hzset_erase, but don't change the capacity of the undelying array. Use this to accelerate a series of deletions, and call cucon_hzset_finish_erase at the end.

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