cctools
string_set.h
Go to the documentation of this file.
1/*
2Copyright (C) 2022 The University of Notre Dame
3This software is distributed under the GNU General Public License.
4See 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
50struct string_set *string_set_create(int buckets, hash_func_t func);
51
58struct string_set *string_set_duplicate(struct string_set *s);
59
67struct string_set *string_set_union(struct string_set *s1, struct string_set *s2);
68
74void string_set_clear(struct string_set *s);
75
81void string_set_delete(struct string_set *s);
82
88int string_set_size(struct string_set *s);
89
99int string_set_insert(struct string_set *s, const char *element);
100
110int string_set_insert_string_set(struct string_set *s, struct string_set *s2);
111
116int string_set_push(struct string_set *h, const char *element);
117
124int string_set_lookup(struct string_set *s, const char *element);
125
132int string_set_remove(struct string_set *s, const char *element);
133
138void *string_set_pop(struct string_set *s);
139
147void string_set_first_element(struct string_set *s);
148
156int string_set_next_element(struct string_set *s, char **element);
157
158#endif
A general purpose hash table.
unsigned(* hash_func_t)(const char *key)
The type signature for a hash function given to hash_table_create.
Definition hash_table.h:41
struct string_set * string_set_union(struct string_set *s1, struct string_set *s2)
Unions two string_sets into one string_set.
int string_set_size(struct string_set *s)
Count the entries in a string_set.
struct string_set * string_set_create(int buckets, hash_func_t func)
Create a new string_set.
void string_set_first_element(struct string_set *s)
Begin iteration over all the elements.
int string_set_insert(struct string_set *s, const char *element)
Insert an element to the string_set.
void * string_set_pop(struct string_set *s)
Remove an arbitrary element from the string_set.
int string_set_next_element(struct string_set *s, char **element)
Continue iteration over all elements.
int string_set_lookup(struct string_set *s, const char *element)
Look up a element in the string_set.
void string_set_clear(struct string_set *s)
Remove all entries from a string_set.
int string_set_push(struct string_set *h, const char *element)
Insert an element to the string_set.
void string_set_delete(struct string_set *s)
Delete a string_set.
int string_set_remove(struct string_set *s, const char *element)
Remove an element.
int string_set_insert_string_set(struct string_set *s, struct string_set *s2)
Insert an existing string_set into the string_set.
struct string_set * string_set_duplicate(struct string_set *s)
Duplicate a string_set from an existing string_set.