blob: 455f20147b59de2793fa2be746269b29d675d60a (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "value_builder_factory.h"
namespace vespalib::eval {
/**
* A trivial builder for DoubleValue objects
**/
class DoubleValueBuilder : public ValueBuilder<double>
{
private:
double _value;
public:
DoubleValueBuilder() : _value(0.0) {}
~DoubleValueBuilder() override;
ArrayRef<double>
add_subspace(ConstArrayRef<vespalib::stringref>) override {
return ArrayRef<double>(&_value, 1);
}
std::unique_ptr<Value>
build(std::unique_ptr<ValueBuilder<double>>) override {
return std::make_unique<DoubleValue>(_value);
}
};
} // namespace
|