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

Go to the source code of this file.

Data Structures

struct  hashset_itr_st
 

Typedefs

typedef struct hashset_itr_sthashset_itr_t
 

Functions

hashset_itr_t hashset_iterator (hashset_t set)
 Create a hashset iterator. The caller should then iterate over the hashset as follows:
 
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.
 
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.
 

Typedef Documentation

◆ hashset_itr_t

typedef struct hashset_itr_st* hashset_itr_t

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.