Example #1
0
void Sequencer::filter(PSortedRun run, std::shared_ptr<QP::IQueryProcessor> q, std::vector<PSortedRun>* results) const {
    if (run->empty()) {
        return;
    }
    PSortedRun result(new SortedRun);
    auto lkey = TimeSeriesValue(q->lowerbound(),  0u, 0);
    auto rkey = TimeSeriesValue(q->upperbound(), ~0u, 0);
    auto begin = std::lower_bound(run->begin(), run->end(), lkey);
    auto end = std::upper_bound(run->begin(), run->end(), rkey);
    std::copy(begin, end, std::back_inserter(*result));
    results->push_back(move(result));
}
void Sequencer::filter(PSortedRun run, SearchQuery const& q, std::vector<PSortedRun>* results) const {
    if (run->empty()) {
        return;
    }
    SearchPredicate search_pred(q);
    PSortedRun result(new SortedRun);
    auto lkey = TimeSeriesValue(q.lowerbound, 0u, 0u, 0u);
    auto rkey = TimeSeriesValue(q.upperbound, ~0u, 0u, 0u);
    auto begin = std::lower_bound(run->begin(), run->end(), lkey);
    auto end = std::upper_bound(run->begin(), run->end(), rkey);
    copy_if(begin, end, std::back_inserter(*result), search_pred);
    results->push_back(move(result));
}