doxygen docu added, cleaned up a bit
[libfirm] / ir / adt / eset.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/adt/eset.h
4  * Purpose:     Datentyp: Vereinfachte Menge (hash-set) zum Speichern von
5  *              Zeigern/Adressen.
6  * Author:      Hubert Schmid
7  * Modified by:
8  * Created:     09.06.2002
9  * CVS-ID:      $Id$
10  * Copyright:   (c) 2002 Universität Karlsruhe
11  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
12  */
13
14
15 #ifndef _ESET_H_
16 #define _ESET_H_
17
18 #include <stdbool.h>
19
20 /**
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.
24  */
25 typedef struct eset eset;
26
27 /** Creates a new empty set. */
28 eset * eset_create(void);
29
30 /**
31  * Creates a copy of the given set. Did NOT work if NULL is contained in source. */
32 eset * eset_copy(eset *source);
33
34 /** Deletes a set. */
35 void eset_destroy(eset *s);
36
37 /** Inserts an address into the set. */
38 void eset_insert(eset *s, void *p);
39
40 /** Checks, wheater an address is element of a set. */
41 bool eset_contains(eset *s, void *p);
42
43 /**
44  * Starts the iteration over a set and returns the first element or NULL
45  * if the set is empty.
46  *
47  * @note: It is NOT possible to add new elements while iterating through a set.
48  */
49 void * eset_first(eset *s);
50
51 /**
52  * Continues iteration through a set and returns the next element or NULL if the
53  * iteration is finished.
54  *
55  * @note: It is NOT possible to add new elements while iterating through a set.
56  */
57 void * eset_next(eset *s);
58
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);
61
62 #endif /* _ESET_H_ */