3 * File name: ir/adt/eset.h
4 * Purpose: Datentyp: Vereinfachte Menge (hash-set) zum Speichern von
6 * Author: Hubert Schmid
10 * Copyright: (c) 2002 Universität Karlsruhe
11 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
21 * "eset" is a set of addresses. The addresses are used for element
22 * compare and hash calculation.
23 * The value "NULL" could not be stored, as it is used as internal sentinel.
25 typedef struct eset eset;
27 /** Creates a new empty set. */
28 eset * eset_create(void);
31 * Creates a copy of the given set. Did NOT work if NULL is contained in source. */
32 eset * eset_copy(eset *source);
35 void eset_destroy(eset *s);
37 /** Inserts an address into the set. */
38 void eset_insert(eset *s, void *p);
40 /** Checks, wheater an address is element of a set. */
41 bool eset_contains(eset *s, void *p);
44 * Starts the iteration over a set and returns the first element or NULL
45 * if the set is empty.
47 * @note: It is NOT possible to add new elements while iterating through a set.
49 void * eset_first(eset *s);
52 * Continues iteration through a set and returns the next element or NULL if the
53 * iteration is finished.
55 * @note: It is NOT possible to add new elements while iterating through a set.
57 void * eset_next(eset *s);
59 /** Inserts all elements of source into target (union). Did NOT work if NULL is contained in source. */
60 void eset_insert_all(eset * target, eset * source);