some clean up
[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 #ifndef _ESET_H_
14 #define _ESET_H_
15
16 /**
17  * "eset" is a set of addresses. The addresses are used for element
18  * compare and hash calculation.
19  * The value "NULL" can not be stored, as it is used as internal sentinel.
20  */
21 typedef struct eset eset;
22
23 /** Creates a new empty set. */
24 eset *eset_create(void);
25
26 /**
27  * Creates a copy of the given set. Does NOT work if NULL is contained in source. */
28 eset *eset_copy(eset *source);
29
30 /** Deletes a set. */
31 void eset_destroy(eset *s);
32
33 /** Returns the number of elements in the set. */
34 int eset_count(eset *s);
35
36 /** Inserts an address into the set. */
37 void eset_insert(eset *s, void *p);
38
39 /** Checks, whether an address is element of a set. */
40 int eset_contains(eset *s, void *p);
41
42 /**
43  * Starts the iteration over a set and returns the first element or NULL
44  * if the set is empty.
45  *
46  * @note: It is NOT possible to add new elements while iterating through a set.
47  */
48 void *eset_first(eset *s);
49
50 /**
51  * Continues iteration through a set and returns the next element or NULL if the
52  * iteration is finished.
53  *
54  * @note: It is NOT possible to add new elements while iterating through a set.
55  */
56 void *eset_next(eset *s);
57
58 /** Inserts all elements of source into target (union). Did NOT work if NULL is contained in source. */
59 void eset_insert_all(eset *target, eset *source);
60
61 #endif /* _ESET_H_ */