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

#include <vespa/eval/eval/value.h>
#include <cassert>

namespace vespalib::eval {

/**
 * A dense-only value that just owns a vector of cells.
 **/
template<typename T>
class DenseCellsValue : public Value {
private:
    ValueType _type;
    std::vector<T> _cells;
public:
    DenseCellsValue(const ValueType &type_ref, std::vector<T> cells)
      : _type(type_ref), _cells(std::move(cells))
    {
        assert(check_cell_type<T>(_type.cell_type()));
        assert(_cells.size() == _type.dense_subspace_size());
    }
    const ValueType &type() const override { return _type; }
    TypedCells cells() const override { return TypedCells(_cells); }
    const Index &index() const override { return TrivialIndex::get(); }
    MemoryUsage get_memory_usage() const override;
    ~DenseCellsValue();
};

}