cctools
string_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 STRING_SET_H
8 #define STRING_SET_H
9 
10 #include "int_sizes.h"
11 #include "hash_table.h"
12 
50 struct string_set *string_set_create(int buckets, hash_func_t func);
51 
58 struct string_set *string_set_duplicate(struct string_set *s);
59 
67 struct string_set *string_set_union(struct string_set *s1, struct string_set *s2);
68 
74 void string_set_clear(struct string_set *s);
75 
81 void string_set_delete(struct string_set *s);
82 
88 int string_set_size(struct string_set *s);
89 
99 int string_set_insert(struct string_set *s, const char *element);
100 
110 int string_set_insert_string_set(struct string_set *s, struct string_set *s2);
111 
116 int string_set_push(struct string_set *h, const char *element);
117 
124 int string_set_lookup(struct string_set *s, const char *element);
125 
132 int string_set_remove(struct string_set *s, const char *element);
133 
138 void *string_set_pop(struct string_set *s);
139 
147 void string_set_first_element(struct string_set *s);
148 
156 int string_set_next_element(struct string_set *s, char **element);
157 
158 #endif
int string_set_next_element(struct string_set *s, char **element)
Continue iteration over all elements.
struct string_set * string_set_union(struct string_set *s1, struct string_set *s2)
Unions two string_sets into one string_set.
void string_set_first_element(struct string_set *s)
Begin iteration over all the elements.
int string_set_insert_string_set(struct string_set *s, struct string_set *s2)
Insert an existing string_set into the string_set.
void * string_set_pop(struct string_set *s)
Remove an arbitrary element from the string_set.
int string_set_insert(struct string_set *s, const char *element)
Insert an element to the string_set.
unsigned(* hash_func_t)(const char *key)
The type signature for a hash function given to hash_table_create.
Definition: hash_table.h:42
void string_set_delete(struct string_set *s)
Delete a string_set.
int string_set_lookup(struct string_set *s, const char *element)
Look up a element in the string_set.
int string_set_size(struct string_set *s)
Count the entries in a string_set.
int string_set_remove(struct string_set *s, const char *element)
Remove an element.
struct string_set * string_set_create(int buckets, hash_func_t func)
Create a new string_set.
int string_set_push(struct string_set *h, const char *element)
Insert an element to the string_set.
A general purpose hash table.
void string_set_clear(struct string_set *s)
Remove all entries from a string_set.
struct string_set * string_set_duplicate(struct string_set *s)
Duplicate a string_set from an existing string_set.