The following C++ Sequence methods take an integer argument
n
and produce result sequences of the topn
elements as described in the table below:
Sequence<T> topMax(mco_size_t n) const Return the top n
maximum values in the object's sequenceSequence<T> topMin(mco_size_t n) const; Return the top
n
minimum values in the object's sequenceSequence<mco_seq_no_t> topPosMax(mco_size_t n) const Return the positions of the top
n
maximum values in the object's sequenceSequence<mco_seq_no_t> topPosMin(mco_size_t n) const Return the positions of the top
n
minimum values in the object's sequenceExample
Following is an example code snippet demonstrating one of these functions:
{ mco_trans_h trans; mco_cursor_t quote_cursor; Quote quote; float close; MCO_RET rc; ... rc = mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &trans); if ( MCO_S_OK == 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); Sequence<float> top10Close = quote.close_iterator().topMax(10); while (top10Close.next(close)) { Char<MAX_SYMBOL_LEN> symbol = quote.symbol; printf("%s: close=%.3f\n", (char*)symbol, close); } } mco_trans_rollback(trans); } }