diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-07-29 16:44:12 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-07-29 16:44:12 +0000 |
commit | be17ee4814759d9881274584d5d48b0f97818db8 (patch) | |
tree | c07f04187036146ad66c496b7ca31bf1da4b60d4 /searchlib/src | |
parent | e64d77fb801fc3450b0828c2186273936c2946e2 (diff) |
get_raw -> get_bound
Diffstat (limited to 'searchlib/src')
-rw-r--r-- | searchlib/src/vespa/searchlib/features/attributefeature.cpp | 8 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/fef/featureexecutor.h | 10 |
2 files changed, 10 insertions, 8 deletions
diff --git a/searchlib/src/vespa/searchlib/features/attributefeature.cpp b/searchlib/src/vespa/searchlib/features/attributefeature.cpp index 45ecac90e9d..1727a59bc0d 100644 --- a/searchlib/src/vespa/searchlib/features/attributefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/attributefeature.cpp @@ -201,7 +201,7 @@ SingleAttributeExecutor<T>::execute(uint32_t docId) { typename T::LoadedValueType v = _attribute.getFast(docId); // value - fef::NumberOrObject * o = outputs().get_raw(0); + auto o = outputs().get_bound(); o[0].as_number = __builtin_expect(attribute::isUndefined(v), false) ? attribute::getUndefined<feature_t>() : util::getAsFeature(v); @@ -217,7 +217,7 @@ MultiAttributeExecutor<T>::execute(uint32_t docId) const multivalue::Value<typename T::BaseType> * values = nullptr; uint32_t numValues = _attribute.getRawValues(docId, values); - fef::NumberOrObject * o = outputs().get_raw(0); + auto o = outputs().get_bound(); o[0].as_number = __builtin_expect(_idx < numValues, true) ? values[_idx].value() : 0; o[1].as_number = 0; // weight o[2].as_number = 0; // contains @@ -227,7 +227,7 @@ MultiAttributeExecutor<T>::execute(uint32_t docId) void CountOnlyAttributeExecutor::execute(uint32_t docId) { - fef::NumberOrObject * o = outputs().get_raw(0); + auto o = outputs().get_bound(); o[0].as_number = 0; // value o[1].as_number = 0; // weight o[2].as_number = 0; // contains @@ -255,7 +255,7 @@ AttributeExecutor<T>::execute(uint32_t docId) if (_idx < _buffer.size()) { value = considerUndefined(_buffer[_idx], _attrType); } - fef::NumberOrObject * o = outputs().get_raw(0); + auto o = outputs().get_bound(); o[0].as_number = value; // value o[1].as_number = 0; // weight o[2].as_number = 0; // contains diff --git a/searchlib/src/vespa/searchlib/fef/featureexecutor.h b/searchlib/src/vespa/searchlib/fef/featureexecutor.h index fd36fbe5a20..1e52aaee8ad 100644 --- a/searchlib/src/vespa/searchlib/fef/featureexecutor.h +++ b/searchlib/src/vespa/searchlib/fef/featureexecutor.h @@ -58,10 +58,10 @@ public: }; class Outputs { - vespalib::ArrayRef<NumberOrObject> _outputs; public: + using OutputArray = vespalib::ArrayRef<NumberOrObject>; Outputs() : _outputs() {} - void bind(vespalib::ArrayRef<NumberOrObject> outputs) { _outputs = outputs; } + void bind(OutputArray outputs) { _outputs = outputs; } void set_number(size_t idx, feature_t value) { _outputs[idx].as_number = value; } @@ -83,10 +83,12 @@ public: const NumberOrObject *get_raw(size_t idx) const { return &_outputs[idx]; } - NumberOrObject *get_raw(size_t idx) { - return &_outputs[idx]; + OutputArray get_bound() const { + return _outputs; } size_t size() const { return _outputs.size(); } + private: + vespalib::ArrayRef<NumberOrObject> _outputs; }; private: |