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()andmco_seq_float_from_uint4()perform the same conversion.FROM_TYPE_to_TO_TYPE()The element of the result sequence is the
TYPE2equivalent of the correspondingTYPE1element 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
TYPE2equivalent of the correspondingTYPE1element 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, "e_cursor); rc != MCO_S_CURSOR_END; rc = mco_cursor_next(trans, "e_cursor)) { Quote_from_cursor(trans, "e_cursor, "e); Quote_volume_iterator("e, &volume_iterator); ... rc = mco_seq_uint4_to_float(&result_iterator, &volume_iterator); ... } ... }