libFirm
set.h File Reference

hashset: datastructure containing objects accessible by their key More...

#include <stddef.h>
#include "../begin.h"
#include "../end.h"

Go to the source code of this file.

Data Structures

struct  set_entry
 The entry of a set, representing an element in the set and its meta-information. More...

Macros

#define set_first(type, set)   ((type*)set_first((set)))
 Returns the first element of a set.
#define set_next(type, set)   ((type*)set_next((set)))
 Returns the next element of a set.
#define foreach_set(set, type, entry)   for (type *entry = set_first(type, set); entry; entry = set_next(type, set))
 Iterates over an set.

Typedefs

typedef struct set set
 The abstract type of a set.
typedef int(* set_cmp_fun )(const void *elt, const void *key, size_t size)
 The type of a set compare function.

Functions

setnew_set (set_cmp_fun func, size_t slots)
 Creates a new set.
void del_set (set *set)
 Deletes a set and all elements of it.
size_t set_count (set *set)
 Returns the number of elements in a set.
void * set_find (set *set, const void *key, size_t size, unsigned hash)
 Searches an element in a set.
void * set_insert (set *set, const void *key, size_t size, unsigned hash)
 Inserts an element into a set.
set_entryset_hinsert (set *set, const void *key, size_t size, unsigned hash)
 Inserts an element into a set and returns its set_entry.
set_entryset_hinsert0 (set *set, const void *key, size_t size, unsigned hash)
 Inserts an element into a set, zero-terminate it and returns its set_entry.
void * set_first (set *set)
 Returns the first element of a set.
void * set_next (set *set)
 Returns the next element of a set.
void set_break (set *set)
 Breaks the iteration of a set.

Detailed Description

hashset: datastructure containing objects accessible by their key

Author
Markus Armbruster

Definition in file set.h.