aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/expression/arrayoperationnode.h
blob: 9cd436bc3825023ee9cec8a56be755ccacd28065 (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
39
40
41
42
43
44
45
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "functionnode.h"
#include <vespa/searchcommon/attribute/iattributecontext.h>
#include <vespa/vespalib/util/stringfmt.h>

namespace search {
namespace expression {

class ArrayOperationNode : public FunctionNode
{
public:
    using IAttributeVector = attribute::IAttributeVector;
    using IAttributeContext = attribute::IAttributeContext;

    DECLARE_NBO_SERIALIZE;
    DECLARE_ABSTRACT_EXPRESSIONNODE(ArrayOperationNode);

    ArrayOperationNode();
    ArrayOperationNode(const ArrayOperationNode& rhs);
    // for unit testing
    ArrayOperationNode(IAttributeVector &attr);

    ArrayOperationNode& operator= (const ArrayOperationNode& rhs);

    void setDocId(DocId newDocId) { _docId = newDocId; }

    void wireAttributes(const IAttributeContext &attrCtx) override;

protected:
    DocId docId() const { return _docId; }

    const IAttributeVector& attribute() const {
        return *_attribute;
    }

private:
    vespalib::string _attributeName;
    const attribute::IAttributeVector * _attribute;
    DocId _docId;
};

}
}