2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief a pointer hashset (WARNING: deprecated, use hashset_new.*
24 * @author Hubert Schmid
28 #ifndef FIRM_ADT_ESET_H
29 #define FIRM_ADT_ESET_H
32 * "eset" is a set of addresses. The addresses are used for element
33 * compare and hash calculation.
34 * The value "NULL" can not be stored, as it is used as internal sentinel.
36 typedef struct eset eset;
38 /** Creates a new empty set. */
39 eset *eset_create(void);
42 * Creates a copy of the given set. Does NOT work if NULL is contained in source. */
43 eset *eset_copy(eset *source);
46 void eset_destroy(eset *s);
48 /** Returns the number of elements in the set. */
49 int eset_count(eset *s);
51 /** Inserts an address into the set. */
52 void eset_insert(eset *s, void *p);
54 /** Checks, whether an address is element of a set. */
55 int eset_contains(eset *s, void *p);
58 * Starts the iteration over a set and returns the first element or NULL
59 * if the set is empty.
61 * @note: It is NOT possible to add new elements while iterating through a set.
63 void *eset_first(eset *s);
66 * Continues iteration through a set and returns the next element or NULL if the
67 * iteration is finished.
69 * @note: It is NOT possible to add new elements while iterating through a set.
71 void *eset_next(eset *s);
73 /** Inserts all elements of source into target (union). Does NOT work if NULL is contained in source. */
74 void eset_insert_all(eset *target, eset *source);