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 
48 struct set *set_create(int buckets);
49 
55 void set_clear(struct set *s);
56 
62 void set_delete(struct set *s);
63 
69 int set_size(struct set *s);
70 
80 int set_insert(struct set *s, const void *element);
81 
86 int set_push(struct set *h, const void *element);
87 
94 int set_lookup(struct set *s, void *element);
95 
102 int set_remove(struct set *s, const void *element);
103 
108 void *set_pop(struct set *s);
109 
117 void set_first_element(struct set *s);
118 
125 void *set_next_element(struct set *s);
126 
127 #endif
void set_first_element(struct set *s)
Begin iteration over all the elements.
void set_delete(struct set *s)
Delete a set.
int set_insert(struct set *s, const void *element)
Insert a 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.
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.
int set_push(struct set *h, const void *element)
Insert a element to the set.