cctools
set.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2013- The University of Notre Dame
3 This software is distributed under the GNU General Public License.
4 See the file COPYING for details.
5 */
6 
7 #ifndef SET_H
8 #define SET_H
9 
10 #include "int_sizes.h"
11 #include "list.h"
12 
49 struct set *set_create(int buckets);
50 
57 struct set *set_duplicate(struct set *s);
58 
66 struct set *set_union(struct set *s1, struct set *s2);
67 
73 void set_clear(struct set *s);
74 
80 void set_delete(struct set *s);
81 
87 int set_size(struct set *s);
88 
98 int set_insert(struct set *s, const void *element);
99 
109 int set_insert_set(struct set *s, struct set *s2);
110 
120 int set_insert_list(struct set *s, struct list *l);
121 
126 int set_push(struct set *h, const void *element);
127 
134 int set_lookup(struct set *s, void *element);
135 
142 int set_remove(struct set *s, const void *element);
143 
148 void *set_pop(struct set *s);
149 
157 void set_first_element(struct set *s);
158 
165 void *set_next_element(struct set *s);
166 
167 #endif
void set_first_element(struct set *s)
Begin iteration over all the elements.
int set_insert_set(struct set *s, struct set *s2)
Insert an existing set into the set.
void set_delete(struct set *s)
Delete a set.
int set_insert(struct set *s, const void *element)
Insert an element to the set.
int set_remove(struct set *s, const void *element)
Remove an element.
void set_clear(struct set *s)
Remove all entries from a set.
Robust, reentrant linked list structure.
int set_lookup(struct set *s, void *element)
Look up a element in the set.
void * set_next_element(struct set *s)
Continue iteration over all elements.
int set_size(struct set *s)
Count the entries in a set.
void * set_pop(struct set *s)
Remove an arbitrary element from the set.
struct set * set_create(int buckets)
Create a new set.
struct set * set_duplicate(struct set *s)
Duplicate a set from an existing set.
int set_push(struct set *h, const void *element)
Insert an element to the set.
int set_insert_list(struct set *s, struct list *l)
Insert an existing list into the set.
struct set * set_union(struct set *s1, struct set *s2)
Unions two sets into one set.