diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-04-22 21:14:19 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-04-22 21:56:39 +0000 |
commit | 536432712580828c2288bca71d4b0bb4c4b8ad39 (patch) | |
tree | e1c5097a64921d363d3e228c87e238cfecd39dbf /eval | |
parent | 624c19d3e1dc81e81bd1384e5293fd6f140d23a6 (diff) |
Use explicit and do not expose nbostream in headerfile.
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/vespa/eval/eval/cell_type.h | 6 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/int8float.cpp | 17 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/int8float.h | 12 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/value.h | 7 |
4 files changed, 28 insertions, 14 deletions
diff --git a/eval/src/vespa/eval/eval/cell_type.h b/eval/src/vespa/eval/eval/cell_type.h index 3c474638480..b7063f84a96 100644 --- a/eval/src/vespa/eval/eval/cell_type.h +++ b/eval/src/vespa/eval/eval/cell_type.h @@ -6,8 +6,8 @@ #include <vespa/vespalib/util/bfloat16.h> #include <vespa/vespalib/util/typify.h> #include <vector> -#include <cstdint> #include <cassert> +#include <cstdlib> namespace vespalib::eval { @@ -105,9 +105,9 @@ struct CellMeta { // normalize to make sure scalar values have cell type double static constexpr CellMeta normalize(CellType cell_type, bool is_scalar) { if (is_scalar) { - return CellMeta(CellType::DOUBLE, true); + return {CellType::DOUBLE, true}; } else { - return CellMeta(cell_type, false); + return {cell_type, false}; } } diff --git a/eval/src/vespa/eval/eval/int8float.cpp b/eval/src/vespa/eval/eval/int8float.cpp index 14a8d45c4cd..5e3fab7b615 100644 --- a/eval/src/vespa/eval/eval/int8float.cpp +++ b/eval/src/vespa/eval/eval/int8float.cpp @@ -1,3 +1,20 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "int8float.h" +#include <vespa/vespalib/objects/nbostream.h> + + +namespace vespalib::eval { + +nbostream &operator<<(nbostream &stream, Int8Float v) { + return stream << v.get_bits(); +} + +nbostream &operator>>(nbostream &stream, Int8Float &v) { + int8_t byte; + stream >> byte; + v.assign_bits(byte); + return stream; +} + +} diff --git a/eval/src/vespa/eval/eval/int8float.h b/eval/src/vespa/eval/eval/int8float.h index a503f19fe55..b751b2eb8ad 100644 --- a/eval/src/vespa/eval/eval/int8float.h +++ b/eval/src/vespa/eval/eval/int8float.h @@ -3,7 +3,8 @@ #pragma once #include <cstdint> -#include <vespa/vespalib/objects/nbostream.h> + +namespace vespalib { class nbostream; } namespace vespalib::eval { @@ -35,12 +36,7 @@ public: constexpr void assign_bits(int8_t value) noexcept { _bits = value; } }; -inline nbostream & operator << (nbostream &stream, Int8Float v) { return stream << v.get_bits(); } -inline nbostream & operator >> (nbostream &stream, Int8Float & v) { - int8_t byte; - stream >> byte; - v.assign_bits(byte); - return stream; -} +nbostream & operator << (nbostream &stream, Int8Float v); +nbostream & operator >> (nbostream &stream, Int8Float & v); } diff --git a/eval/src/vespa/eval/eval/value.h b/eval/src/vespa/eval/eval/value.h index 235e7ebb4b4..0f79f94ee7d 100644 --- a/eval/src/vespa/eval/eval/value.h +++ b/eval/src/vespa/eval/eval/value.h @@ -6,6 +6,7 @@ #include "value_type.h" #include "typed_cells.h" #include <vespa/vespalib/util/string_id.h> +#include <memory> namespace vespalib::eval { @@ -16,7 +17,7 @@ struct Value { using UP = std::unique_ptr<Value>; using CREF = std::reference_wrapper<const Value>; virtual const ValueType &type() const = 0; - virtual ~Value() {} + virtual ~Value() = default; // Root lookup structure for mapping labels to dense subspace indexes struct Index { @@ -40,7 +41,7 @@ struct Value { // create_view will be extracted here. virtual bool next_result(ConstArrayRef<string_id*> addr_out, size_t &idx_out) = 0; - virtual ~View() {} + virtual ~View() = default; }; // total number of mappings (equal to the number of dense subspaces) @@ -50,7 +51,7 @@ struct Value { // labels from a subset of the mapped dimensions. virtual std::unique_ptr<View> create_view(ConstArrayRef<size_t> dims) const = 0; - virtual ~Index() {} + virtual ~Index() = default; }; virtual TypedCells cells() const = 0; virtual const Index &index() const = 0; |