aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/numeric_sort_blob_writer.h
blob: e1328d3de1a29dc9936b7a0249ca4d8692792707 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "sort_blob_writer.h"
#include <optional>

namespace search::attribute {

/*
 * Class for writing numeric sort blobs for arrays and
 * weighted sets of type T with ascending or descending
 * sort order.
 */
template <typename T, bool asc>
class NumericSortBlobWriter : public SortBlobWriter {
    std::optional<T> _best;
public:
    NumericSortBlobWriter() noexcept;
    ~NumericSortBlobWriter() noexcept;
    void candidate(T val);
    long write(void *serTo, size_t available);
};

}