summaryrefslogtreecommitdiffstats
path: root/eval
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-04-25 12:18:20 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2024-04-25 12:18:20 +0000
commit34d83ef767f1e9378395e87d55617878ef150f38 (patch)
treec7dda0244551fad398e837c9540efa2f57f993e0 /eval
parentf4207b32a6a64549408d63fb09326634370326c3 (diff)
Use non_existing_attribute_value to signal that value is the default value for an attribute that has not been set.
Diffstat (limited to 'eval')
-rw-r--r--eval/src/vespa/eval/eval/typed_cells.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/eval/src/vespa/eval/eval/typed_cells.h b/eval/src/vespa/eval/eval/typed_cells.h
index 3dd8c30a3a9..7aa7debff30 100644
--- a/eval/src/vespa/eval/eval/typed_cells.h
+++ b/eval/src/vespa/eval/eval/typed_cells.h
@@ -11,7 +11,8 @@ namespace vespalib::eval {
struct TypedCells {
const void *data;
- size_t size:56;
+ size_t size:55;
+ bool _non_existing_attribute_value:1;
CellType type;
explicit TypedCells(ConstArrayRef<double> cells) noexcept : data(cells.begin()), size(cells.size()), type(CellType::DOUBLE) {}
@@ -22,6 +23,12 @@ struct TypedCells {
TypedCells() noexcept : data(nullptr), size(0), type(CellType::DOUBLE) {}
TypedCells(const void *dp, CellType ct, size_t sz) noexcept : data(dp), size(sz), type(ct) {}
+ static TypedCells create_non_existing_attribute_value(const void *dp, CellType ct, size_t sz) {
+ TypedCells cells(dp, ct, sz);
+ cells._non_existing_attribute_value = true;
+ return cells;
+ }
+
template <typename T> bool check_type() const noexcept { return check_cell_type<T>(type); }
template <typename T> ConstArrayRef<T> typify() const noexcept {
@@ -36,7 +43,13 @@ struct TypedCells {
TypedCells(const TypedCells &other) noexcept = default;
TypedCells & operator= (TypedCells &&other) noexcept = default;
TypedCells & operator= (const TypedCells &other) noexcept = default;
- bool valid() const noexcept { return size != 0; }
+ /**
+ * This signals that this actually points to a value that is the default value
+ * when no value has set for the attribute.
+ * TODO: This does not belong here, but as it is used as an interface multiple places it must be so
+ * until we come up with a better solution.
+ */
+ bool non_existing_attribute_value() const noexcept { return _non_existing_attribute_value; }
};
} // namespace