aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/expression/enumattributeresult.h
blob: 79191abed725801fea9183a9b415d6bbcdb89614 (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 "attributeresult.h"

namespace search::expression {

class EnumAttributeResult final : public AttributeResult
{
public:
    using EnumRefs = attribute::IAttributeVector::EnumRefs;
    DECLARE_RESULTNODE(EnumAttributeResult);
    EnumAttributeResult(EnumRefs enumRefs, const attribute::IAttributeVector * attribute, DocId docId) :
        AttributeResult(attribute, docId),
        _enumRefs(enumRefs)
    {
    }
private:
    EnumAttributeResult()
        : AttributeResult(),
          _enumRefs()
    { }
    int64_t onGetEnum(size_t index) const override { (void) index; return (static_cast<int64_t>(_enumRefs[getDocId()].load_relaxed().ref())); }
    EnumRefs _enumRefs;
};

}