blob: 1af1d8f38306505c45ad20bcdb4b5dc7085dcc4d (
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
46
47
48
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "fieldvalue.h"
namespace vespalib::eval { struct Value; }
namespace document {
class TensorDataType;
/**
* Field value representing a tensor.
*/
class TensorFieldValue final : public FieldValue {
private:
const TensorDataType &_dataType;
std::unique_ptr<vespalib::eval::Value> _tensor;
public:
TensorFieldValue();
explicit TensorFieldValue(const TensorDataType &dataType);
TensorFieldValue(const TensorFieldValue &rhs);
TensorFieldValue(TensorFieldValue &&rhs);
~TensorFieldValue() override;
TensorFieldValue &operator=(const TensorFieldValue &rhs);
TensorFieldValue &operator=(std::unique_ptr<vespalib::eval::Value> rhs);
void make_empty_if_not_existing();
void accept(FieldValueVisitor &visitor) override;
void accept(ConstFieldValueVisitor &visitor) const override;
const DataType *getDataType() const override;
const TensorDataType& get_tensor_data_type() const { return _dataType; }
TensorFieldValue* clone() const override;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
void printXml(XmlOutputStream& out) const override;
FieldValue &assign(const FieldValue &value) override;
const vespalib::eval::Value *getAsTensorPtr() const {
return _tensor.get();
}
void assignDeserialized(std::unique_ptr<vespalib::eval::Value> rhs);
int compare(const FieldValue& other) const override;
};
} // document
|