µEvLoop
A fast and lightweight event loop aimed at embedded platforms in C99.
Data Fields
uel_iterator_t Struct Reference

Iterators are data structures that wrap arbitrary collections of data and define ways of enumerating them. More...

Collaboration diagram for uel_iterator_t:
Collaboration graph
[legend]

Data Fields

void *(* next )(uel_iterator_t *, void *)
 The iteration function assigned to this iterator type. More...
 
void * collection
 A reference to the collection being iterated.
 

Detailed Description

Iterators are data structures that wrap arbitrary collections of data and define ways of enumerating them.

This is an unspecialised structure that should be augumented with actual behaviour implementation.

In order to specialise it, create a struct that holds whatever state is meaningful to iteration and has a uel_iterator_t as its first member. Then, whenever needed, cast the iterator to your custom type.

Field Documentation

◆ next

void*(* uel_iterator_t::next) (uel_iterator_t *, void *)

The iteration function assigned to this iterator type.

This is the actual implementation of the iteration algorithm. It takes a reference to the iterator and the last accessed element's address and returns a reference to the next element.

To resquest the first collection item, pass NULL as the last element parameter. When this function returns NULL, there are no more elements in the collection to be iterated over.


The documentation for this struct was generated from the following file: