blob: b36ffc1c7fb1e744993249f9a13781736b9c0c7c (
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
|
// 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/value_type.h>
#include <vespa/eval/eval/value.h>
#include "streamed_value_index.h"
#include <cassert>
namespace vespalib::eval {
/**
* Same characteristics as StreamedValue, but does not
* own its data - refers to type, cells and serialized
* labels that must be kept outside the Value.
**/
class StreamedValueView : public Value
{
private:
const ValueType &_type;
TypedCells _cells_ref;
StreamedValueIndex _my_index;
public:
StreamedValueView(const ValueType &type, size_t num_mapped_dimensions,
TypedCells cells, size_t num_subspaces,
const StringIdVector &labels)
: _type(type),
_cells_ref(cells),
_my_index(num_mapped_dimensions, num_subspaces, labels)
{
assert(num_subspaces * _type.dense_subspace_size() == _cells_ref.size);
}
~StreamedValueView();
const ValueType &type() const final override { return _type; }
TypedCells cells() const final override { return _cells_ref; }
const Value::Index &index() const final override { return _my_index; }
MemoryUsage get_memory_usage() const final override {
return self_memory_usage<StreamedValueView>();
}
};
} // namespace
|