summaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchcommon/attribute/i_multi_value_read_view.h
blob: 8e5005eae8de5e15098b264a8674baa0c953e563 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "multivalue.h"
#include <vespa/vespalib/datastore/atomic_entry_ref.h>
#include <vespa/vespalib/util/arrayref.h>

namespace search::attribute {

/**
 * Read view for the data stored in a multi-value attribute.
 * @tparam MultiValueType The multi-value type of the data to access.
 */
template <typename MultiValueType>
class IMultiValueReadView {
public:
    virtual ~IMultiValueReadView() {}
    virtual vespalib::ConstArrayRef<MultiValueType> get_values(uint32_t docid) const = 0;
};

/**
 * Read view for the raw data stored in an array attribute.
 * @tparam T The value type of the raw data to access.
 */
template <typename T>
using IArrayReadView = IMultiValueReadView<T>;

/**
 * Read view for the raw data stored in a weighted set attribute.
 * @tparam T The value type of the raw data to access.
 */
template <typename T>
using IWeightedSetReadView = IMultiValueReadView<multivalue::WeightedValue<T>>;

/**
 * Read view for the raw data stored in an enumerated array attribute.
 */
using IArrayEnumReadView = IArrayReadView<vespalib::datastore::AtomicEntryRef>;

/**
 * Read view for the raw data stored in an enumerated weighted set attribute.
 */
using IWeightedSetEnumReadView = IWeightedSetReadView<vespalib::datastore::AtomicEntryRef>;

};