summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorGeir Storli <geirst@oath.com>2018-04-19 11:53:50 +0000
committerGeir Storli <geirst@oath.com>2018-04-19 11:56:30 +0000
commit33ef61f554a5768c4457e78207c689fbf5661220 (patch)
treeb33ee25db5ff23fb800badd1fc47bd78309b1b55 /searchcommon
parent939a0c130bbcea1cc5fb743711c7a021f467fcae (diff)
Add type-safe down-cast to ITensorAttribute in IAttributeVector and use this instead of dynamic_cast.
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/iattributevector.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
index f8ab03fdabb..26322e78480 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
@@ -12,6 +12,10 @@ namespace search {
class IDocumentWeightAttribute;
class QueryTermSimple;
+namespace tensor {
+class ITensorAttribute;
+}
+
namespace attribute {
class ISearchContext;
@@ -273,6 +277,13 @@ public:
virtual const IDocumentWeightAttribute *asDocumentWeightAttribute() const = 0;
/**
+ * Type-safe down-cast to a tensor attribute.
+ *
+ * @return tensor attribute or nullptr if not supported.
+ */
+ virtual const tensor::ITensorAttribute *asTensorAttribute() const = 0;
+
+ /**
* Returns the basic type of this attribute vector.
*
* @return basic type