summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-11-07 20:38:52 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-11-09 10:33:49 +0000
commit01cce7fcf6a68f268c8a61e93ea4a0d76a775954 (patch)
tree4a881b9fc4888f02cce5f1d02f9b3897820ba116 /document
parentdc50de961734b229cd4bcb0fb6e515d94df82202 (diff)
Removed unused IFieldBase of Serializer/Deserializer interface.
Many years ago there were a big plan. But it went nowehere. So let us GC it instead of lying around polluting and bloating the code.
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/documentupdatetestcase.cpp22
-rw-r--r--document/src/tests/fieldsettest.cpp2
-rw-r--r--document/src/vespa/document/base/field.cpp6
-rw-r--r--document/src/vespa/document/base/field.h10
-rw-r--r--document/src/vespa/document/base/fieldpath.cpp3
-rw-r--r--document/src/vespa/document/base/fieldpath.h4
-rw-r--r--document/src/vespa/document/fieldvalue/fieldvalue.cpp1
-rw-r--r--document/src/vespa/document/update/fieldupdate.cpp1
-rw-r--r--document/src/vespa/document/update/fieldupdate.h4
9 files changed, 24 insertions, 29 deletions
diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp
index 1863194ab73..5fd62957f65 100644
--- a/document/src/tests/documentupdatetestcase.cpp
+++ b/document/src/tests/documentupdatetestcase.cpp
@@ -467,28 +467,28 @@ TEST(DocumentUpdateTest, testReadSerializedFile)
EXPECT_EQ(*type, upd.getType());
// Verify assign value update.
- FieldUpdate serField = upd.getUpdates()[1];
- EXPECT_EQ(serField.getField().getId(), type->getField("intfield").getId());
+ const FieldUpdate & serField1 = upd.getUpdates()[1];
+ EXPECT_EQ(serField1.getField().getId(), type->getField("intfield").getId());
- const ValueUpdate* serValue = &serField[0];
+ const ValueUpdate* serValue = &serField1[0];
ASSERT_EQ(serValue->getType(), ValueUpdate::Assign);
const AssignValueUpdate* assign(static_cast<const AssignValueUpdate*>(serValue));
EXPECT_EQ(IntFieldValue(4), static_cast<const IntFieldValue&>(assign->getValue()));
// Verify clear field update.
- serField = upd.getUpdates()[2];
- EXPECT_EQ(serField.getField().getId(), type->getField("floatfield").getId());
+ const FieldUpdate & serField2 = upd.getUpdates()[2];
+ EXPECT_EQ(serField2.getField().getId(), type->getField("floatfield").getId());
- serValue = &serField[0];
+ serValue = &serField2[0];
EXPECT_EQ(serValue->getType(), ValueUpdate::Clear);
EXPECT_TRUE(serValue->inherits(ClearValueUpdate::classId));
// Verify add value update.
- serField = upd.getUpdates()[0];
- EXPECT_EQ(serField.getField().getId(), type->getField("arrayoffloatfield").getId());
+ const FieldUpdate & serField3 = upd.getUpdates()[0];
+ EXPECT_EQ(serField3.getField().getId(), type->getField("arrayoffloatfield").getId());
- serValue = &serField[0];
+ serValue = &serField3[0];
ASSERT_EQ(serValue->getType(), ValueUpdate::Add);
const AddValueUpdate* add = static_cast<const AddValueUpdate*>(serValue);
@@ -496,7 +496,7 @@ TEST(DocumentUpdateTest, testReadSerializedFile)
EXPECT_TRUE(value->inherits(FloatFieldValue::classId));
EXPECT_FLOAT_EQ(value->getAsFloat(), 5.00f);
- serValue = &serField[1];
+ serValue = &serField3[1];
ASSERT_EQ(serValue->getType(), ValueUpdate::Add);
add = static_cast<const AddValueUpdate*>(serValue);
@@ -504,7 +504,7 @@ TEST(DocumentUpdateTest, testReadSerializedFile)
EXPECT_TRUE(value->inherits(FloatFieldValue::classId));
EXPECT_FLOAT_EQ(value->getAsFloat(), 4.23f);
- serValue = &serField[2];
+ serValue = &serField3[2];
ASSERT_EQ(serValue->getType(), ValueUpdate::Add);
add = static_cast<const AddValueUpdate*>(serValue);
diff --git a/document/src/tests/fieldsettest.cpp b/document/src/tests/fieldsettest.cpp
index 8f77bfd2c0d..a3b78e6081f 100644
--- a/document/src/tests/fieldsettest.cpp
+++ b/document/src/tests/fieldsettest.cpp
@@ -281,7 +281,7 @@ TEST(FieldCollectionTest, testHash ) {
}
TEST(FieldTest, testSizeOf) {
- EXPECT_EQ(sizeof(Field), 96);
+ EXPECT_EQ(sizeof(Field), 88);
}
} // document
diff --git a/document/src/vespa/document/base/field.cpp b/document/src/vespa/document/base/field.cpp
index fb814fc5f17..806f1543cc7 100644
--- a/document/src/vespa/document/base/field.cpp
+++ b/document/src/vespa/document/base/field.cpp
@@ -35,13 +35,15 @@ Field::Field()
{ }
Field::Field(vespalib::stringref name, int fieldId, const DataType& dataType)
- : FieldBase(name),
+ : FieldSet(),
+ _name(name),
_dataType(&dataType),
_fieldId(fieldId)
{ }
Field::Field(vespalib::stringref name, const DataType& dataType)
- : FieldBase(name),
+ : FieldSet(),
+ _name(name),
_dataType(&dataType),
_fieldId(calculateIdV7())
{ }
diff --git a/document/src/vespa/document/base/field.h b/document/src/vespa/document/base/field.h
index eb772131392..ace5123a106 100644
--- a/document/src/vespa/document/base/field.h
+++ b/document/src/vespa/document/base/field.h
@@ -11,9 +11,8 @@
*/
#pragma once
+#include <vespa/vespalib/stllike/string.h>
#include <vespa/document/fieldset/fieldset.h>
-#include <vespa/vespalib/objects/fieldbase.h>
-#include <set>
#include <vector>
namespace document {
@@ -21,9 +20,9 @@ namespace document {
class FieldValue;
class DataType;
-class Field final : public vespalib::FieldBase,
- public FieldSet
+class Field final : public FieldSet
{
+ vespalib::string _name;
const DataType *_dataType;
int _fieldId;
public:
@@ -92,11 +91,12 @@ public:
// Note that only id is checked for equality.
bool operator==(const Field & other) const noexcept { return (_fieldId == other._fieldId); }
bool operator!=(const Field & other) const noexcept { return (_fieldId != other._fieldId); }
- bool operator<(const Field & other) const noexcept { return (getName() < other.getName()); }
+ bool operator<(const Field & other) const noexcept { return (_name < other._name); }
const DataType &getDataType() const { return *_dataType; }
int getId() const noexcept { return _fieldId; }
+ const vespalib::string & getName() const { return _name; }
vespalib::string toString(bool verbose=false) const;
bool contains(const FieldSet& fields) const override;
diff --git a/document/src/vespa/document/base/fieldpath.cpp b/document/src/vespa/document/base/fieldpath.cpp
index 9b286255518..f8ba5f89727 100644
--- a/document/src/vespa/document/base/fieldpath.cpp
+++ b/document/src/vespa/document/base/fieldpath.cpp
@@ -15,8 +15,7 @@ using vespalib::make_string;
namespace document {
FieldPathEntry::FieldPathEntry(const FieldPathEntry &) = default;
-FieldPathEntry & FieldPathEntry::operator=(const FieldPathEntry & ) = default;
-FieldPathEntry::~FieldPathEntry() { }
+FieldPathEntry::~FieldPathEntry() = default;
FieldPathEntry::FieldPathEntry() :
_type(NONE),
diff --git a/document/src/vespa/document/base/fieldpath.h b/document/src/vespa/document/base/fieldpath.h
index cd246ed78b1..d8b04cb0fbb 100644
--- a/document/src/vespa/document/base/fieldpath.h
+++ b/document/src/vespa/document/base/fieldpath.h
@@ -29,15 +29,11 @@ public:
};
using FieldValueCP = vespalib::CloneablePtr<FieldValue>;
- /**
- Creates a empty field path entry.
- */
FieldPathEntry();
FieldPathEntry(FieldPathEntry &&) = default;
FieldPathEntry & operator=(FieldPathEntry &&) = default;
FieldPathEntry(const FieldPathEntry &);
- FieldPathEntry & operator=(const FieldPathEntry &);
/**
Creates a field path entry for a struct field lookup.
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
index 7737d03b45a..ad93d1f30f3 100644
--- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
@@ -19,7 +19,6 @@
#include <vespa/vespalib/util/xmlstream.h>
#include <sstream>
-using vespalib::FieldBase;
using vespalib::nbostream;
using vespalib::IllegalArgumentException;
using namespace vespalib::xml;
diff --git a/document/src/vespa/document/update/fieldupdate.cpp b/document/src/vespa/document/update/fieldupdate.cpp
index 3498d14d96e..d82896e6a60 100644
--- a/document/src/vespa/document/update/fieldupdate.cpp
+++ b/document/src/vespa/document/update/fieldupdate.cpp
@@ -42,7 +42,6 @@ FieldUpdate::FieldUpdate(const DocumentTypeRepo& repo, const DataType & type, nb
}
FieldUpdate::FieldUpdate(const FieldUpdate &) = default;
-FieldUpdate & FieldUpdate::operator = (const FieldUpdate &) = default;
FieldUpdate::~FieldUpdate() = default;
bool
diff --git a/document/src/vespa/document/update/fieldupdate.h b/document/src/vespa/document/update/fieldupdate.h
index 6bd46c3a172..77c142b3070 100644
--- a/document/src/vespa/document/update/fieldupdate.h
+++ b/document/src/vespa/document/update/fieldupdate.h
@@ -33,10 +33,10 @@ public:
FieldUpdate(const Field& field);
FieldUpdate(const FieldUpdate &);
- FieldUpdate & operator = (const FieldUpdate &);
+ FieldUpdate & operator = (const FieldUpdate &) = delete;
FieldUpdate(FieldUpdate &&) = default;
FieldUpdate & operator = (FieldUpdate &&) = default;
- ~FieldUpdate();
+ ~FieldUpdate() override;
/**
* This is a convenience function to construct a field update directly from