aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/expression/functionnode.h
blob: c2b7dff6a7a662be6b6ccec409fcb0c8abe30430 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "expressionnode.h"
#include "resultnode.h"

namespace search::expression {

class FunctionNode : public ExpressionNode
{
public:
    DECLARE_NBO_SERIALIZE;
    void visitMembers(vespalib::ObjectVisitor & visitor) const override;
    DECLARE_ABSTRACT_EXPRESSIONNODE(FunctionNode);
    const ResultNode * getResult() const override { return _tmpResult.get(); }
    ResultNode & updateResult() const { return *_tmpResult; }
    virtual void reset() { _tmpResult.reset(nullptr); }

    FunctionNode &setResult(const ResultNode::CP res) { _tmpResult = std::move(res); return *this; }
protected:
    void setResultType(ResultNode::UP res) { _tmpResult = std::move(res); }
    void selectMembers(const vespalib::ObjectPredicate & predicate, vespalib::ObjectOperation & operation) override;
private:
    mutable ResultNode::CP _tmpResult;
};

}