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

#include "bucketresultnode.h"
#include "rawresultnode.h"

namespace search {
namespace expression {

class RawBucketResultNode : public BucketResultNode
{
private:
    ResultNode::CP _from;
    ResultNode::CP _to;
    static RawBucketResultNode _nullResult;
    size_t onGetRawByteSize() const override { return sizeof(_from) + sizeof(_to); }
public:
    struct GetValue {
        BufferRef _tmp;
        ConstBufferRef operator () (const ResultNode & r) { return r.getString(_tmp); }
    };

    DECLARE_EXPRESSIONNODE(RawBucketResultNode);
    DECLARE_NBO_SERIALIZE;
    RawBucketResultNode();
    RawBucketResultNode(const RawBucketResultNode&);
    RawBucketResultNode(RawBucketResultNode&&) noexcept = default;
    RawBucketResultNode(ResultNode::UP from, ResultNode::UP to) : _from(from.release()), _to(to.release()) {}
    ~RawBucketResultNode();
    RawBucketResultNode& operator=(const RawBucketResultNode&);
    RawBucketResultNode& operator=(RawBucketResultNode&&) noexcept;
    size_t hash() const override;
    int onCmp(const Identifiable & b) const override;
    int contains(const RawBucketResultNode & b) const;
    int contains(const ConstBufferRef & v) const;
    void visitMembers(vespalib::ObjectVisitor &visitor) const override;
    const RawBucketResultNode& getNullBucket() const override { return getNull(); }
    static const RawBucketResultNode & getNull() { return _nullResult; }
};

}
}