Conversion C Sequence Functions

The following conversion C functions take one sequence input of TYPE1 and produce the result sequence of TYPE2 where the allowed types are listed in the Analytics Functions page. The mco_seq_print_char() API takes an additional integer element_size argument and a character string format argument and returns a character result sequence.

Both naming forms are declared for each supported pair. For example, mco_seq_uint4_to_float() and mco_seq_float_from_uint4() perform the same conversion.

FROM_TYPE_to_TO_TYPE()

The element of the result sequence is the TYPE2 equivalent of the corresponding TYPE1 element in input.

The function signature is as follows:

                MCO_RET mco_seq_FROM_TYPE_to_TO_TYPE(
                    mco_seq_iterator_h result,
                    mco_seq_iterator_h input
                );
TO_TYPE_from_FROM_TYPE()

The element of the result sequence is the TYPE2 equivalent of the corresponding TYPE1 element in input.

The function signature is as follows:

                MCO_RET mco_seq_TO_TYPE_from_FROM_TYPE(
                    mco_seq_iterator_h result,
                    mco_seq_iterator_h input
                );
mco_seq_print_char()

Prints data from the input sequence into the result sequence according to the printf()-compatible format string.

The function signature is as follows:

                MCO_RET mco_seq_print_char(
                    mco_seq_iterator_h result,
                    mco_seq_iterator_h input,
                    mco_size_t elem_size,
                    const char* format
                );

Example

Following is an example code snippet demonstrating a conversion operator function:

    {
        mco_trans_h trans;
        mco_cursor_t quote_cursor;
        Quote quote;
        mco_seq_iterator_t volume_iterator,  result_iterator;
        MCO_RET rc;
        ...

        for (rc = mco_cursor_first(trans, &quote_cursor);
            rc != MCO_S_CURSOR_END;
            rc = mco_cursor_next(trans, &quote_cursor))
        {
            Quote_from_cursor(trans, &quote_cursor, &quote);
            Quote_volume_iterator(&quote, &volume_iterator);
            ...
            rc = mco_seq_uint4_to_float(&result_iterator, &volume_iterator);

            ...
        }
        ...
    }