cucon/hset.h: General-Purpose Hash Set
[Associative Containers (trees, maps, sets)]

Data Structures

struct  cucon_hset

Functions

void cucon_hset_init (cucon_hset_t set, cu_clop(eq, cu_bool_t, void const *, void const *), cu_clop(hash, cu_hash_t, void const *))
cucon_hset_t cucon_hset_new (cu_clop(eq, cu_bool_t, void const *, void const *), cu_clop(hash, cu_hash_t, void const *))
size_t cucon_hset_card (cucon_hset_t set)
cu_bool_t cucon_hset_is_empty (cucon_hset_t set)
cu_bool_t cucon_hset_contains (cucon_hset_t set, void const *key)
cu_bool_t cucon_hset_insert (cucon_hset_t set, void const *key)
cu_bool_t cucon_hset_erase (cucon_hset_t set, void const *key)
cu_bool_t cucon_hset_isocap_erase (cucon_hset_t set, void const *key)
void cucon_hset_set_capacity (cucon_hset_t set, int cap)
cu_bool_t cucon_hset_conj (cucon_hset_t set, cu_clop(f, cu_bool_t, void const *))
cu_bool_t cucon_hset_eq (cucon_hset_t S0, cucon_hset_t S1)
cu_bool_t cucon_hset_sub (cucon_hset_t S0, cucon_hset_t S1)
cu_bool_t cucon_hset_subeq (cucon_hset_t hs0, cucon_hset_t hs1)

Detailed Description

This defines sets of pointers with client-supplied equality and hash functions. This is a light wrapper around cucon/hmap.h for the case where slots are empty.

See also:
cucon/hmap.h: General-Purpose Hash Map
cucon/pset.h: Poiter-Keyed Sets

Function Documentation

size_t cucon_hset_card ( cucon_hset_t  set  ) 

The cardinality of set.

cu_bool_t cucon_hset_contains ( cucon_hset_t  set,
void const *  key 
)

True iff key is in set.

cu_bool_t cucon_hset_eq ( cucon_hset_t  S0,
cucon_hset_t  S1 
)

Determines S0 = S1 provided they have compatible callbacks.

cu_bool_t cucon_hset_erase ( cucon_hset_t  set,
void const *  key 
)

If an key equal to key is in set, erase it and return true, else return false.

void cucon_hset_init ( cucon_hset_t  set,
cu_clop(eq, cu_bool_t, void const *, void const *)  ,
cu_clop(hash, cu_hash_t, void const *)   
)

Constructs a hash set with equality predicate eq and hash function hash.

cu_bool_t cucon_hset_insert ( cucon_hset_t  set,
void const *  key 
)

If key is not in set, inserts it and returns true. Otherwise, returns false.

cu_bool_t cucon_hset_is_empty ( cucon_hset_t  set  ) 

True iff set is empty.

cu_bool_t cucon_hset_isocap_erase ( cucon_hset_t  set,
void const *  key 
)

Same as cucon_hset_erase, but keep the capacity. This can be used in conjunction with cucon_hset_set_capacity as an optimisation.

cucon_hset_t cucon_hset_new ( cu_clop(eq, cu_bool_t, void const *, void const *)  ,
cu_clop(hash, cu_hash_t, void const *)   
)

Returns a hash set with equality predicate eq and hash function hash.

void cucon_hset_set_capacity ( cucon_hset_t  set,
int  cap 
)

Set the capacity of set to cap, which must be a power of 2. This can be used either as a preparation for subsequent insertions or as a final step after a series of calls to cucon_hset_isocap_erase. It is merely an optimisation to avoid unnecessary intermediate adjustments of the capacity when the final cardinality is known.

cu_bool_t cucon_hset_sub ( cucon_hset_t  S0,
cucon_hset_t  S1 
)

Determines S0S1 provided they have compatible callbacks.

cu_bool_t cucon_hset_subeq ( cucon_hset_t  hs0,
cucon_hset_t  hs1 
)

Determines S0S1 provided they have compatible callbacks.

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