classname_fieldname_iterator

Initializes a typed iterator over every logical element of a persistent sequence field.

Prototype

    MCO_RET classname_fieldname_iterator(
        classname *handle,
        mco_seq_iterator_h iterator);

Arguments

handle is a valid object handle scoped to an active read-only or read-write transaction. iterator points to caller-owned mco_seq_iterator_t storage initialized by this function.

Behavior

The iterator is lazy. It borrows the transaction and field storage represented by handle; both must remain valid until traversal is complete. Typed mco_seq_next_TYPE() and mco_seq_get_nullable_TYPE() functions traverse logical elements and therefore expand RLE runs.

An empty field returns MCO_S_NOTFOUND. Successful traversal ends with MCO_S_CURSOR_END.

Example

    mco_seq_iterator_t iterator;
    mco_int4 value;
    MCO_RET rc;

    rc = Sensor_readings_iterator(&sensor, &iterator);
    while (rc == MCO_S_OK &&
           (rc = mco_seq_next_int4(&iterator, &value)) == MCO_S_OK) {
        /* use value */
    }

Call iterator.reset(&iterator) to restart traversal. See mco_seq_iterator_t for lifetime, NULL, and direct-tile rules.