diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-27 21:31:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-27 21:31:58 +0200 |
commit | 031e0b85bb6498f3071598a3daaf6bc5721745e1 (patch) | |
tree | d17118e92829506ff1eeccd46163663d87f79787 /searchcore | |
parent | 23e9dd2577e9d5bd32e410e2759a82aad6e185ee (diff) | |
parent | de95c2e46ad17a4d7d959a5c9babb205c29c3265 (diff) |
Merge pull request #22772 from vespa-engine/balder/avoid-identifiable
Avoid using vespalib::Identifiable.
Diffstat (limited to 'searchcore')
6 files changed, 32 insertions, 29 deletions
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index adf0dbf4dcf..b326db47b5c 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -21,11 +21,12 @@ #include <vespa/searchcore/proton/test/threading_service_observer.h> #include <vespa/searchcore/proton/test/transport_helper.h> #include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchlib/index/docbuilder.h> #include <vespa/searchcommon/attribute/config.h> #include <vespa/document/update/documentupdate.h> #include <vespa/document/datatype/documenttype.h> #include <vespa/vespalib/util/destructor_callbacks.h> -#include <vespa/searchlib/index/docbuilder.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/log/log.h> LOG_SETUP("feedview_test"); diff --git a/searchcore/src/tests/proton/index/fusionrunner_test.cpp b/searchcore/src/tests/proton/index/fusionrunner_test.cpp index 1b04415b78f..4a84e3972ad 100644 --- a/searchcore/src/tests/proton/index/fusionrunner_test.cpp +++ b/searchcore/src/tests/proton/index/fusionrunner_test.cpp @@ -1,6 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/file.h> #include <vespa/searchcore/proton/index/indexmanager.h> #include <vespa/searchcore/proton/test/transport_helper.h> #include <vespa/searchcorespi/index/fusionrunner.h> @@ -14,11 +13,13 @@ #include <vespa/searchlib/memoryindex/memory_index.h> #include <vespa/searchlib/query/tree/simplequery.h> #include <vespa/searchlib/test/index/mock_field_length_inspector.h> +#include <vespa/searchlib/queryeval/fake_requestcontext.h> #include <vespa/vespalib/util/gate.h> #include <vespa/vespalib/util/destructor_callbacks.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/size_literals.h> -#include <vespa/searchlib/queryeval/fake_requestcontext.h> +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/fastos/file.h> #include <set> using document::Document; diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp index 6cca28f5b43..60864019419 100644 --- a/searchcore/src/tests/proton/index/indexmanager_test.cpp +++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp @@ -1,6 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/file.h> #include <vespa/searchcore/proton/index/indexmanager.h> #include <vespa/searchcore/proton/test/transport_helper.h> #include <vespa/searchcorespi/index/index_manager_stats.h> @@ -25,6 +24,8 @@ #include <vespa/vespalib/util/gate.h> #include <vespa/vespalib/util/size_literals.h> #include <vespa/vespalib/util/time.h> +#include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/fastos/file.h> #include <set> #include <thread> diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp index e3d0b37c0d6..36b79c7bb8e 100644 --- a/searchcore/src/tests/proton/matching/matching_test.cpp +++ b/searchcore/src/tests/proton/matching/matching_test.cpp @@ -1,10 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/document/base/globalid.h> -#include <vespa/eval/eval/simple_value.h> -#include <vespa/eval/eval/tensor_spec.h> -#include <vespa/eval/eval/value_codec.h> -#include <vespa/searchcommon/attribute/iattributecontext.h> #include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastore.h> #include <vespa/searchcore/proton/matching/fakesearchcontext.h> @@ -34,10 +29,16 @@ #include <vespa/searchlib/query/tree/stackdumpcreator.h> #include <vespa/searchlib/queryeval/isourceselector.h> #include <vespa/searchlib/test/mock_attribute_context.h> +#include <vespa/searchcommon/attribute/iattributecontext.h> +#include <vespa/document/base/globalid.h> +#include <vespa/eval/eval/simple_value.h> +#include <vespa/eval/eval/tensor_spec.h> +#include <vespa/eval/eval/value_codec.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/simple_thread_bundle.h> #include <vespa/vespalib/util/testclock.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <initializer_list> #include <vespa/log/log.h> diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp index 0acd403d73a..eacb4108686 100644 --- a/searchcore/src/tests/proton/matching/query_test.cpp +++ b/searchcore/src/tests/proton/matching/query_test.cpp @@ -27,8 +27,8 @@ #include <vespa/searchlib/queryeval/fake_requestcontext.h> #include <vespa/searchlib/queryeval/termasstring.h> #include <vespa/searchlib/parsequery/stackdumpiterator.h> - #include <vespa/document/datatype/positiondatatype.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/log/log.h> diff --git a/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp index fe29a11639b..e9f6536d50d 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp @@ -24,6 +24,7 @@ #include <vespa/searchlib/attribute/reference_attribute.h> #include <vespa/searchlib/tensor/tensor_attribute.h> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/util/classname.h> #include <sstream> #include <vespa/log/log.h> @@ -31,6 +32,7 @@ LOG_SETUP(".proton.common.attribute_updater"); using namespace document; using vespalib::make_string; +using vespalib::getClassName; using search::tensor::PrepareResult; using search::tensor::TensorAttribute; using search::attribute::ReferenceAttribute; @@ -270,21 +272,20 @@ AttributeUpdater::handleUpdate(AttributeVector & vec, uint32_t lid, const FieldU } } - const vespalib::Identifiable::RuntimeClass &info = vec.getClass(); - if (info.inherits(IntegerAttribute::classId)) { + if (vec.isIntegerType()) { handleUpdateT(static_cast<IntegerAttribute &>(vec), GetLong(), lid, vUp); - } else if (info.inherits(FloatingPointAttribute::classId)) { + } else if (vec.isFloatingPointType()) { handleUpdateT(static_cast<FloatingPointAttribute &>(vec), GetDouble(), lid, vUp); - } else if (info.inherits(StringAttribute::classId)) { + } else if (vec.isStringType()) { handleUpdateT(static_cast<StringAttribute &>(vec), GetString(), lid, vUp); - } else if (info.inherits(PredicateAttribute::classId)) { + } else if (vec.isPredicateType()) { handleUpdate(static_cast<PredicateAttribute &>(vec), lid, vUp); - } else if (info.inherits(TensorAttribute::classId)) { + } else if (vec.isTensorType()) { handleUpdate(static_cast<TensorAttribute &>(vec), lid, vUp); - } else if (info.inherits(ReferenceAttribute::classId)) { + } else if (vec.isReferenceType()) { handleUpdate(static_cast<ReferenceAttribute &>(vec), lid, vUp); } else { - LOG(warning, "Unsupported attribute vector '%s' (classname=%s)", vec.getName().c_str(), info.name()); + LOG(warning, "Unsupported attribute vector '%s' (classname=%s)", vec.getName().c_str(), getClassName(vec).c_str()); return; } } @@ -294,24 +295,23 @@ void AttributeUpdater::handleValue(AttributeVector & vec, uint32_t lid, const FieldValue & val) { LOG(spam, "handleValue(%s, %u): %s", vec.getName().c_str(), lid, toString(val).c_str()); - const vespalib::Identifiable::RuntimeClass & rc = vec.getClass(); - if (rc.inherits(IntegerAttribute::classId)) { + if (vec.isIntegerType()) { handleValueT(static_cast<IntegerAttribute &>(vec), GetLong(), lid, val); - } else if (rc.inherits(FloatingPointAttribute::classId)) { + } else if (vec.isFloatingPointType()) { handleValueT(static_cast<FloatingPointAttribute &>(vec), GetDouble(), lid, val); - } else if (rc.inherits(StringAttribute::classId)) { + } else if (vec.isStringType()) { handleValueT(static_cast<StringAttribute &>(vec), GetString(), lid, val); - } else if (rc.inherits(PredicateAttribute::classId)) { + } else if (vec.isPredicateType()) { // PredicateAttribute is never multivalue. updateValue(static_cast<PredicateAttribute &>(vec), lid, val); - } else if (rc.inherits(TensorAttribute::classId)) { + } else if (vec.isTensorType()) { // TensorAttribute is never multivalue. updateValue(static_cast<TensorAttribute &>(vec), lid, val); - } else if (rc.inherits(ReferenceAttribute::classId)) { + } else if (vec.isReferenceType()) { // ReferenceAttribute is never multivalue. updateValue(static_cast<ReferenceAttribute &>(vec), lid, val); } else { - LOG(warning, "Unsupported attribute vector '%s' (classname=%s)", vec.getName().c_str(), rc.name()); + LOG(warning, "Unsupported attribute vector '%s' (classname=%s)", vec.getName().c_str(), getClassName(vec).c_str()); return; } } @@ -504,11 +504,10 @@ namespace { void validate_tensor_attribute_type(AttributeVector& attr) { - const auto& info = attr.getClass(); - if (!info.inherits(TensorAttribute::classId)) { + if (!attr.isTensorType()) { throw UpdateException( make_string("Expected attribute vector '%s' to be a TensorAttribute, but was '%s'", - attr.getName().c_str(), info.name())); + attr.getName().c_str(), getClassName(attr).c_str())); } } |