aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/expression/enumresultnode.h
blob: 6d201cb2b5d7eb41946838b8a5b53a1e968b2c08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright Yahoo. 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;
};

}