aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/expression/enumresultnode.h
blob: d9b2a33719806b45421e72f27a3b239feb8d9da4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "integerresultnode.h"

namespace search::expression {

class EnumResultNode : public IntegerResultNodeT<int64_t>
{
private:
    using Base = IntegerResultNodeT<int64_t>;
public:
    DECLARE_RESULTNODE(EnumResultNode);
    EnumResultNode(int64_t v=0) : Base(v) { }
    void set(const ResultNode & rhs) override { setValue(rhs.getEnum()); }
private:
    int64_t onGetEnum(size_t index) const override { (void) index; return getValue(); }
    ConstBufferRef onGetString(size_t index, BufferRef buf) const override;
};

}