4 * Time-stamp: <11.11.2004 16:42:22h liekweg>
6 * File name: ir/ana2/qset.h
7 * Purpose: yet another set implementation
10 * Created: Mon 18 Oct 2004
12 * Copyright: (c) 1999-2004 Universität Karlsruhe
13 * Licence: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
22 # endif /* nof defined TRUE */
24 /* define this as needed */
25 # define COMPARE(A,B) (A<B)
26 # define EQUAL(A,B) (A==B)
27 /* typedef unsigned int sortable_t; */
28 typedef void* sortable_t;
30 typedef struct qset_str
36 int cursor; /* for qset_start/qset_next */
43 /* Allocate a new qset with initial space for up to n_elems. */
44 qset_t *qset_new (const int);
46 /* Sort the entries of the given qset. */
47 void qset_sort (qset_t*);
49 /* Compact a qset to take up no more space than required. */
50 void qset_compact (qset_t*);
52 /* Free the memory associated with the given qset */
53 void qset_delete (qset_t*);
55 /* Test whether the given qset contains the given value. */
56 int qset_contains (qset_t*, sortable_t);
58 /* Delete the given value from the given qset (if it exists) */
59 void qset_remove (qset_t*, sortable_t);
61 /* Insert the given elem into the given qset. */
62 void qset_insert (qset_t*, sortable_t);
64 /* Insert all elems of qset2 into qset1. qset2 is deleted. */
65 void qset_insert_all (qset_t*, qset_t*);
67 /* Compare two qsets. */
68 int qset_compare (qset_t*, qset_t*);
70 /* Returns the union of two qsets. */
71 qset_t *qset_union (qset_t *qset1, qset_t *qset2);
73 /* Report the size of the given qset. */
74 int qset_size (qset_t *qset);
76 /* Print the given qset to the given stream. */
77 void qset_print (qset_t*, FILE*);
79 /* Check wether the given qset is empty */
80 int qset_is_empty (qset_t*);
85 /* initialise the iteration, return the first element */
86 sortable_t *qset_start (qset_t*);
87 /* step to the next element, return NULL iff no more elems are available */
88 sortable_t *qset_next (qset_t*);
90 #endif /* def _QSET_H_ */
94 Revision 1.3 2004/11/18 16:35:46 liekweg
95 Added unique ids for debugging
97 Revision 1.2 2004/11/08 12:32:00 liekweg
98 Moved q_* methods into private section
100 Revision 1.1 2004/11/04 14:55:13 liekweg