The methods below show the use of sequence masks to subset both time lines and data sequences associated with them. The application of a mask to a data series has the effect that the sequence entry at index n is copied to the new sequence only if the mask value at index n is true.
void get_subsequence( Sequence& seq, SequenceMask &msk);
#include "qplug_if.h" #include "Qdos.h" using namespace QSAS; QdTimeSeq_var tt_out = new QdTimeSeq(); QdObject_var input1 = (* object_list)[1]; QdObject_var input2 = (* object_list)[2]; QdTimeInterval_var interval = get_timeinterval(input1); QdTimeSeq_var tt = get_timetags(input2); SequenceMask msk(tt->get_mask(QdTimeSeq::InRange(interval->start(), interval->end()))); // put timetags satisfying condition in tt_out // Note tt_out is a var pointer, so we pass in *tt_out tt_in->get_subsequence( *tt_out, msk); QdRScalar_var ds_out = new QdRScalarSeq(); // put data objects satisfying condition in ds_out input2->get_subsequence( *ds_out, msk); set_timetags(ds_out, tt_out);
SequenceMask operator!
input2->get_subsequence( *ds_out, !msk);
SequenceMask operator &&, operator ||
input2->get_subsequence( *ds_out, (msk1 && msk2) );