diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2017-09-06 16:43:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-06 16:43:01 +0200 |
commit | f0727265fb2a36c1664beca309a7c9aa83dc41ac (patch) | |
tree | a1381da7b97b483e925045c483f5f35b4f9a0912 /searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp | |
parent | 6904c661f29763762c84f672bca812b3339f912e (diff) |
Revert "Use gid to lid change handler interface directly"
Diffstat (limited to 'searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp')
-rw-r--r-- | searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp index 036f482b2e8..270f4d51788 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp @@ -147,5 +147,47 @@ long ImportedAttributeVector::onSerializeForDescendingSort(DocId doc, _reference_attribute->getReferencedLid(doc), serTo, available, bc); } +namespace { + +class ImportedAttributeGuard : public AttributeGuard { +public: + ImportedAttributeGuard(const AttributeVectorSP& target_attr, + const AttributeVectorSP& reference_attr) + : AttributeGuard(), + _target_attr_guard(target_attr), + _reference_attr_guard(reference_attr) + { + } + +private: + AttributeGuard _target_attr_guard; + AttributeGuard _reference_attr_guard; +}; + +class ImportedAttributeEnumGuard : public AttributeEnumGuard { +public: + ImportedAttributeEnumGuard(const AttributeVectorSP& target_attr, + const AttributeVectorSP& reference_attr) + : AttributeEnumGuard(AttributeVectorSP()), + _target_attr_enum_guard(target_attr), + _reference_attr_guard(reference_attr) + { + } + +private: + AttributeEnumGuard _target_attr_enum_guard; + AttributeGuard _reference_attr_guard; +}; + +} + +std::unique_ptr<AttributeGuard> ImportedAttributeVector::acquireGuard() const { + return std::make_unique<ImportedAttributeGuard>(_target_attribute, _reference_attribute); +} + +std::unique_ptr<AttributeEnumGuard> ImportedAttributeVector::acquireEnumGuard() const { + return std::make_unique<ImportedAttributeEnumGuard>(_target_attribute, _reference_attribute); +} + } } |