aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchcommon/attribute/i_multi_value_read_view.h
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-05-20 13:17:27 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-05-20 13:18:51 +0000
commitec9ef7bba03fe9287fe37a8c88f9d025a4b2ef67 (patch)
tree8bc8417e895e509af4b9c333e3ea08525f475736 /searchlib/src/vespa/searchcommon/attribute/i_multi_value_read_view.h
parentf5f7b0cb60569fc05c100a8b83b9fd721ec37183 (diff)
Fold searchcommon into searchlib
Diffstat (limited to 'searchlib/src/vespa/searchcommon/attribute/i_multi_value_read_view.h')
-rw-r--r--searchlib/src/vespa/searchcommon/attribute/i_multi_value_read_view.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchcommon/attribute/i_multi_value_read_view.h b/searchlib/src/vespa/searchcommon/attribute/i_multi_value_read_view.h
new file mode 100644
index 00000000000..8e5005eae8d
--- /dev/null
+++ b/searchlib/src/vespa/searchcommon/attribute/i_multi_value_read_view.h
@@ -0,0 +1,46 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include "multivalue.h"
+#include <vespa/vespalib/datastore/atomic_entry_ref.h>
+#include <vespa/vespalib/util/arrayref.h>
+
+namespace search::attribute {
+
+/**
+ * Read view for the data stored in a multi-value attribute.
+ * @tparam MultiValueType The multi-value type of the data to access.
+ */
+template <typename MultiValueType>
+class IMultiValueReadView {
+public:
+ virtual ~IMultiValueReadView() {}
+ virtual vespalib::ConstArrayRef<MultiValueType> get_values(uint32_t docid) const = 0;
+};
+
+/**
+ * Read view for the raw data stored in an array attribute.
+ * @tparam T The value type of the raw data to access.
+ */
+template <typename T>
+using IArrayReadView = IMultiValueReadView<T>;
+
+/**
+ * Read view for the raw data stored in a weighted set attribute.
+ * @tparam T The value type of the raw data to access.
+ */
+template <typename T>
+using IWeightedSetReadView = IMultiValueReadView<multivalue::WeightedValue<T>>;
+
+/**
+ * Read view for the raw data stored in an enumerated array attribute.
+ */
+using IArrayEnumReadView = IArrayReadView<vespalib::datastore::AtomicEntryRef>;
+
+/**
+ * Read view for the raw data stored in an enumerated weighted set attribute.
+ */
+using IWeightedSetEnumReadView = IWeightedSetReadView<vespalib::datastore::AtomicEntryRef>;
+
+};