aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/extendable_numeric_array_multi_value_read_view.h
blob: 2b4f22a91de7065e405b80df55fbf47329d8973f (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
26
27
28
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/searchcommon/attribute/i_multi_value_read_view.h>

namespace search::attribute {

/**
 * Read view for the data stored in an extendable multi-value numeric
 * array attribute vector (used by streaming visitor) that handles
 * optional addition of weight.
 * @tparam MultiValueType The multi-value type of the data to access.
 * @tparam BaseType The base type of the raw data to access.
 */
template <typename MultiValueType, typename BaseType>
class ExtendableNumericArrayMultiValueReadView : public attribute::IMultiValueReadView<MultiValueType>
{
    const std::vector<BaseType>&        _data;
    const std::vector<uint32_t>&        _idx;
    mutable std::vector<MultiValueType> _copy;
public:
    ExtendableNumericArrayMultiValueReadView(const std::vector<BaseType>& data, const std::vector<uint32_t>& idx);
    ~ExtendableNumericArrayMultiValueReadView() override;
    vespalib::ConstArrayRef<MultiValueType> get_values(uint32_t doc_id) const override;
};

}