*** empty log message ***
[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" could 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. Did 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 /** Inserts an address into the set. */
34 void eset_insert(eset *s, void *p);
35
36 /** Checks, wheater an address is element of a set. */
37 int eset_contains(eset *s, void *p);
38
39 /**
40  * Starts the iteration over a set and returns the first element or NULL
41  * if the set is empty.
42  *
43  * @note: It is NOT possible to add new elements while iterating through a set.
44  */
45 void *eset_first(eset *s);
46
47 /**
48  * Continues iteration through a set and returns the next element or NULL if the
49  * iteration is finished.
50  *
51  * @note: It is NOT possible to add new elements while iterating through a set.
52  */
53 void *eset_next(eset *s);
54
55 /** Inserts all elements of source into target (union). Did NOT work if NULL is contained in source. */
56 void eset_insert_all(eset *target, eset *source);
57
58 #endif /* _ESET_H_ */