aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/instruction/dense_cell_range_function.h
blob: a37e60d2e57b14803e9808a3af7b018811bfc85b (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/eval/eval/tensor_function.h>

namespace vespalib::eval {

/**
 * Tensor function creating a view to a continuous range of cells in
 * another tensor. The value type will (typically) change, but the
 * cell type must remain the same.
 **/
class DenseCellRangeFunction : public tensor_function::Op1
{
private:
    size_t _offset;
    size_t _length;

public:
    DenseCellRangeFunction(const ValueType &result_type,
                           const TensorFunction &child,
                           size_t offset, size_t length);
    ~DenseCellRangeFunction() override;
    size_t offset() const { return _offset; }
    size_t length() const { return _length; }
    InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
    bool result_is_mutable() const override { return child().result_is_mutable(); }
};

} // namespace