classname_fieldname_map

Initializes an iterator that selects field elements by arbitrary logical positions supplied by another iterator.

Prototype

    MCO_RET classname_fieldname_map(
        classname *handle,
        mco_seq_iterator_h result,
        mco_seq_iterator_h positions);

Behavior

positions must yield mco_uint8 values. Each value is interpreted as a zero-based logical position in the field. Positions may be repeated or supplied in any order; result has the field's element type and follows that same order.

NULL element state is preserved. With RLE storage, positions still address expanded logical elements.

The operation is lazy and consumes positions while result is traversed. An incompatible position type returns MCO_E_ILLEGAL_TYPE; an invalid position produces an access/search error during traversal. With binding checks enabled, reusing an already bound operand can return MCO_E_SEQ_BOUNDED.

Example

    mco_uint8 requested[3] = { 8, 3, 8 };
    mco_seq_iterator_t positions;
    mco_seq_iterator_t values;
    MCO_RET rc;

    rc = mco_seq_unget_uint8(&positions, requested, 3);
    if (rc == MCO_S_OK) {
        rc = Sensor_readings_map(
            &sensor, &values, &positions);
    }