string_set.h
Go to the documentation of this file.
/*
Copyright (C) 2022 The University of Notre Dame
This software is distributed under the GNU General Public License.
See the file COPYING for details.
*/
#ifndef STRING_SET_H
#define STRING_SET_H
#include "int_sizes.h"
#include "hash_table.h"
struct string_set *string_set_create(int buckets, hash_func_t func);
struct string_set *string_set_duplicate(struct string_set *s);
struct string_set *string_set_union(struct string_set *s1, struct string_set *s2);
void string_set_clear(struct string_set *s);
void string_set_delete(struct string_set *s);
int string_set_size(struct string_set *s);
int string_set_insert(struct string_set *s, const char *element);
int string_set_insert_string_set(struct string_set *s, struct string_set *s2);
int string_set_push(struct string_set *h, const char *element);
int string_set_lookup(struct string_set *s, const char *element);
int string_set_remove(struct string_set *s, const char *element);
void *string_set_pop(struct string_set *s);
void string_set_first_element(struct string_set *s);
int string_set_next_element(struct string_set *s, char **element);
#endif
hash_table.h
A general purpose hash table.
hash_func_t
unsigned(* hash_func_t)(const char *key)
The type signature for a hash function given to hash_table_create.
Definition hash_table.h:41
string_set_union
struct string_set * string_set_union(struct string_set *s1, struct string_set *s2)
Unions two string_sets into one string_set.
string_set_size
int string_set_size(struct string_set *s)
Count the entries in a string_set.
string_set_create
struct string_set * string_set_create(int buckets, hash_func_t func)
Create a new string_set.
string_set_first_element
void string_set_first_element(struct string_set *s)
Begin iteration over all the elements.
string_set_insert
int string_set_insert(struct string_set *s, const char *element)
Insert an element to the string_set.
string_set_pop
void * string_set_pop(struct string_set *s)
Remove an arbitrary element from the string_set.
string_set_next_element
int string_set_next_element(struct string_set *s, char **element)
Continue iteration over all elements.
string_set_lookup
int string_set_lookup(struct string_set *s, const char *element)
Look up a element in the string_set.
string_set_clear
void string_set_clear(struct string_set *s)
Remove all entries from a string_set.
string_set_push
int string_set_push(struct string_set *h, const char *element)
Insert an element to the string_set.
string_set_delete
void string_set_delete(struct string_set *s)
Delete a string_set.
string_set_remove
int string_set_remove(struct string_set *s, const char *element)
Remove an element.
string_set_insert_string_set
int string_set_insert_string_set(struct string_set *s, struct string_set *s2)
Insert an existing string_set into the string_set.
string_set_duplicate
struct string_set * string_set_duplicate(struct string_set *s)
Duplicate a string_set from an existing string_set.