![]() |
Iterator over bins of a record.
The as_record_iterator can be initialized via:
Both of the function require the record on which it will iterate.
To initialize an as_record_iterator on the stack:
To initialize an as_record_iterator on the heap:
When you no longer require the iterator, you should release it and associated resource via as_record_iterator_destroy():
With an initialized as_record_iterator, you can traverse the bins of a record.
Traversal is usually performed by first checking to see if the there are any bins available to traverse to via as_record_iterator_has_next(), which returns true if there are more bins, or false if there are no more bins.
When you are sure there are more bins, then you will use as_record_iterator_next() to read the next bin. If there are no bins available, then NULL is returned.
If as_record_iterator_next() returns a bin, then you can use the following functions to get information about the bin:
Most often, a traversal is performed in a while loop. The following is a simple example:
Definition at line 117 of file as_record_iterator.h.
#include "as_record_iterator.h"
Data Fields | |
uint32_t | pos |
const as_record * | record |
Related Symbols | |
(Note that these are not member symbols.) | |
AS_EXTERN void | as_record_iterator_destroy (as_record_iterator *iterator) |
AS_EXTERN bool | as_record_iterator_has_next (const as_record_iterator *iterator) |
AS_EXTERN as_record_iterator * | as_record_iterator_init (as_record_iterator *iterator, const as_record *record) |
AS_EXTERN as_record_iterator * | as_record_iterator_new (const as_record *record) |
AS_EXTERN as_bin * | as_record_iterator_next (as_record_iterator *iterator) |
|
related |
Destroy the as_record_iterator and associated resources.
iterator | The iterator to destroy. |
|
related |
Test if there are more bins in the iterator.
iterator | The iterator to test. |
|
related |
Initializes a stack allocated as_record_iterator for the specified record.
When you are finished using the as_record
instance, you should release the resources allocated to it by calling as_record_destroy()
.
iterator | The iterator to initialize. |
record | The record to iterate over |
|
related |
Create and initialize a heap allocated as_record_iterator for the specified record.
record | The record to iterate over. |
|
related |
Read the next bin from the iterator.
iterator | The iterator to read from. |
uint32_t as_record_iterator::pos |
Current position of the iterator
Definition at line 133 of file as_record_iterator.h.
const as_record* as_record_iterator::record |
The record being iterated over.
Definition at line 128 of file as_record_iterator.h.