aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/multinumericattributesaver.h
blob: 442873786660f1756dddef6d0547f04cd79884bd (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "multivalueattributesaver.h"
#include "multi_value_mapping.h"
#include <vespa/searchcommon/attribute/multi_value_traits.h>

namespace search {

/*
 * Class for saving a multivalue attribute.
 *
 * Template argument MultiValueT is either ValueType or
 * multivalue::WeightedValue<ValueType>
 */
template <typename MultiValueT>
class MultiValueNumericAttributeSaver : public MultiValueAttributeSaver
{
    using Parent = MultiValueAttributeSaver;
    using MultiValueType = MultiValueT;
    using ValueType = multivalue::ValueType_t<MultiValueType>;
    using GenerationHandler = vespalib::GenerationHandler;
    using Parent::_frozenIndices;
    using MultiValueMapping = attribute::MultiValueMapping<MultiValueType>;

    const MultiValueMapping &_mvMapping;
public:
    virtual bool onSave(IAttributeSaveTarget &saveTarget) override;
    MultiValueNumericAttributeSaver(GenerationHandler::Guard &&guard,
                                    const attribute::AttributeHeader &header,
                                    const MultiValueMapping &mvMapping);

    virtual ~MultiValueNumericAttributeSaver();
};


} // namespace search