reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
hashset.h
Go to the documentation of this file.
1
49
50#ifndef HASHSET_H
51#define HASHSET_H 1
52
53#include <stdlib.h>
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
63struct hashset_st {
64 size_t nbits;
65 size_t mask;
66
67 size_t capacity;
68 void** items;
69 size_t nitems;
71};
72
73typedef struct hashset_st* hashset_t;
74
85
93
102
116int hashset_add(hashset_t set, void* item);
117
126int hashset_remove(hashset_t set, void* item);
127
136int hashset_is_member(hashset_t set, void* item);
137
138#ifdef __cplusplus
139}
140#endif
141
142#endif
hashset_t hashset_create(unsigned short nbits)
Create a hashset instance.
int hashset_add(hashset_t set, void *item)
Add a pointer to the hashset.
int hashset_is_member(hashset_t set, void *item)
Returns non-zero if the item is in the hashset and zero otherwise.
int hashset_remove(hashset_t set, void *item)
Remove an item from the hashset.
void hashset_destroy(hashset_t set)
Destroy the hashset instance, freeing allocated memory.
size_t hashset_num_items(hashset_t set)
Return the number of items in the hashset.
struct hashset_st * hashset_t
Definition hashset.h:73
A hashset.
Definition hashset.h:63
void ** items
Definition hashset.h:68
size_t capacity
Definition hashset.h:67
size_t n_deleted_items
Definition hashset.h:70
size_t nitems
Definition hashset.h:69
size_t mask
Definition hashset.h:65
size_t nbits
Definition hashset.h:64