reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
hashset_itr.c File Reference
#include <assert.h>
#include <stdio.h>
#include "hashset/hashset_itr.h"

Functions

hashset_itr_t hashset_iterator (hashset_t set)
 Create a hashset iterator. The caller should then iterate over the hashset as follows:
 
int hashset_iterator_has_next (hashset_itr_t itr)
 Return 1 if there is a next value in the hashset and 0 otherwise.
 
int hashset_iterator_next (hashset_itr_t itr)
 Advance to the next value in the hashset. This returns a non-negative number (the current index) if there is a next item and -1 otherwise.
 
void * hashset_iterator_value (hashset_itr_t itr)
 Returns the value at the current index. The called should check hashset_iterator_has_next before calling this.
 

Function Documentation

◆ hashset_iterator()

hashset_itr_t hashset_iterator ( hashset_t set)

Create a hashset iterator. The caller should then iterate over the hashset as follows:

hashset_itr_t iterator = hashset_iterator(my_hashset);
while (hashset_iterator_next(iterator) >= 0) {
void* my_value = hashset_iterator_value(iterator);
...
}
free(iterator);
void HASHMAP free(HASHMAP(t) *hashmap)
Free all memory used by the given hashmap.
Definition hashmap.h:121
void * hashset_iterator_value(hashset_itr_t itr)
Returns the value at the current index. The called should check hashset_iterator_has_next before call...
Definition hashset_itr.c:78
int hashset_iterator_next(hashset_itr_t itr)
Advance to the next value in the hashset. This returns a non-negative number (the current index) if t...
Definition hashset_itr.c:56
hashset_itr_t hashset_iterator(hashset_t set)
Create a hashset iterator. The caller should then iterate over the hashset as follows:
Definition hashset_itr.c:26
Definition hashset_itr.h:29

The caller must call free() on this iterator after using it.

◆ hashset_iterator_has_next()

int hashset_iterator_has_next ( hashset_itr_t itr)

Return 1 if there is a next value in the hashset and 0 otherwise.

◆ hashset_iterator_next()

int hashset_iterator_next ( hashset_itr_t itr)

Advance to the next value in the hashset. This returns a non-negative number (the current index) if there is a next item and -1 otherwise.

◆ hashset_iterator_value()

void * hashset_iterator_value ( hashset_itr_t itr)

Returns the value at the current index. The called should check hashset_iterator_has_next before calling this.