Iterable structure <BLOC/iterator.h>

The Iterable structure describes a type of object that is iterable. All iterable objects can be operated on with an Iterator object and related routines. This structure should be embedded as a header in objects that wish to be iterable.

Syntax

struct Iterable {
	unsigned int magic;
	struct IterableEntry *start, *end;
	unsigned int entries;
};

Members

magic

This member contains a magic value (ITER_MAGIC). All iterable objects must have this set in order to be iterable.

start

A pointer to the first IterableEntry structure. If there are no entries, then this will be NULL.

end

A pointer to the last IterableEntry structure. If there are no entries, then this will be NULL.

entries

The number of entries in the iterable object. This value will need to be maintained correctly by the iterable object in order to be iterated correctly.