diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-03-17 20:26:58 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-03-17 20:26:58 +0000 |
commit | 2974fb58ddc245e94f325eb6b1407c16bd6887bc (patch) | |
tree | 6c80d1d1e35151c7b460d0ecd157c91b9af09836 | |
parent | f5d308f5cb8bd1f5a4d7daaac18ed1aaa8e8778e (diff) |
Implement className on document::FieldValue
20 files changed, 82 insertions, 48 deletions
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp index 465847c1221..be3a0dd3cb6 100644 --- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp @@ -26,6 +26,50 @@ namespace document { using namespace fieldvalue; +const char * +FieldValue::className() const noexcept { + switch (type()) { + case Type::BOOL: + return "BoolFieldValue"; + case Type::BYTE: + return "ByteFieldValue"; + case Type::SHORT: + return "ShortFieldValue"; + case Type::INT: + return "IntFieldValue"; + case Type::LONG: + return "LongFieldValue"; + case Type::FLOAT: + return "FloatFieldValue"; + case Type::DOUBLE: + return "DoubleFieldValue"; + case Type::STRING: + return "StringFieldValue"; + case Type::RAW: + return "RawFieldValue"; + case Type::PREDICATE: + return "PredicateFieldValue"; + case Type::TENSOR: + return "TensorFieldValue"; + case Type::ANNOTATION_REFERENCE: + return "AnnotationReferenceFieldValue"; + case Type::REFERENCE: + return "ReferenceFieldValue"; + case Type::ARRAY: + return "ArrayFieldValue"; + case Type::WSET: + return "WSetFieldValue"; + case Type::MAP: + return "MapFieldValue"; + case Type::STRUCT: + return "StructFieldValue"; + case Type::DOCUMENT: + return "DocumentFieldValue"; + case Type::NONE: + default: + return "NONE - Impossible"; + } +} void FieldValue::serialize(nbostream &stream) const { VespaDocumentSerializer serializer(stream); serializer.write(*this); diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.h b/document/src/vespa/document/fieldvalue/fieldvalue.h index 976f060f192..4f589913a4d 100644 --- a/document/src/vespa/document/fieldvalue/fieldvalue.h +++ b/document/src/vespa/document/fieldvalue/fieldvalue.h @@ -30,7 +30,11 @@ class DataType; class FieldValue { public: - enum class Type : uint8_t {NONE,BOOL, BYTE, SHORT, INT, LONG, FLOAT, DOUBLE, STRING, RAW, PREDICATE, TENSOR, ANNOTATION_REFERENCE, REFERENCE, ARRAY, WSET, MAP, STRUCT, DOCUMENT}; + enum class Type : uint8_t { + NONE, BOOL, BYTE, SHORT, INT, LONG, FLOAT, DOUBLE, + STRING, RAW, PREDICATE, TENSOR, ANNOTATION_REFERENCE, + REFERENCE, ARRAY, WSET, MAP, STRUCT, DOCUMENT + }; using PathRange = FieldPath::Range<FieldPath::const_iterator>; using UP = std::unique_ptr<FieldValue>; using SP = std::shared_ptr<FieldValue>; @@ -180,6 +184,7 @@ public: bool isFixedSizeSingleValue() const noexcept { return (_type == Type::BOOL) || isNumeric(); } + const char * className() const noexcept; protected: FieldValue(Type type) noexcept : _type(type) { } FieldValue(const FieldValue&) = default; diff --git a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp index 66cfbc42c07..94f2ddc994f 100644 --- a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp @@ -174,7 +174,7 @@ FieldValue & TensorFieldValue::assign(const FieldValue &value) { if (value.isA(Type::TENSOR)) { - auto rhs = static_cast<const TensorFieldValue *>(&value); + const auto * rhs = static_cast<const TensorFieldValue *>(&value); *this = *rhs; } else { return FieldValue::assign(value); diff --git a/document/src/vespa/document/update/addfieldpathupdate.cpp b/document/src/vespa/document/update/addfieldpathupdate.cpp index cff38c246e4..bd06451759e 100644 --- a/document/src/vespa/document/update/addfieldpathupdate.cpp +++ b/document/src/vespa/document/update/addfieldpathupdate.cpp @@ -7,7 +7,6 @@ #include <vespa/document/serialization/vespadocumentdeserializer.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/exceptions.h> -#include <vespa/vespalib/util/classname.h> #include <ostream> #include <cassert> @@ -60,7 +59,7 @@ AddIteratorHandler::doModify(FieldValue &fv) { cf.add(_values[i]); } } else { - vespalib::string err = make_string("Unable to add a value to a \"%s\" field value.", vespalib::getClassName(fv).c_str()); + vespalib::string err = make_string("Unable to add a value to a \"%s\" field value.", fv.className()); throw vespalib::IllegalArgumentException(err, VESPA_STRLOC); } return ModificationStatus::MODIFIED; diff --git a/document/src/vespa/document/update/addvalueupdate.cpp b/document/src/vespa/document/update/addvalueupdate.cpp index 6fda6ddc362..6f6c9a93738 100644 --- a/document/src/vespa/document/update/addvalueupdate.cpp +++ b/document/src/vespa/document/update/addvalueupdate.cpp @@ -7,7 +7,6 @@ #include <vespa/document/util/serializableexceptions.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/xmlstream.h> -#include <vespa/vespalib/util/classname.h> #include <ostream> using vespalib::IllegalArgumentException; @@ -71,7 +70,7 @@ AddValueUpdate::applyTo(FieldValue& value) const WeightedSetFieldValue& doc(static_cast<WeightedSetFieldValue&>(value)); doc.add(*_value, _weight); } else { - vespalib::string err = make_string("Unable to add a value to a \"%s\" field value.", vespalib::getClassName(value).c_str()); + vespalib::string err = make_string("Unable to add a value to a \"%s\" field value.", value.className()); throw IllegalStateException(err, VESPA_STRLOC); } return true; diff --git a/document/src/vespa/document/update/arithmeticvalueupdate.cpp b/document/src/vespa/document/update/arithmeticvalueupdate.cpp index 7500e28ce07..e5fb5aee8af 100644 --- a/document/src/vespa/document/update/arithmeticvalueupdate.cpp +++ b/document/src/vespa/document/update/arithmeticvalueupdate.cpp @@ -4,7 +4,6 @@ #include <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/xmlstream.h> -#include <vespa/vespalib/util/classname.h> #include <ostream> using vespalib::IllegalArgumentException; @@ -62,7 +61,7 @@ ArithmeticValueUpdate::applyTo(FieldValue& value) const } else { vespalib::string err = vespalib::make_string( "Unable to perform an arithmetic update on a \"%s\" field " - "value.", vespalib::getClassName(value).c_str()); + "value.", value.className()); throw IllegalStateException(err, VESPA_STRLOC); } return true; diff --git a/document/src/vespa/document/update/assignfieldpathupdate.cpp b/document/src/vespa/document/update/assignfieldpathupdate.cpp index 6f2bbfd89c4..d4cbff2aae9 100644 --- a/document/src/vespa/document/update/assignfieldpathupdate.cpp +++ b/document/src/vespa/document/update/assignfieldpathupdate.cpp @@ -7,7 +7,6 @@ #include <vespa/document/serialization/vespadocumentdeserializer.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/exceptions.h> -#include <vespa/vespalib/util/classname.h> #include <boost/numeric/conversion/cast.hpp> #include <ostream> @@ -118,8 +117,7 @@ AssignValueIteratorHandler::doModify(FieldValue& fv) { if (!(*fv.getDataType() == *_newValue.getDataType())) { vespalib::string err = vespalib::make_string( "Trying to assign \"%s\" of type %s to an instance of type %s", - _newValue.toString().c_str(), vespalib::getClassName(_newValue).c_str(), - vespalib::getClassName(fv).c_str()); + _newValue.toString().c_str(), _newValue.className(), fv.className()); throw vespalib::IllegalArgumentException(err, VESPA_STRLOC); } if (_removeIfZero diff --git a/document/src/vespa/document/update/assignvalueupdate.cpp b/document/src/vespa/document/update/assignvalueupdate.cpp index 0f355434f08..cf2321dbf56 100644 --- a/document/src/vespa/document/update/assignvalueupdate.cpp +++ b/document/src/vespa/document/update/assignvalueupdate.cpp @@ -7,7 +7,6 @@ #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/xmlstream.h> -#include <vespa/vespalib/util/classname.h> #include <ostream> using vespalib::IllegalArgumentException; @@ -72,7 +71,7 @@ AssignValueUpdate::applyTo(FieldValue& value) const !value.getDataType()->isValueType(*_value))) { vespalib::string err = vespalib::make_string( "Unable to assign a \"%s\" value to a \"%s\" field value.", - vespalib::getClassName(*_value).c_str(), vespalib::getClassName(value).c_str()); + _value->className(), value.className()); throw IllegalStateException(err, VESPA_STRLOC); } if (_value) { diff --git a/document/src/vespa/document/update/mapvalueupdate.cpp b/document/src/vespa/document/update/mapvalueupdate.cpp index 684ff1fb6e4..48e52a9d2cc 100644 --- a/document/src/vespa/document/update/mapvalueupdate.cpp +++ b/document/src/vespa/document/update/mapvalueupdate.cpp @@ -44,7 +44,7 @@ MapValueUpdate::checkCompatibility(const Field& field) const { // Check compatibility of nested types. if (field.getDataType().isArray()) { - if (_key->type() != FieldValue::Type::INT) { + if ( !_key->isA(FieldValue::Type::INT)) { throw IllegalArgumentException(vespalib::make_string( "Key for field '%s' is of wrong type (expected '%s', was '%s').", field.getName().data(), DataType::INT->toString().c_str(), @@ -60,7 +60,7 @@ MapValueUpdate::checkCompatibility(const Field& field) const } } else { throw IllegalArgumentException("MapValueUpdate does not support " - "datatype " + field.getDataType().toString() + ".", VESPA_STRLOC); + "datatype " + field.getDataType().toString() + ".", VESPA_STRLOC); } } diff --git a/document/src/vespa/document/update/removevalueupdate.cpp b/document/src/vespa/document/update/removevalueupdate.cpp index fda3b09163f..a61553da4d1 100644 --- a/document/src/vespa/document/update/removevalueupdate.cpp +++ b/document/src/vespa/document/update/removevalueupdate.cpp @@ -7,7 +7,6 @@ #include <vespa/vespalib/objects/nbostream.h> #include <vespa/document/util/serializableexceptions.h> #include <vespa/vespalib/util/xmlstream.h> -#include <vespa/vespalib/util/classname.h> #include <ostream> using vespalib::IllegalArgumentException; @@ -64,7 +63,7 @@ RemoveValueUpdate::applyTo(FieldValue& value) const WeightedSetFieldValue& doc(static_cast<WeightedSetFieldValue&>(value)); doc.remove(*_key); } else { - std::string err = vespalib::make_string("Unable to remove a value from a \"%s\" field value.", vespalib::getClassName(value).c_str()); + std::string err = vespalib::make_string("Unable to remove a value from a \"%s\" field value.", value.className()); throw IllegalStateException(err, VESPA_STRLOC); } return true; diff --git a/document/src/vespa/document/update/tensor_add_update.cpp b/document/src/vespa/document/update/tensor_add_update.cpp index 2474429f2a9..1f8aed2d8b4 100644 --- a/document/src/vespa/document/update/tensor_add_update.cpp +++ b/document/src/vespa/document/update/tensor_add_update.cpp @@ -13,7 +13,6 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/xmlstream.h> -#include <vespa/vespalib/util/classname.h> #include <ostream> using vespalib::IllegalArgumentException; @@ -109,7 +108,7 @@ TensorAddUpdate::applyTo(FieldValue& value) const } } else { vespalib::string err = make_string("Unable to perform a tensor add update on a '%s' field value", - vespalib::getClassName(value).c_str()); + value.className()); throw IllegalStateException(err, VESPA_STRLOC); } return true; @@ -139,7 +138,7 @@ TensorAddUpdate::deserialize(const DocumentTypeRepo &repo, const DataType &type, _tensor.reset(static_cast<TensorFieldValue *>(tensor.release())); } else { vespalib::string err = make_string("Expected tensor field value, got a '%s' field value", - vespalib::getClassName(*tensor).c_str()); + tensor->className()); throw IllegalStateException(err, VESPA_STRLOC); } VespaDocumentDeserializer deserializer(repo, stream, Document::getNewestSerializationVersion()); diff --git a/document/src/vespa/document/update/tensor_modify_update.cpp b/document/src/vespa/document/update/tensor_modify_update.cpp index 9cfb38e70e2..49ea57f28c1 100644 --- a/document/src/vespa/document/update/tensor_modify_update.cpp +++ b/document/src/vespa/document/update/tensor_modify_update.cpp @@ -15,7 +15,6 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/xmlstream.h> -#include <vespa/vespalib/util/classname.h> #include <ostream> using vespalib::IllegalArgumentException; @@ -189,7 +188,7 @@ TensorModifyUpdate::applyTo(FieldValue& value) const } } else { vespalib::string err = make_string("Unable to perform a tensor modify update on a '%s' field value", - vespalib::getClassName(value).c_str()); + value.className()); throw IllegalStateException(err, VESPA_STRLOC); } return true; @@ -246,7 +245,7 @@ TensorModifyUpdate::deserialize(const DocumentTypeRepo &repo, const DataType &ty _tensor.reset(static_cast<TensorFieldValue *>(tensor.release())); } else { vespalib::string err = make_string("Expected tensor field value, got a '%s' field value", - vespalib::getClassName(*tensor).c_str()); + tensor->className()); throw IllegalStateException(err, VESPA_STRLOC); } VespaDocumentDeserializer deserializer(repo, stream, Document::getNewestSerializationVersion()); diff --git a/document/src/vespa/document/update/tensor_remove_update.cpp b/document/src/vespa/document/update/tensor_remove_update.cpp index f1f4becb285..f2d11ef8234 100644 --- a/document/src/vespa/document/update/tensor_remove_update.cpp +++ b/document/src/vespa/document/update/tensor_remove_update.cpp @@ -10,7 +10,6 @@ #include <vespa/eval/eval/fast_value.h> #include <vespa/eval/eval/value.h> #include <vespa/vespalib/util/xmlstream.h> -#include <vespa/vespalib/util/classname.h> #include <ostream> using vespalib::IllegalArgumentException; @@ -134,7 +133,7 @@ TensorRemoveUpdate::applyTo(FieldValue &value) const } } else { vespalib::string err = make_string("Unable to perform a tensor remove update on a '%s' field value", - vespalib::getClassName(value).c_str()); + value.className()); throw IllegalStateException(err, VESPA_STRLOC); } return true; diff --git a/document/src/vespa/document/update/valueupdate.h b/document/src/vespa/document/update/valueupdate.h index 8564e81f777..ec903c1adc1 100644 --- a/document/src/vespa/document/update/valueupdate.h +++ b/document/src/vespa/document/update/valueupdate.h @@ -33,7 +33,7 @@ class DataType; class ValueUpdate : public vespalib::Identifiable, public Printable, -public vespalib::xml::XmlSerializable + public vespalib::xml::XmlSerializable { protected: using nbostream = vespalib::nbostream; diff --git a/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp index be25a374754..5b134c65e84 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/attribute_updater.cpp @@ -24,7 +24,6 @@ #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> @@ -145,7 +144,7 @@ AttributeUpdater::handleUpdateT(V & vec, Accessor, uint32_t lid, const ValueUpda appendValue(vec, lid, ac); } else { LOG(warning, "Unsupported value %s in assign operation on multivalue vector %s", - vespalib::getClassName(fv).c_str(), vec.getName().c_str()); + fv.className(), vec.getName().c_str()); } } } else if (op == ValueUpdate::Add) { @@ -158,7 +157,7 @@ AttributeUpdater::handleUpdateT(V & vec, Accessor, uint32_t lid, const ValueUpda const MapValueUpdate & map(static_cast<const MapValueUpdate &>(upd)); if (!vec.AttributeVector::apply(lid, map)) { throw UpdateException(make_string("attribute map(%s, %s) failed: %s[%u]", - vespalib::getClassName(map.getKey()).c_str(), map.getUpdate().getClass().name(), + map.getKey().className(), map.getUpdate().getClass().name(), vec.getName().c_str(), lid)); } } else { @@ -330,7 +329,7 @@ AttributeUpdater::handleValueT(V & vec, Accessor, uint32_t lid, const FieldValue WeightedSetAccessor<Accessor> ac(static_cast<const WeightedSetFieldValue & >(val)); appendValue(vec, lid, ac); } else { - LOG(warning, "Unsupported value '%s' to assign on multivalue vector '%s'", vespalib::getClassName(val).c_str(), vec.getName().c_str()); + LOG(warning, "Unsupported value '%s' to assign on multivalue vector '%s'", val.className(), vec.getName().c_str()); } } else { updateValue(vec, lid, val); diff --git a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp index d0602a89089..91e5a36a7cf 100644 --- a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp @@ -6,7 +6,6 @@ #include <vespa/document/datatype/documenttype.h> #include <vespa/vespalib/encoding/base64.h> #include <vespa/vespalib/locale/c.h> -#include <vespa/vespalib/util/classname.h> #include <vespa/log/log.h> LOG_SETUP(".searchlib.documentfieldnode"); @@ -99,11 +98,11 @@ deduceResultNode(vespalib::stringref fieldName, const FieldValue & fv, bool pres value.reset(new RawResultNodeVector()); } else { throw std::runtime_error(make_string("Can not deduce correct resultclass for documentfield '%s' in based on class '%s'. It nests down to %s which is not expected", - vespalib::string(fieldName).c_str(), vespalib::getClassName(fv).c_str(), rInfo.name())); + vespalib::string(fieldName).c_str(), fv.className(), rInfo.name())); } } else { throw std::runtime_error(make_string("Can not deduce correct resultclass for documentfield '%s' in based on class '%s'", - vespalib::string(fieldName).c_str(), vespalib::getClassName(fv).c_str())); + vespalib::string(fieldName).c_str(), fv.className())); } return value; } diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_inverter.cpp b/searchlib/src/vespa/searchlib/memoryindex/field_inverter.cpp index d79465885f1..5a7d0e60153 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/field_inverter.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/field_inverter.cpp @@ -18,7 +18,6 @@ #include <vespa/searchlib/util/url.h> #include <vespa/vespalib/text/utf8.h> #include <vespa/vespalib/util/stringfmt.h> -#include <vespa/vespalib/util/classname.h> #include <vespa/vespalib/stllike/hash_map.hpp> #include <stdexcept> @@ -475,7 +474,7 @@ FieldInverter::invertNormalDocTextField(const FieldValue &val) throw std::runtime_error(make_string("Expected DataType::STRING, got '%s'", wset.getNestedType().getName().c_str())); } } else { - throw std::runtime_error(make_string("Expected weighted set, got '%s'", vespalib::getClassName(val).c_str())); + throw std::runtime_error(make_string("Expected weighted set, got '%s'", val.className())); } break; case CollectionType::ARRAY: @@ -487,7 +486,7 @@ FieldInverter::invertNormalDocTextField(const FieldValue &val) throw std::runtime_error(make_string("Expected DataType::STRING, got '%s'", arr.getNestedType().getName().c_str())); } } else { - throw std::runtime_error(make_string("Expected Array, got '%s'", vespalib::getClassName(val).c_str())); + throw std::runtime_error(make_string("Expected Array, got '%s'", val.className())); } break; default: diff --git a/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.cpp b/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.cpp index 69120c901f7..87bcdd31933 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/url_field_inverter.cpp @@ -160,7 +160,7 @@ UrlFieldInverter::processUrlField(const FieldValue &url_field) processUrlOldStyle(url_str); return; } - assert(url_field.type() == FieldValue::Type::STRUCT); + assert(url_field.isA(FieldValue::Type::STRUCT)); const auto &field = static_cast<const StructFieldValue &>(url_field); const FieldValue::UP all_val = field.getValue("all"); @@ -274,7 +274,7 @@ UrlFieldInverter::processWeightedSetUrlField(const WeightedSetFieldValue &field) for (const auto & el : field) { const FieldValue &key = *el.first; const FieldValue &xweight = *el.second; - assert(xweight.type() == FieldValue::Type::INT); + assert(xweight.isA(FieldValue::Type::INT)); int32_t weight = xweight.getAsInt(); startElement(weight); processUrlField(key); diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp index 80cf0ebc73d..1e091d9a6d8 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp @@ -16,7 +16,6 @@ #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/size_literals.h> -#include <vespa/vespalib/util/classname.h> #include <vespa/fnet/databuffer.h> #include "matching_elements_filler.h" @@ -73,7 +72,7 @@ createMultiValueAttribute(const vespalib::string & name, const document::FieldVa ndt = &cdt->getNestedType(); } LOG(debug, "Create %s attribute '%s' with data type '%s' (%s)", - arrayType ? "array" : "weighted set", name.c_str(), ndt->getName().c_str(), vespalib::getClassName(fv).c_str()); + arrayType ? "array" : "weighted set", name.c_str(), ndt->getName().c_str(), fv.className()); if (ndt->getId() == DataType::T_BYTE || ndt->getId() == DataType::T_INT || ndt->getId() == DataType::T_LONG) @@ -90,7 +89,7 @@ createMultiValueAttribute(const vespalib::string & name, const document::FieldVa : std::make_shared<search::WeightedSetStringExtAttribute>(name); } else { LOG(debug, "Can not make an multivalue attribute out of %s with data type '%s' (%s)", - name.c_str(), ndt->getName().c_str(), vespalib::getClassName(fv).c_str()); + name.c_str(), ndt->getName().c_str(), fv.className()); } return AttributeVector::SP(); } @@ -98,7 +97,7 @@ createMultiValueAttribute(const vespalib::string & name, const document::FieldVa AttributeVector::SP createAttribute(const vespalib::string & name, const document::FieldValue & fv) { - LOG(debug, "Create single value attribute '%s' with value type '%s'", name.c_str(), vespalib::getClassName(fv).c_str()); + LOG(debug, "Create single value attribute '%s' with value type '%s'", name.c_str(), fv.className()); if (fv.isA(document::FieldValue::Type::BYTE) || fv.isA(document::FieldValue::Type::INT) || fv.isA(document::FieldValue::Type::LONG)) { return std::make_shared<search::SingleIntegerExtAttribute>(name); } else if (fv.isA(document::FieldValue::Type::DOUBLE) || fv.isA(document::FieldValue::Type::FLOAT)) { @@ -106,7 +105,7 @@ createAttribute(const vespalib::string & name, const document::FieldValue & fv) } else if (fv.isA(document::FieldValue::Type::STRING)) { return std::make_shared<search::SingleStringExtAttribute>(name); } else { - LOG(debug, "Can not make an attribute out of %s of type '%s'.", name.c_str(), vespalib::getClassName(fv).c_str()); + LOG(debug, "Can not make an attribute out of %s of type '%s'.", name.c_str(), fv.className()); } return AttributeVector::SP(); } @@ -762,14 +761,14 @@ void SearchVisitor::setupAttributeVector(const FieldPath &fieldPath) { if (attr) { LOG(debug, "Adding attribute '%s' for field '%s' with data type '%s' (%s)", - attr->getName().c_str(), attrName.c_str(), fv.getDataType()->getName().c_str(), vespalib::getClassName(fv).c_str()); + attr->getName().c_str(), attrName.c_str(), fv.getDataType()->getName().c_str(), fv.className()); if ( ! _attrMan.add(attr) ) { LOG(warning, "Failed adding attribute '%s' for field '%s' with data type '%s' (%s)", - attr->getName().c_str(), attrName.c_str(), fv.getDataType()->getName().c_str(), vespalib::getClassName(fv).c_str()); + attr->getName().c_str(), attrName.c_str(), fv.getDataType()->getName().c_str(), fv.className()); } } else { LOG(debug, "Cannot setup attribute for field '%s' with data type '%s' (%s). Aggregation and sorting will not work for this field", - attrName.c_str(), fv.getDataType()->getName().c_str(), vespalib::getClassName(fv).c_str()); + attrName.c_str(), fv.getDataType()->getName().c_str(), fv.className()); } } diff --git a/vsm/src/vespa/vsm/vsm/slimefieldwriter.cpp b/vsm/src/vespa/vsm/vsm/slimefieldwriter.cpp index 7c7d0cffbcc..5bc5798fb9d 100644 --- a/vsm/src/vespa/vsm/vsm/slimefieldwriter.cpp +++ b/vsm/src/vespa/vsm/vsm/slimefieldwriter.cpp @@ -4,7 +4,6 @@ #include <vespa/searchlib/util/slime_output_raw_buf_adapter.h> #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/size_literals.h> -#include <vespa/vespalib/util/classname.h> #include <vespa/searchsummary/docsummary/resultconfig.h> #include <vespa/document/datatype/positiondatatype.h> @@ -50,7 +49,7 @@ void SlimeFieldWriter::traverseRecursive(const document::FieldValue & fv, Inserter &inserter) { LOG(debug, "traverseRecursive: class(%s), fieldValue(%s), currentPath(%s)", - vespalib::getClassName(fv).c_str(), fv.toString().c_str(), toString(_currPath).c_str()); + fv.className(), fv.toString().c_str(), toString(_currPath).c_str()); if (fv.isCollection()) { const document::CollectionFieldValue & cfv = static_cast<const document::CollectionFieldValue &>(fv); |