summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-03-03 22:17:44 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-03-03 23:55:36 +0000
commit7c7ab8fbb3645a613c13c95ccacbd0600f463465 (patch)
tree4be65678358a09dd1c8b87656330db0c35bfd1ca
parent688816d53e31cb463e20a9507952983dfc9baff6 (diff)
Reduce use of Identifiable for document::DatatType
-rw-r--r--document/src/tests/documentselectparsertest.cpp8
-rw-r--r--document/src/tests/documenttestcase.cpp18
-rw-r--r--document/src/tests/documentupdatetestcase.cpp4
-rw-r--r--document/src/tests/fieldpathupdatetestcase.cpp12
-rw-r--r--document/src/tests/fieldsettest.cpp3
-rw-r--r--document/src/tests/struct_anno/struct_anno_test.cpp3
-rw-r--r--document/src/tests/testdocmantest.cpp6
-rw-r--r--document/src/vespa/document/base/fieldpath.cpp19
-rw-r--r--document/src/vespa/document/base/testdocman.cpp3
-rw-r--r--document/src/vespa/document/base/testdocman.h73
-rw-r--r--document/src/vespa/document/datatype/arraydatatype.cpp4
-rw-r--r--document/src/vespa/document/datatype/arraydatatype.h2
-rw-r--r--document/src/vespa/document/datatype/collectiondatatype.cpp10
-rw-r--r--document/src/vespa/document/datatype/collectiondatatype.h3
-rw-r--r--document/src/vespa/document/datatype/datatype.h15
-rw-r--r--document/src/vespa/document/datatype/datatypes.h1
-rw-r--r--document/src/vespa/document/datatype/mapdatatype.cpp5
-rw-r--r--document/src/vespa/document/datatype/mapdatatype.h1
-rw-r--r--document/src/vespa/document/datatype/numericdatatype.h3
-rw-r--r--document/src/vespa/document/datatype/primitivedatatype.h2
-rw-r--r--document/src/vespa/document/datatype/referencedatatype.cpp6
-rw-r--r--document/src/vespa/document/datatype/referencedatatype.h1
-rw-r--r--document/src/vespa/document/document.h22
-rw-r--r--document/src/vespa/document/fieldvalue/bytefieldvalue.h2
-rw-r--r--document/src/vespa/document/fieldvalue/doublefieldvalue.h4
-rw-r--r--document/src/vespa/document/fieldvalue/floatfieldvalue.h4
-rw-r--r--document/src/vespa/document/fieldvalue/intfieldvalue.h4
-rw-r--r--document/src/vespa/document/fieldvalue/longfieldvalue.h4
-rw-r--r--document/src/vespa/document/fieldvalue/mapfieldvalue.cpp2
-rw-r--r--document/src/vespa/document/fieldvalue/shortfieldvalue.h2
-rw-r--r--document/src/vespa/document/fieldvalue/weightedsetfieldvalue.cpp6
-rw-r--r--document/src/vespa/document/repo/configbuilder.cpp2
-rw-r--r--document/src/vespa/document/repo/configbuilder.h2
-rw-r--r--document/src/vespa/document/repo/documenttyperepo.cpp2
-rw-r--r--document/src/vespa/document/update/addfieldpathupdate.cpp2
-rw-r--r--document/src/vespa/document/update/addvalueupdate.cpp8
-rw-r--r--document/src/vespa/document/update/arithmeticvalueupdate.cpp2
-rw-r--r--document/src/vespa/document/update/fieldupdate.h1
-rw-r--r--document/src/vespa/document/update/removevalueupdate.cpp6
-rw-r--r--document/src/vespa/document/update/tensor_modify_update.cpp4
-rw-r--r--document/src/vespa/document/update/tensor_remove_update.cpp4
-rw-r--r--document/src/vespa/document/update/valueupdate.cpp1
-rw-r--r--document/src/vespa/document/update/valueupdate.h5
-rw-r--r--persistence/src/tests/spi/clusterstatetest.cpp1
-rw-r--r--persistence/src/vespa/persistence/conformancetest/conformancetest.cpp4
-rw-r--r--searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp1
-rw-r--r--searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp2
-rw-r--r--searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp1
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp3
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_test.cpp2
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp1
-rw-r--r--searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp1
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp1
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp2
-rw-r--r--searchlib/src/tests/aggregator/perdocexpr.cpp2
-rw-r--r--searchlib/src/tests/index/doctypebuilder/doctypebuilder_test.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/index/docbuilder.cpp25
-rw-r--r--searchlib/src/vespa/searchlib/index/docbuilder.h20
-rw-r--r--searchlib/src/vespa/searchlib/index/doctypebuilder.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/index/doctypebuilder.h1
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_inverter.h2
-rw-r--r--searchsummary/src/tests/docsummary/matched_elements_filter/matched_elements_filter_test.cpp12
-rw-r--r--storage/src/tests/distributor/externaloperationhandlertest.cpp2
-rw-r--r--storage/src/tests/distributor/getoperationtest.cpp1
-rw-r--r--storage/src/tests/distributor/twophaseupdateoperationtest.cpp2
-rw-r--r--storage/src/tests/persistence/filestorage/filestormanagertest.cpp4
-rw-r--r--storage/src/tests/persistence/persistencetestutils.cpp2
-rw-r--r--storage/src/tests/persistence/processalltest.cpp1
-rw-r--r--storage/src/tests/persistence/testandsettest.cpp1
-rw-r--r--storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp1
-rw-r--r--storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp3
-rw-r--r--storage/src/tests/visiting/visitortest.cpp1
-rw-r--r--storageapi/src/tests/mbusprot/storageprotocoltest.cpp4
73 files changed, 239 insertions, 158 deletions
diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp
index c89cefeae29..f40aec41e16 100644
--- a/document/src/tests/documentselectparsertest.cpp
+++ b/document/src/tests/documentselectparsertest.cpp
@@ -4,6 +4,14 @@
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/update/assignvalueupdate.h>
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/datatype/documenttype.h>
+#include <vespa/document/fieldvalue/bytefieldvalue.h>
+#include <vespa/document/fieldvalue/intfieldvalue.h>
+#include <vespa/document/fieldvalue/longfieldvalue.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
+#include <vespa/document/fieldvalue/floatfieldvalue.h>
+#include <vespa/document/fieldvalue/arrayfieldvalue.h>
+#include <vespa/document/fieldvalue/weightedsetfieldvalue.h>
#include <vespa/document/base/testdocman.h>
#include <vespa/document/select/parser.h>
#include <vespa/document/select/visitor.h>
diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp
index aae4b5c6f40..82c1d62be59 100644
--- a/document/src/tests/documenttestcase.cpp
+++ b/document/src/tests/documenttestcase.cpp
@@ -1,8 +1,22 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/base/testdocman.h>
-#include <vespa/document/datatype/annotationreferencedatatype.h>
+#include <vespa/document/datatype/documenttype.h>
+#include <vespa/document/datatype/mapdatatype.h>
+#include <vespa/document/datatype/weightedsetdatatype.h>
+#include <vespa/document/datatype/numericdatatype.h>
#include <vespa/document/fieldvalue/iteratorhandler.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/fieldvalue/bytefieldvalue.h>
+#include <vespa/document/fieldvalue/intfieldvalue.h>
+#include <vespa/document/fieldvalue/longfieldvalue.h>
+#include <vespa/document/fieldvalue/floatfieldvalue.h>
+#include <vespa/document/fieldvalue/doublefieldvalue.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
+#include <vespa/document/fieldvalue/rawfieldvalue.h>
+#include <vespa/document/fieldvalue/arrayfieldvalue.h>
+#include <vespa/document/fieldvalue/mapfieldvalue.h>
+#include <vespa/document/fieldvalue/weightedsetfieldvalue.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/serialization/vespadocumentdeserializer.h>
@@ -36,6 +50,8 @@ TEST(DocumentTest, testSizeOf)
EXPECT_EQ(88ul, sizeof(IdString));
EXPECT_EQ(104ul, sizeof(DocumentId));
EXPECT_EQ(240ul, sizeof(Document));
+ EXPECT_EQ(88ul, sizeof(NumericDataType));
+ EXPECT_EQ(24ul, sizeof(LongFieldValue));
EXPECT_EQ(96ul, sizeof(StructFieldValue));
EXPECT_EQ(16ul, sizeof(StructuredFieldValue));
EXPECT_EQ(56ul, sizeof(SerializableArray));
diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp
index f505c2dd32d..8a9aef0bde4 100644
--- a/document/src/tests/documentupdatetestcase.cpp
+++ b/document/src/tests/documentupdatetestcase.cpp
@@ -3,7 +3,9 @@
#include <vespa/document/base/testdocman.h>
#include <vespa/document/base/exceptions.h>
#include <vespa/document/datatype/tensor_data_type.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/fieldvalue/tensorfieldvalue.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/serialization/vespadocumentserializer.h>
@@ -28,8 +30,6 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/exception.h>
#include <vespa/vespalib/util/exceptions.h>
-
-#include <fcntl.h>
#include <fstream>
#include <gtest/gtest.h>
#include <unistd.h>
diff --git a/document/src/tests/fieldpathupdatetestcase.cpp b/document/src/tests/fieldpathupdatetestcase.cpp
index e4516ab6d70..cd4e03bbfe7 100644
--- a/document/src/tests/fieldpathupdatetestcase.cpp
+++ b/document/src/tests/fieldpathupdatetestcase.cpp
@@ -1,12 +1,20 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/base/testdocman.h>
#include <vespa/document/fieldvalue/iteratorhandler.h>
-#include <vespa/document/select/node.h>
+#include <vespa/document/fieldvalue/intfieldvalue.h>
+#include <vespa/document/fieldvalue/bytefieldvalue.h>
+#include <vespa/document/fieldvalue/floatfieldvalue.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/fieldvalue/arrayfieldvalue.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
+#include <vespa/document/fieldvalue/weightedsetfieldvalue.h>
+
#include <vespa/document/base/exceptions.h>
-#include <vespa/vespalib/io/fileutil.h>
#include <vespa/document/update/fieldpathupdates.h>
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/datatype/documenttype.h>
+#include <vespa/document/datatype/mapdatatype.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
diff --git a/document/src/tests/fieldsettest.cpp b/document/src/tests/fieldsettest.cpp
index 9f00fdd8c0d..4ce8e53ae3c 100644
--- a/document/src/tests/fieldsettest.cpp
+++ b/document/src/tests/fieldsettest.cpp
@@ -3,6 +3,9 @@
#include <vespa/document/base/testdocman.h>
#include <vespa/document/fieldset/fieldsetrepo.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/fieldvalue/intfieldvalue.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <algorithm>
#include <gtest/gtest.h>
diff --git a/document/src/tests/struct_anno/struct_anno_test.cpp b/document/src/tests/struct_anno/struct_anno_test.cpp
index 18e5fbc5565..57b643a1d27 100644
--- a/document/src/tests/struct_anno/struct_anno_test.cpp
+++ b/document/src/tests/struct_anno/struct_anno_test.cpp
@@ -4,7 +4,8 @@
#include <vespa/document/annotation/alternatespanlist.h>
#include <vespa/document/annotation/annotation.h>
#include <vespa/document/annotation/spantree.h>
-#include <vespa/document/document.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
#include <vespa/document/serialization/annotationdeserializer.h>
#include <vespa/document/serialization/annotationserializer.h>
#include <vespa/document/serialization/vespadocumentdeserializer.h>
diff --git a/document/src/tests/testdocmantest.cpp b/document/src/tests/testdocmantest.cpp
index 5aa2b65fb99..6d0a2686a74 100644
--- a/document/src/tests/testdocmantest.cpp
+++ b/document/src/tests/testdocmantest.cpp
@@ -2,10 +2,10 @@
/* $Id$*/
-#include <iostream>
-#include <set>
-#include <sstream>
#include <vespa/document/base/testdocman.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
+
#include <gtest/gtest.h>
namespace document {
diff --git a/document/src/vespa/document/base/fieldpath.cpp b/document/src/vespa/document/base/fieldpath.cpp
index 2bd8866d9fd..5da64272364 100644
--- a/document/src/vespa/document/base/fieldpath.cpp
+++ b/document/src/vespa/document/base/fieldpath.cpp
@@ -3,8 +3,6 @@
#include "fieldpath.h"
#include <vespa/document/datatype/arraydatatype.h>
#include <vespa/document/datatype/mapdatatype.h>
-#include <vespa/document/datatype/weightedsetdatatype.h>
-#include <vespa/document/datatype/primitivedatatype.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/document/fieldvalue/fieldvalue.h>
#include <vespa/vespalib/objects/visit.hpp>
@@ -72,15 +70,19 @@ FieldPathEntry::setFillValue(const DataType & dataType)
const DataType * dt = & dataType;
while (true) {
- if (dt->inherits(CollectionDataType::classId)) {
- dt = &static_cast<const CollectionDataType *>(dt)->getNestedType();
- } else if (dt->inherits(MapDataType::classId)) {
- dt = &static_cast<const MapDataType *>(dt)->getValueType();
+ const CollectionDataType *ct = dt->cast_collection();
+ if (ct != nullptr) {
+ dt = &ct->getNestedType();
} else {
- break;
+ const MapDataType * mt = dt->cast_map();
+ if (mt != nullptr) {
+ dt = &mt->getValueType();
+ } else {
+ break;
+ }
}
}
- if (dt->inherits(PrimitiveDataType::classId)) {
+ if (dt->isPrimitive()) {
_fillInVal.reset(dt->createFieldValue().release());
}
}
@@ -130,7 +132,6 @@ FieldPathEntry::visitMembers(vespalib::ObjectVisitor &visitor) const
{
visit(visitor, "type", _type);
visit(visitor, "name", _name);
- visit(visitor, "dataType", _dataType);
visit(visitor, "lookupIndex", _lookupIndex);
visit(visitor, "lookupKey", _lookupKey);
visit(visitor, "variableName", _variableName);
diff --git a/document/src/vespa/document/base/testdocman.cpp b/document/src/vespa/document/base/testdocman.cpp
index 74df8e86f9c..2994de9c9c1 100644
--- a/document/src/vespa/document/base/testdocman.cpp
+++ b/document/src/vespa/document/base/testdocman.cpp
@@ -1,9 +1,10 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "testdocman.h"
-#include "exceptions.h"
#include <vespa/document/datatype/datatypes.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
#include <boost/random.hpp>
#include <sstream>
diff --git a/document/src/vespa/document/base/testdocman.h b/document/src/vespa/document/base/testdocman.h
index 3926f8b2b11..aca69e6bceb 100644
--- a/document/src/vespa/document/base/testdocman.h
+++ b/document/src/vespa/document/base/testdocman.h
@@ -19,49 +19,50 @@
#pragma once
#include "testdocrepo.h"
-#include <vespa/document/datatype/datatypes.h>
-#include <vespa/document/fieldvalue/fieldvalues.h>
-#include <memory>
-#include <vector>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
namespace document {
- class TestDocMan {
- static std::vector<char> _buffer;
- TestDocRepo _test_repo;
- std::shared_ptr<const DocumentTypeRepo> _repo;
- const DocumenttypesConfig *_typeCfg;
- public:
- TestDocMan();
- ~TestDocMan();
+class Document;
- void setTypeRepo(const std::shared_ptr<const DocumentTypeRepo> &repo);
+class TestDocMan {
+ static std::vector<char> _buffer;
+ TestDocRepo _test_repo;
+ std::shared_ptr<const DocumentTypeRepo> _repo;
+ const DocumenttypesConfig *_typeCfg;
- const DocumentTypeRepo& getTypeRepo() const { return *_repo; }
- std::shared_ptr<const DocumentTypeRepo> getTypeRepoSP() const { return _repo; }
- const DocumenttypesConfig *getTypeConfig() const { return _typeCfg; }
+public:
+ TestDocMan();
+ ~TestDocMan();
- /** Create test document. */
- Document::UP createDocument(
- const std::string& content = "This is the contents of "
- "the test document.\nIt ain't much.\n",
- const std::string& uri = "id:test:testdoctype1::test",
- const std::string& type = "testdoctype1") const;
+ void setTypeRepo(const std::shared_ptr<const DocumentTypeRepo> &repo);
- /** Create random document from given seed. */
- Document::UP createRandomDocument(
- int seed = 0, int maxContentSize = 0x80) const;
- /** Create random document from given seed belonging to given location */
- Document::UP createRandomDocumentAtLocation(
- int location, int seed = 0, int maxContentSize = 0x80) const;
- Document::UP createRandomDocumentAtLocation(
- int location, int seed, int minContentSize, int maxContentSize) const;
- /** Create random document of given type from given seed. */
- Document::UP createRandomDocument(
- const std::string& type, int seed = 0,
- int maxContentSize = 0x80) const;
- static std::string generateRandomContent(uint32_t size);
- };
+ const DocumentTypeRepo& getTypeRepo() const { return *_repo; }
+ std::shared_ptr<const DocumentTypeRepo> getTypeRepoSP() const { return _repo; }
+ const DocumenttypesConfig *getTypeConfig() const { return _typeCfg; }
+
+ /** Create test document. */
+ std::unique_ptr<Document> createDocument(
+ const std::string& content = "This is the contents of "
+ "the test document.\nIt ain't much.\n",
+ const std::string& uri = "id:test:testdoctype1::test",
+ const std::string& type = "testdoctype1") const;
+
+ /** Create random document from given seed. */
+ std::unique_ptr<Document> createRandomDocument(
+ int seed = 0, int maxContentSize = 0x80) const;
+ /** Create random document from given seed belonging to given location */
+ std::unique_ptr<Document> createRandomDocumentAtLocation(
+ int location, int seed = 0, int maxContentSize = 0x80) const;
+ std::unique_ptr<Document> createRandomDocumentAtLocation(
+ int location, int seed, int minContentSize, int maxContentSize) const;
+ /** Create random document of given type from given seed. */
+ std::unique_ptr<Document> createRandomDocument(
+ const std::string& type, int seed = 0,
+ int maxContentSize = 0x80) const;
+ static std::string generateRandomContent(uint32_t size);
+};
} // document
diff --git a/document/src/vespa/document/datatype/arraydatatype.cpp b/document/src/vespa/document/datatype/arraydatatype.cpp
index af87e488d19..7aed584ad09 100644
--- a/document/src/vespa/document/datatype/arraydatatype.cpp
+++ b/document/src/vespa/document/datatype/arraydatatype.cpp
@@ -22,7 +22,7 @@ ArrayDataType::ArrayDataType(const DataType& nestedType)
FieldValue::UP
ArrayDataType::createFieldValue() const
{
- return FieldValue::UP(new ArrayFieldValue(*this));
+ return std::make_unique<ArrayFieldValue>(*this);
}
void
@@ -39,7 +39,7 @@ ArrayDataType::operator==(const DataType& other) const
{
if (this == &other) return true;
if (!CollectionDataType::operator==(other)) return false;
- return other.inherits(ArrayDataType::classId);
+ return other.isArray();
}
void
diff --git a/document/src/vespa/document/datatype/arraydatatype.h b/document/src/vespa/document/datatype/arraydatatype.h
index b69bdceea02..3c0104eb393 100644
--- a/document/src/vespa/document/datatype/arraydatatype.h
+++ b/document/src/vespa/document/datatype/arraydatatype.h
@@ -30,6 +30,8 @@ public:
ArrayDataType &operator=(const ArrayDataType &rhs) = default;
void onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const override;
+ bool isArray() const override { return true; }
+
DECLARE_IDENTIFIABLE(ArrayDataType);
};
diff --git a/document/src/vespa/document/datatype/collectiondatatype.cpp b/document/src/vespa/document/datatype/collectiondatatype.cpp
index d86be5d35c1..886d44dbb9c 100644
--- a/document/src/vespa/document/datatype/collectiondatatype.cpp
+++ b/document/src/vespa/document/datatype/collectiondatatype.cpp
@@ -2,7 +2,6 @@
#include "collectiondatatype.h"
#include <vespa/document/util/stringutil.h>
-#include <vespa/vespalib/util/exceptions.h>
namespace document {
@@ -37,17 +36,14 @@ CollectionDataType::CollectionDataType(vespalib::stringref name,
_nestedType(&nestedType) {
}
-CollectionDataType::~CollectionDataType()
-{
-}
+CollectionDataType::~CollectionDataType() = default;
bool
CollectionDataType::operator==(const DataType& other) const
{
if (!DataType::operator==(other)) return false;
- const CollectionDataType* o(
- Identifiable::cast<const CollectionDataType*>(&other));
- return o != 0 && *_nestedType == *o->_nestedType;
+ const CollectionDataType * o = other.cast_collection();
+ return o && *_nestedType == *o->_nestedType;
}
} // document
diff --git a/document/src/vespa/document/datatype/collectiondatatype.h b/document/src/vespa/document/datatype/collectiondatatype.h
index f294f8da375..2d1277cc747 100644
--- a/document/src/vespa/document/datatype/collectiondatatype.h
+++ b/document/src/vespa/document/datatype/collectiondatatype.h
@@ -26,10 +26,11 @@ protected:
const DataType &nestedType, int32_t id);
public:
- ~CollectionDataType();
+ ~CollectionDataType() override;
bool operator==(const DataType&) const override;
const DataType &getNestedType() const { return *_nestedType; }
+ const CollectionDataType * cast_collection() const override { return this; }
DECLARE_IDENTIFIABLE_ABSTRACT(CollectionDataType);
};
diff --git a/document/src/vespa/document/datatype/datatype.h b/document/src/vespa/document/datatype/datatype.h
index f3538956dfd..c32aec6b9b1 100644
--- a/document/src/vespa/document/datatype/datatype.h
+++ b/document/src/vespa/document/datatype/datatype.h
@@ -16,11 +16,16 @@ namespace document {
class FieldValue;
class Field;
+class FieldPath;
+
class NumericDataType;
class PrimitiveDataType;
class DocumentType;
class WeightedSetDataType;
-class FieldPath;
+class CollectionDataType;
+class ArrayDataType;
+class MapDataType;
+class ReferenceDataType;
class DataType : public Printable,
public vespalib::Identifiable
@@ -98,7 +103,6 @@ public:
/** Used by type manager to fetch default types to register. */
static std::vector<const DataType *> getDefaultDataTypes();
-
const vespalib::string& getName() const { return _name; }
int getId() const { return _dataTypeId; }
bool isValueType(const FieldValue & fv) const;
@@ -109,6 +113,13 @@ public:
virtual std::unique_ptr<FieldValue> createFieldValue() const = 0;
virtual DataType* clone() const = 0;
+ virtual bool isArray() const { return false; }
+ virtual bool isPrimitive() const { return false; }
+ virtual bool isNumeric() const { return false; }
+ virtual const CollectionDataType * cast_collection() const { return nullptr; }
+ virtual const MapDataType * cast_map() const { return nullptr; }
+ virtual const ReferenceDataType * cast_reference() const { return nullptr; }
+
/**
* Whether another datatype is a supertype of this one. Document types may
* be due to inheritance. For other types, they must be identical for this
diff --git a/document/src/vespa/document/datatype/datatypes.h b/document/src/vespa/document/datatype/datatypes.h
index 3960b215944..42f445089c8 100644
--- a/document/src/vespa/document/datatype/datatypes.h
+++ b/document/src/vespa/document/datatype/datatypes.h
@@ -9,4 +9,3 @@
#include <vespa/document/datatype/weightedsetdatatype.h>
#include <vespa/document/datatype/structdatatype.h>
#include <vespa/document/datatype/documenttype.h>
-
diff --git a/document/src/vespa/document/datatype/mapdatatype.cpp b/document/src/vespa/document/datatype/mapdatatype.cpp
index 891f1b60f49..74cb732fb5c 100644
--- a/document/src/vespa/document/datatype/mapdatatype.cpp
+++ b/document/src/vespa/document/datatype/mapdatatype.cpp
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "mapdatatype.h"
-#include "primitivedatatype.h"
#include <vespa/document/fieldvalue/mapfieldvalue.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <ostream>
@@ -51,8 +50,8 @@ MapDataType::operator==(const DataType& other) const
{
if (this == &other) return true;
if (!DataType::operator==(other)) return false;
- const MapDataType* w(Identifiable::cast<const MapDataType*>(&other));
- return (*_keyType == *w->_keyType) && (*_valueType == *w->_valueType);
+ const MapDataType * w = other.cast_map();
+ return w && (*_keyType == *w->_keyType) && (*_valueType == *w->_valueType);
}
void
diff --git a/document/src/vespa/document/datatype/mapdatatype.h b/document/src/vespa/document/datatype/mapdatatype.h
index 457461b32fe..70800d36722 100644
--- a/document/src/vespa/document/datatype/mapdatatype.h
+++ b/document/src/vespa/document/datatype/mapdatatype.h
@@ -27,6 +27,7 @@ public:
void print(std::ostream&, bool verbose, const std::string& indent) const override;
bool operator==(const DataType& other) const override;
MapDataType* clone() const override { return new MapDataType(*this); }
+ const MapDataType * cast_map() const override { return this; }
void onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const override;
static void buildFieldPathImpl(FieldPath & path, const DataType& dataType,
diff --git a/document/src/vespa/document/datatype/numericdatatype.h b/document/src/vespa/document/datatype/numericdatatype.h
index 096582568e9..e5f87af584a 100644
--- a/document/src/vespa/document/datatype/numericdatatype.h
+++ b/document/src/vespa/document/datatype/numericdatatype.h
@@ -15,12 +15,13 @@
namespace document {
-class NumericDataType : public PrimitiveDataType {
+class NumericDataType final : public PrimitiveDataType {
public:
NumericDataType(Type type);
NumericDataType* clone() const override { return new NumericDataType(*this); }
void print(std::ostream&, bool verbose, const std::string& indent) const override;
+ bool isNumeric() const override { return true; }
DECLARE_IDENTIFIABLE_ABSTRACT(NumericDataType);
};
diff --git a/document/src/vespa/document/datatype/primitivedatatype.h b/document/src/vespa/document/datatype/primitivedatatype.h
index f076e595d00..2f990c1a273 100644
--- a/document/src/vespa/document/datatype/primitivedatatype.h
+++ b/document/src/vespa/document/datatype/primitivedatatype.h
@@ -28,6 +28,8 @@ public:
PrimitiveDataType* clone() const override { return new PrimitiveDataType(*this); }
void print(std::ostream&, bool verbose, const std::string& indent) const override;
+ bool isPrimitive() const override { return true; }
+
DECLARE_IDENTIFIABLE_ABSTRACT(PrimitiveDataType);
};
diff --git a/document/src/vespa/document/datatype/referencedatatype.cpp b/document/src/vespa/document/datatype/referencedatatype.cpp
index b36c9fc165a..0f873aa3973 100644
--- a/document/src/vespa/document/datatype/referencedatatype.cpp
+++ b/document/src/vespa/document/datatype/referencedatatype.cpp
@@ -41,9 +41,9 @@ void ReferenceDataType::onBuildFieldPath(FieldPath &, vespalib::stringref remain
}
bool ReferenceDataType::operator==(const DataType &rhs) const {
- return DataType::operator==(rhs)
- && rhs.inherits(classId)
- && (_targetDocType == static_cast<const ReferenceDataType &>(rhs)._targetDocType);
+ const ReferenceDataType *rt = rhs.cast_reference();
+ return rt && DataType::operator==(rhs)
+ && (_targetDocType == rt->_targetDocType);
}
} // document
diff --git a/document/src/vespa/document/datatype/referencedatatype.h b/document/src/vespa/document/datatype/referencedatatype.h
index 7a79efaf142..960c6feb435 100644
--- a/document/src/vespa/document/datatype/referencedatatype.h
+++ b/document/src/vespa/document/datatype/referencedatatype.h
@@ -25,6 +25,7 @@ public:
ReferenceDataType* clone() const override;
void onBuildFieldPath(FieldPath & path, vespalib::stringref remainingFieldName) const override;
+ const ReferenceDataType * cast_reference() const override { return this; }
bool operator==(const DataType &type) const override;
bool operator==(const ReferenceDataType& type) const { return operator==(static_cast<const DataType&>(type)); }
};
diff --git a/document/src/vespa/document/document.h b/document/src/vespa/document/document.h
deleted file mode 100644
index 9c9bd0473ff..00000000000
--- a/document/src/vespa/document/document.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/**
- *
- * \file document.h
- *
- * Include common client parts of document, such that clients can easily
- * just include this file to get what they need.
- *
- * This should pull in all code needed for handling:
- * - Datatypes
- * - Fieldvalues
- * - Updates
- * - Selection language
- */
-
-#pragma once
-
-#include <vespa/document/datatype/datatypes.h>
-#include <vespa/document/fieldvalue/fieldvalues.h>
-#include <vespa/document/update/updates.h>
-#include <vespa/document/select/parser.h>
-
diff --git a/document/src/vespa/document/fieldvalue/bytefieldvalue.h b/document/src/vespa/document/fieldvalue/bytefieldvalue.h
index b3296adbf1f..7f6bc429b69 100644
--- a/document/src/vespa/document/fieldvalue/bytefieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/bytefieldvalue.h
@@ -8,7 +8,7 @@
#pragma once
#include "numericfieldvalue.h"
-#include <vespa/document/datatype/numericdatatype.h>
+#include <vespa/document/datatype/datatype.h>
namespace document {
diff --git a/document/src/vespa/document/fieldvalue/doublefieldvalue.h b/document/src/vespa/document/fieldvalue/doublefieldvalue.h
index a8dcca7b40d..feb15e52223 100644
--- a/document/src/vespa/document/fieldvalue/doublefieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/doublefieldvalue.h
@@ -7,8 +7,8 @@
*/
#pragma once
-#include <vespa/document/datatype/numericdatatype.h>
-#include <vespa/document/fieldvalue/numericfieldvalue.h>
+#include "numericfieldvalue.h"
+#include <vespa/document/datatype/datatype.h>
namespace document {
diff --git a/document/src/vespa/document/fieldvalue/floatfieldvalue.h b/document/src/vespa/document/fieldvalue/floatfieldvalue.h
index ea3d5971673..f33939d8d67 100644
--- a/document/src/vespa/document/fieldvalue/floatfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/floatfieldvalue.h
@@ -7,8 +7,8 @@
*/
#pragma once
-#include <vespa/document/datatype/numericdatatype.h>
-#include <vespa/document/fieldvalue/numericfieldvalue.h>
+#include "numericfieldvalue.h"
+#include <vespa/document/datatype/datatype.h>
namespace document {
diff --git a/document/src/vespa/document/fieldvalue/intfieldvalue.h b/document/src/vespa/document/fieldvalue/intfieldvalue.h
index e36c271f336..dbe419379a1 100644
--- a/document/src/vespa/document/fieldvalue/intfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/intfieldvalue.h
@@ -7,8 +7,8 @@
*/
#pragma once
-#include <vespa/document/datatype/numericdatatype.h>
-#include <vespa/document/fieldvalue/numericfieldvalue.h>
+#include "numericfieldvalue.h"
+#include <vespa/document/datatype/datatype.h>
namespace document {
diff --git a/document/src/vespa/document/fieldvalue/longfieldvalue.h b/document/src/vespa/document/fieldvalue/longfieldvalue.h
index a4afb1c703c..12a0615e0ad 100644
--- a/document/src/vespa/document/fieldvalue/longfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/longfieldvalue.h
@@ -7,8 +7,8 @@
*/
#pragma once
-#include <vespa/document/datatype/numericdatatype.h>
-#include <vespa/document/fieldvalue/numericfieldvalue.h>
+#include "numericfieldvalue.h"
+#include <vespa/document/datatype/datatype.h>
namespace document {
diff --git a/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp b/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp
index 8db3a15968b..872185e7523 100644
--- a/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp
@@ -29,7 +29,7 @@ IMPLEMENT_IDENTIFIABLE_ABSTRACT(MapFieldValue, FieldValue);
namespace {
const MapDataType *verifyMapType(const DataType& type) {
- const MapDataType *ptr(Identifiable::cast<const MapDataType *>(&type));
+ const MapDataType *ptr(dynamic_cast<const MapDataType *>(&type));
if (!ptr) {
throw vespalib::IllegalArgumentException("Datatype given is not a map type", VESPA_STRLOC);
}
diff --git a/document/src/vespa/document/fieldvalue/shortfieldvalue.h b/document/src/vespa/document/fieldvalue/shortfieldvalue.h
index f6d485451ad..f2047d1a521 100644
--- a/document/src/vespa/document/fieldvalue/shortfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/shortfieldvalue.h
@@ -8,7 +8,7 @@
#pragma once
#include "numericfieldvalue.h"
-#include <vespa/document/datatype/numericdatatype.h>
+#include <vespa/document/datatype/datatype.h>
namespace document {
diff --git a/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.cpp b/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.cpp
index 7893cedb2fe..6b80ceb1f6e 100644
--- a/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.cpp
@@ -22,7 +22,7 @@ IMPLEMENT_IDENTIFIABLE_ABSTRACT(WeightedSetFieldValue, CollectionFieldValue);
namespace {
const DataType &getKeyType(const DataType &type) {
- const WeightedSetDataType *wtype = Identifiable::cast<const WeightedSetDataType *>(&type);
+ const WeightedSetDataType *wtype = dynamic_cast<const WeightedSetDataType *>(&type);
if (!wtype) {
throw IllegalArgumentException("Cannot generate a weighted set value with non-weighted set "
"type " + type.toString() + ".", VESPA_STRLOC);
@@ -33,14 +33,14 @@ const DataType &getKeyType(const DataType &type) {
WeightedSetFieldValue::WeightedSetFieldValue(const DataType &type)
: CollectionFieldValue(type),
- _map_type(new MapDataType(getKeyType(type), *DataType::INT)),
+ _map_type(std::make_shared<MapDataType>(getKeyType(type), *DataType::INT)),
_map(*_map_type),
_altered(true)
{ }
WeightedSetFieldValue::WeightedSetFieldValue(const WeightedSetFieldValue &) = default;
WeightedSetFieldValue & WeightedSetFieldValue::operator = (const WeightedSetFieldValue &) = default;
-WeightedSetFieldValue::~WeightedSetFieldValue() { }
+WeightedSetFieldValue::~WeightedSetFieldValue() = default;
void WeightedSetFieldValue::verifyKey(const FieldValue & v)
{
diff --git a/document/src/vespa/document/repo/configbuilder.cpp b/document/src/vespa/document/repo/configbuilder.cpp
index 6169ccd5a23..2ff852839f9 100644
--- a/document/src/vespa/document/repo/configbuilder.cpp
+++ b/document/src/vespa/document/repo/configbuilder.cpp
@@ -1,6 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "configbuilder.h"
+#include <vespa/document/datatype/structdatatype.h>
+
namespace document::config_builder {
diff --git a/document/src/vespa/document/repo/configbuilder.h b/document/src/vespa/document/repo/configbuilder.h
index 4df7a58ebb6..a68a8dda2dc 100644
--- a/document/src/vespa/document/repo/configbuilder.h
+++ b/document/src/vespa/document/repo/configbuilder.h
@@ -5,8 +5,6 @@
#include <vespa/document/base/field.h>
#include <vespa/document/config/config-documenttypes.h>
#include <vespa/document/config/documenttypes_config_fwd.h>
-#include <vespa/document/datatype/datatype.h>
-#include <vespa/document/datatype/structdatatype.h>
#include <vespa/vespalib/stllike/string.h>
#include <cassert>
diff --git a/document/src/vespa/document/repo/documenttyperepo.cpp b/document/src/vespa/document/repo/documenttyperepo.cpp
index 3a7769c831e..1738dbd0141 100644
--- a/document/src/vespa/document/repo/documenttyperepo.cpp
+++ b/document/src/vespa/document/repo/documenttyperepo.cpp
@@ -293,7 +293,7 @@ void addStruct(int32_t id, const Datatype::Sstruct &s, Repo &repo) {
const DataType *existing = repo.lookup(name);
if (useUglyStructHack && existing) {
LOG(spam, "Type %s already existed", name.c_str());
- const StructDataType& cdt = Identifiable::cast<const StructDataType&>(*existing);
+ const StructDataType& cdt = dynamic_cast<const StructDataType&>(*existing);
struct_type = const_cast<StructDataType*>(&cdt);
} else {
const DataType *existing_retry = repo.lookup(id);
diff --git a/document/src/vespa/document/update/addfieldpathupdate.cpp b/document/src/vespa/document/update/addfieldpathupdate.cpp
index 86672a08fd2..227ac34d78b 100644
--- a/document/src/vespa/document/update/addfieldpathupdate.cpp
+++ b/document/src/vespa/document/update/addfieldpathupdate.cpp
@@ -95,7 +95,7 @@ AddFieldPathUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& ty
FieldPath path;
type.buildFieldPath(path, getOriginalFieldPath());
const DataType& fieldType = getResultingDataType(path);
- assert(fieldType.inherits(ArrayDataType::classId));
+ assert(fieldType.isArray());
FieldValue::UP val = fieldType.createFieldValue();
_values.reset(static_cast<ArrayFieldValue*>(val.release()));
VespaDocumentDeserializer deserializer(repo, stream, Document::getNewestSerializationVersion());
diff --git a/document/src/vespa/document/update/addvalueupdate.cpp b/document/src/vespa/document/update/addvalueupdate.cpp
index 22e3582b14d..e12afd8fa63 100644
--- a/document/src/vespa/document/update/addvalueupdate.cpp
+++ b/document/src/vespa/document/update/addvalueupdate.cpp
@@ -40,9 +40,9 @@ AddValueUpdate::operator==(const ValueUpdate& other) const
void
AddValueUpdate::checkCompatibility(const Field& field) const
{
- if (field.getDataType().inherits(CollectionDataType::classId)) {
- const CollectionDataType& type(static_cast<const CollectionDataType&>(field.getDataType()));
- if (!type.getNestedType().isValueType(*_value)) {
+ const CollectionDataType *ct = field.getDataType().cast_collection();
+ if (ct != nullptr) {
+ if (!ct->getNestedType().isValueType(*_value)) {
throw IllegalArgumentException("Cannot add value of type " + _value->getDataType()->toString() +
" to field " + field.getName() + " of container type " +
field.getDataType().toString(), VESPA_STRLOC);
@@ -88,7 +88,7 @@ AddValueUpdate::printXml(XmlOutputStream& xos) const
void
AddValueUpdate::deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream& stream)
{
- const CollectionDataType* ctype = Identifiable::cast<const CollectionDataType*>(&type);
+ const CollectionDataType *ctype = type.cast_collection();
if (ctype == nullptr) {
throw DeserializeException("Can not perform add operation on non-collection type.");
}
diff --git a/document/src/vespa/document/update/arithmeticvalueupdate.cpp b/document/src/vespa/document/update/arithmeticvalueupdate.cpp
index a30b7acdea1..b33312d8e65 100644
--- a/document/src/vespa/document/update/arithmeticvalueupdate.cpp
+++ b/document/src/vespa/document/update/arithmeticvalueupdate.cpp
@@ -33,7 +33,7 @@ ArithmeticValueUpdate::operator==(const ValueUpdate& other) const
void
ArithmeticValueUpdate::checkCompatibility(const Field& field) const
{
- if ( ! field.getDataType().inherits(NumericDataType::classId)) {
+ if ( ! field.getDataType().isNumeric()) {
throw IllegalArgumentException(vespalib::make_string(
"Can not perform arithmetic update on non-numeric field '%s'.",
field.getName().data()), VESPA_STRLOC);
diff --git a/document/src/vespa/document/update/fieldupdate.h b/document/src/vespa/document/update/fieldupdate.h
index a00e5c73821..1e4137b9531 100644
--- a/document/src/vespa/document/update/fieldupdate.h
+++ b/document/src/vespa/document/update/fieldupdate.h
@@ -19,6 +19,7 @@
namespace document {
class Document;
+class DocumentType;
class FieldUpdate : public vespalib::Identifiable,
public Printable,
diff --git a/document/src/vespa/document/update/removevalueupdate.cpp b/document/src/vespa/document/update/removevalueupdate.cpp
index 979e2e736de..eb5d6547d75 100644
--- a/document/src/vespa/document/update/removevalueupdate.cpp
+++ b/document/src/vespa/document/update/removevalueupdate.cpp
@@ -39,9 +39,9 @@ RemoveValueUpdate::operator==(const ValueUpdate& other) const
void
RemoveValueUpdate::checkCompatibility(const Field& field) const
{
- if (field.getDataType().inherits(CollectionDataType::classId)) {
- const CollectionDataType& type = static_cast<const CollectionDataType&>(field.getDataType());
- if (!type.getNestedType().isValueType(*_key)) {
+ const CollectionDataType *type = field.getDataType().cast_collection();
+ if (type != nullptr) {
+ if (!type->getNestedType().isValueType(*_key)) {
throw IllegalArgumentException(
"Cannot remove value of type "
+ _key->getDataType()->toString() + " from field "
diff --git a/document/src/vespa/document/update/tensor_modify_update.cpp b/document/src/vespa/document/update/tensor_modify_update.cpp
index 6b2fe96c06d..4c114ba477c 100644
--- a/document/src/vespa/document/update/tensor_modify_update.cpp
+++ b/document/src/vespa/document/update/tensor_modify_update.cpp
@@ -102,7 +102,7 @@ TensorModifyUpdate::TensorModifyUpdate(const TensorModifyUpdate &rhs)
TensorModifyUpdate::TensorModifyUpdate(Operation operation, std::unique_ptr<TensorFieldValue> tensor)
: _operation(operation),
- _tensorType(Identifiable::cast<const TensorDataType &>(*tensor->getDataType()).clone()),
+ _tensorType(dynamic_cast<const TensorDataType &>(*tensor->getDataType()).clone()),
_tensor(Identifiable::cast<TensorFieldValue *>(_tensorType->createFieldValue().release()))
{
*_tensor = *tensor;
@@ -240,7 +240,7 @@ TensorModifyUpdate::deserialize(const DocumentTypeRepo &repo, const DataType &ty
throw DeserializeException(msg.str(), VESPA_STRLOC);
}
_operation = static_cast<Operation>(op);
- _tensorType = convertToCompatibleType(Identifiable::cast<const TensorDataType &>(type));
+ _tensorType = convertToCompatibleType(dynamic_cast<const TensorDataType &>(type));
auto tensor = _tensorType->createFieldValue();
if (tensor->inherits(TensorFieldValue::classId)) {
_tensor.reset(static_cast<TensorFieldValue *>(tensor.release()));
diff --git a/document/src/vespa/document/update/tensor_remove_update.cpp b/document/src/vespa/document/update/tensor_remove_update.cpp
index 2677f9c8eaa..2afd0869d62 100644
--- a/document/src/vespa/document/update/tensor_remove_update.cpp
+++ b/document/src/vespa/document/update/tensor_remove_update.cpp
@@ -55,7 +55,7 @@ TensorRemoveUpdate::TensorRemoveUpdate(const TensorRemoveUpdate &rhs)
}
TensorRemoveUpdate::TensorRemoveUpdate(std::unique_ptr<TensorFieldValue> tensor)
- : _tensorType(Identifiable::cast<const TensorDataType &>(*tensor->getDataType()).clone()),
+ : _tensorType(dynamic_cast<const TensorDataType &>(*tensor->getDataType()).clone()),
_tensor(Identifiable::cast<TensorFieldValue *>(_tensorType->createFieldValue().release()))
{
*_tensor = *tensor;
@@ -195,7 +195,7 @@ TensorRemoveUpdate::deserialize(const DocumentTypeRepo &repo, const DataType &ty
VespaDocumentDeserializer deserializer(repo, stream, Document::getNewestSerializationVersion());
auto tensor = deserializer.readTensor();
verifyAddressTensorIsSparse(tensor.get());
- auto compatible_type = convertToCompatibleType(Identifiable::cast<const TensorDataType &>(type));
+ auto compatible_type = convertToCompatibleType(dynamic_cast<const TensorDataType &>(type));
verify_tensor_type_dimensions_are_subset_of(tensor->type(), compatible_type->getTensorType());
_tensorType = std::make_unique<const TensorDataType>(tensor->type());
_tensor = std::make_unique<TensorFieldValue>(*_tensorType);
diff --git a/document/src/vespa/document/update/valueupdate.cpp b/document/src/vespa/document/update/valueupdate.cpp
index 2be6a4f2e63..8a023fb9ef2 100644
--- a/document/src/vespa/document/update/valueupdate.cpp
+++ b/document/src/vespa/document/update/valueupdate.cpp
@@ -2,7 +2,6 @@
#include "valueupdate.h"
#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/vespalib/objects/nbostream.h>
#include <stdexcept>
namespace document {
diff --git a/document/src/vespa/document/update/valueupdate.h b/document/src/vespa/document/update/valueupdate.h
index b2f4a1da609..9a8ed4e9537 100644
--- a/document/src/vespa/document/update/valueupdate.h
+++ b/document/src/vespa/document/update/valueupdate.h
@@ -19,14 +19,17 @@
#pragma once
#include "updatevisitor.h"
-#include <vespa/document/datatype/datatype.h>
+#include <vespa/document/util/printable.h>
#include <vespa/document/util/xmlserializable.h>
+#include <vespa/document/util/identifiableid.h>
+#include <vespa/vespalib/objects/nbostream.h>
namespace document {
class DocumentTypeRepo;
class Field;
class FieldValue;
+class DataType;
class ValueUpdate : public vespalib::Identifiable,
public Printable,
diff --git a/persistence/src/tests/spi/clusterstatetest.cpp b/persistence/src/tests/spi/clusterstatetest.cpp
index 2186d408791..02357978595 100644
--- a/persistence/src/tests/spi/clusterstatetest.cpp
+++ b/persistence/src/tests/spi/clusterstatetest.cpp
@@ -6,6 +6,7 @@
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/config-stor-distribution.h>
#include <vespa/document/base/testdocman.h>
+#include <vespa/document/fieldvalue/document.h>
#include <gtest/gtest.h>
using storage::spi::test::makeSpiBucket;
diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp
index 6afdd142457..95d7822e17c 100644
--- a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp
+++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp
@@ -9,6 +9,10 @@
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/document/update/documentupdate.h>
#include <vespa/document/update/assignvalueupdate.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/fieldvalue/intfieldvalue.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/test/make_bucket_space.h>
#include <vespa/vdslib/state/state.h>
diff --git a/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp b/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp
index 9f6254f9baa..ddb41ae67a6 100644
--- a/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp
+++ b/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp
@@ -2,7 +2,6 @@
#include <vespa/config/print/fileconfigwriter.h>
#include <vespa/document/config/config-documenttypes.h>
-#include <vespa/document/document.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/documentapi/documentapi.h>
#include <vespa/messagebus/destinationsession.h>
diff --git a/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp b/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp
index 1488e87afdf..5fb359e5e9c 100644
--- a/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp
+++ b/searchcore/src/apps/vespa-feed-bm/vespa_feed_bm.cpp
@@ -4,6 +4,7 @@
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/document_type_repo_factory.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/datatype.h>
#include <vespa/fastos/app.h>
#include <vespa/searchcore/bmcluster/avg_sampler.h>
#include <vespa/searchcore/bmcluster/bm_cluster.h>
@@ -21,7 +22,6 @@
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/objects/nbostream.h>
-#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/lambdatask.h>
#include <vespa/vespalib/util/size_literals.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
diff --git a/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp b/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp
index beb1e0bd6bc..33f84f14ae9 100644
--- a/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp
+++ b/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp
@@ -4,6 +4,7 @@
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/document_type_repo_factory.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/datatype.h>
#include <vespa/fastos/app.h>
#include <vespa/searchcore/bmcluster/avg_sampler.h>
#include <vespa/searchcore/bmcluster/bm_cluster.h>
diff --git a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp
index 4ed57fef391..1ed5e6883cc 100644
--- a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp
@@ -1,7 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/document/config/documenttypes_config_fwd.h>
#include <vespa/document/fieldvalue/intfieldvalue.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/searchcore/proton/attribute/attribute_populator.h>
#include <vespa/searchcore/proton/attribute/attributemanager.h>
diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp
index 1de56802484..890a808ae88 100644
--- a/searchcore/src/tests/proton/attribute/attribute_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp
@@ -2,6 +2,8 @@
#include <vespa/config-attributes.h>
#include <vespa/document/datatype/tensor_data_type.h>
+#include <vespa/document/datatype/documenttype.h>
+#include <vespa/document/datatype/mapdatatype.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/predicate/predicate_slime_builder.h>
#include <vespa/document/update/arithmeticvalueupdate.h>
diff --git a/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp b/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp
index 78a119c638a..b88a375179a 100644
--- a/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdbconfig/documentdbconfig_test.cpp
@@ -11,6 +11,7 @@
#include <vespa/document/config/documenttypes_config_fwd.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/datatype.h>
using namespace document;
using namespace proton;
diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
index 0f1b4412c4f..4040d69270f 100644
--- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
@@ -2,6 +2,7 @@
#include <vespa/persistence/spi/result.h>
#include <vespa/document/datatype/tensor_data_type.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/update/assignvalueupdate.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/update/documentupdate.h>
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
index ba68d47ec22..f915ba9d898 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
@@ -22,6 +22,7 @@
#include <vespa/searchcore/proton/test/transport_helper.h>
#include <vespa/searchlib/attribute/attributefactory.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>
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
index 0144e260ffa..8c54386781e 100644
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
@@ -1,8 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
#include <vespa/config-attributes.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/test/make_bucket_space.h>
#include <vespa/fastos/thread.h>
#include <vespa/persistence/dummyimpl/dummy_bucket_executor.h>
diff --git a/searchlib/src/tests/aggregator/perdocexpr.cpp b/searchlib/src/tests/aggregator/perdocexpr.cpp
index 291114ffa90..6e3e6bf3353 100644
--- a/searchlib/src/tests/aggregator/perdocexpr.cpp
+++ b/searchlib/src/tests/aggregator/perdocexpr.cpp
@@ -8,6 +8,8 @@
#include <vespa/vespalib/objects/objectdumper.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/document/base/testdocman.h>
+#include <vespa/document/fieldvalue/bytefieldvalue.h>
+#include <vespa/document/fieldvalue/weightedsetfieldvalue.h>
#include <vespa/vespalib/util/md5.h>
#include <vespa/searchlib/expression/getdocidnamespacespecificfunctionnode.h>
#include <vespa/searchlib/expression/documentfieldnode.h>
diff --git a/searchlib/src/tests/index/doctypebuilder/doctypebuilder_test.cpp b/searchlib/src/tests/index/doctypebuilder/doctypebuilder_test.cpp
index f8a07270292..396c7c19cc6 100644
--- a/searchlib/src/tests/index/doctypebuilder/doctypebuilder_test.cpp
+++ b/searchlib/src/tests/index/doctypebuilder/doctypebuilder_test.cpp
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/searchlib/index/doctypebuilder.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/testkit/testapp.h>
using namespace document;
diff --git a/searchlib/src/vespa/searchlib/index/docbuilder.cpp b/searchlib/src/vespa/searchlib/index/docbuilder.cpp
index 6e7a87dc713..0792dd7be61 100644
--- a/searchlib/src/vespa/searchlib/index/docbuilder.cpp
+++ b/searchlib/src/vespa/searchlib/index/docbuilder.cpp
@@ -2,6 +2,7 @@
#include "docbuilder.h"
#include <vespa/document/datatype/urldatatype.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/fastlib/text/unicodeutil.h>
#include <vespa/vespalib/geo/zcurve.h>
@@ -605,8 +606,7 @@ DocBuilder::SummaryFieldHandle::addRaw(const void *buf, size_t len)
}
}
-DocBuilder::DocumentHandle::DocumentHandle(document::Document &doc,
- const vespalib::string & docId)
+DocBuilder::DocumentHandle::DocumentHandle(document::Document &doc, const vespalib::string & docId)
: _type(&doc.getType()),
_doc(&doc),
_fieldHandle(),
@@ -615,6 +615,27 @@ DocBuilder::DocumentHandle::DocumentHandle(document::Document &doc,
(void) docId;
}
+DocBuilder::DocumentHandle::~DocumentHandle() = default;
+
+void
+DocBuilder::DocumentHandle::startIndexField(const Schema::Field & sfield) {
+ _fieldHandle.reset(new IndexFieldHandle(_repo, _type->getField(sfield.getName()), sfield));
+}
+void
+DocBuilder::DocumentHandle::startAttributeField(const Schema::Field & sfield) {
+ _fieldHandle.reset(new AttributeFieldHandle(_type->getField(sfield.getName()), sfield));
+}
+void
+DocBuilder::DocumentHandle::startSummaryField(const Schema::Field & sfield) {
+ _fieldHandle.reset(new SummaryFieldHandle(_type->getField(sfield.getName()), sfield));
+}
+void
+DocBuilder::DocumentHandle::endField() {
+ _fieldHandle->onEndField();
+ _doc->setValue(_type->getField(_fieldHandle->getField().getName()), *_fieldHandle->getValue());
+ _fieldHandle.reset();
+}
+
DocBuilder::DocBuilder(const Schema &schema)
: _schema(schema),
_doctypes_config(DocTypeBuilder(schema).makeConfig()),
diff --git a/searchlib/src/vespa/searchlib/index/docbuilder.h b/searchlib/src/vespa/searchlib/index/docbuilder.h
index 2ee28c90827..a22096cfdbe 100644
--- a/searchlib/src/vespa/searchlib/index/docbuilder.h
+++ b/searchlib/src/vespa/searchlib/index/docbuilder.h
@@ -3,7 +3,6 @@
#pragma once
#include "doctypebuilder.h"
-#include <vespa/document/datatype/datatypes.h>
#include <vespa/document/repo/fixedtyperepo.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
#include <vespa/document/annotation/annotation.h>
@@ -232,21 +231,12 @@ private:
document::FixedTypeRepo _repo;
public:
DocumentHandle(document::Document &doc, const vespalib::string & docId);
+ ~DocumentHandle();
const FieldHandle::SP & getFieldHandle() const { return _fieldHandle; }
- void startIndexField(const Schema::Field & sfield) {
- _fieldHandle.reset(new IndexFieldHandle(_repo, _type->getField(sfield.getName()), sfield));
- }
- void startAttributeField(const Schema::Field & sfield) {
- _fieldHandle.reset(new AttributeFieldHandle(_type->getField(sfield.getName()), sfield));
- }
- void startSummaryField(const Schema::Field & sfield) {
- _fieldHandle.reset(new SummaryFieldHandle(_type->getField(sfield.getName()), sfield));
- }
- void endField() {
- _fieldHandle->onEndField();
- _doc->setValue(_type->getField(_fieldHandle->getField().getName()), *_fieldHandle->getValue());
- _fieldHandle.reset();
- }
+ void startIndexField(const Schema::Field & sfield);
+ void startAttributeField(const Schema::Field & sfield);
+ void startSummaryField(const Schema::Field & sfield);
+ void endField();
void endDocument(const document::Document::UP & doc) {
(void) doc;
}
diff --git a/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp b/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp
index 1ddfbff54a8..2b81b8c3a57 100644
--- a/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp
+++ b/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp
@@ -3,7 +3,9 @@
#include "doctypebuilder.h"
#include <vespa/document/datatype/urldatatype.h>
#include <vespa/document/datatype/tensor_data_type.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/repo/configbuilder.h>
+#include <set>
using namespace document;
diff --git a/searchlib/src/vespa/searchlib/index/doctypebuilder.h b/searchlib/src/vespa/searchlib/index/doctypebuilder.h
index c66ae66e250..4db0ba5b0e3 100644
--- a/searchlib/src/vespa/searchlib/index/doctypebuilder.h
+++ b/searchlib/src/vespa/searchlib/index/doctypebuilder.h
@@ -4,7 +4,6 @@
#include "schema_index_fields.h"
#include <vespa/document/config/config-documenttypes.h>
-#include <vespa/document/datatype/datatypes.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
#include <vespa/vespalib/util/exception.h>
#include <vespa/vespalib/util/stringfmt.h>
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h b/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h
index 36dd6339b54..1c1998fb423 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h
@@ -4,10 +4,10 @@
#include "i_field_index_remove_listener.h"
#include <vespa/document/annotation/span.h>
-#include <vespa/document/datatype/datatypes.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/searchlib/index/docidandfeatures.h>
#include <vespa/vespalib/stllike/allocator.h>
+#include <vespa/vespalib/stllike/hash_map.h>
#include <limits>
namespace search::index {
diff --git a/searchsummary/src/tests/docsummary/matched_elements_filter/matched_elements_filter_test.cpp b/searchsummary/src/tests/docsummary/matched_elements_filter/matched_elements_filter_test.cpp
index 8de9a9614da..de6b704189d 100644
--- a/searchsummary/src/tests/docsummary/matched_elements_filter/matched_elements_filter_test.cpp
+++ b/searchsummary/src/tests/docsummary/matched_elements_filter/matched_elements_filter_test.cpp
@@ -1,8 +1,14 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/document/datatype/datatype.h>
-#include <vespa/document/datatype/structdatatype.h>
-#include <vespa/document/document.h>
+#include <vespa/document/datatype/documenttype.h>
+#include <vespa/document/datatype/arraydatatype.h>
+#include <vespa/document/datatype/mapdatatype.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
+#include <vespa/document/fieldvalue/intfieldvalue.h>
+#include <vespa/document/fieldvalue/rawfieldvalue.h>
+#include <vespa/document/fieldvalue/arrayfieldvalue.h>
+#include <vespa/document/fieldvalue/mapfieldvalue.h>
+#include <vespa/document/fieldvalue//document.h>
#include <vespa/searchcommon/attribute/config.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/attributevector.h>
diff --git a/storage/src/tests/distributor/externaloperationhandlertest.cpp b/storage/src/tests/distributor/externaloperationhandlertest.cpp
index 9ce64ff98a1..27855091257 100644
--- a/storage/src/tests/distributor/externaloperationhandlertest.cpp
+++ b/storage/src/tests/distributor/externaloperationhandlertest.cpp
@@ -6,6 +6,8 @@
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/document/update/assignvalueupdate.h>
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/storage/common/reindexing_constants.h>
#include <vespa/storage/distributor/top_level_distributor.h>
#include <vespa/storage/distributor/distributor_bucket_space.h>
diff --git a/storage/src/tests/distributor/getoperationtest.cpp b/storage/src/tests/distributor/getoperationtest.cpp
index dfe4f09de3f..6b27af63fb7 100644
--- a/storage/src/tests/distributor/getoperationtest.cpp
+++ b/storage/src/tests/distributor/getoperationtest.cpp
@@ -7,6 +7,7 @@
#include <vespa/document/config/config-documenttypes.h>
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/bucketdb/bucketdatabase.h>
#include <vespa/storage/distributor/top_level_distributor.h>
diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
index 509f417baf1..fae2a3d0982 100644
--- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
+++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp
@@ -3,9 +3,9 @@
#include <tests/distributor/distributor_stripe_test_util.h>
#include <vespa/config/helper/configgetter.h>
#include <vespa/document/base/testdocrepo.h>
-#include <vespa/document/config/documenttypes_config_fwd.h>
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/fieldvalue/intfieldvalue.h>
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/document/update/arithmeticvalueupdate.h>
#include <vespa/storage/distributor/top_level_distributor.h>
diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
index 407bef5f8bc..46310819a59 100644
--- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
+++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
@@ -11,6 +11,10 @@
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/document/update/assignvalueupdate.h>
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/fieldvalue/intfieldvalue.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/fastos/file.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <vespa/persistence/spi/test.h>
diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp
index c35be2789da..6974319dc72 100644
--- a/storage/src/tests/persistence/persistencetestutils.cpp
+++ b/storage/src/tests/persistence/persistencetestutils.cpp
@@ -6,11 +6,11 @@
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/document/update/assignvalueupdate.h>
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
#include <vespa/persistence/spi/test.h>
#include <vespa/storage/persistence/filestorage/filestorhandlerimpl.h>
#include <vespa/storage/persistence/persistencehandler.h>
-#include <vespa/storageapi/message/persistence.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/exceptions.h>
diff --git a/storage/src/tests/persistence/processalltest.cpp b/storage/src/tests/persistence/processalltest.cpp
index 51fe4ef4bd3..a02167bb08a 100644
--- a/storage/src/tests/persistence/processalltest.cpp
+++ b/storage/src/tests/persistence/processalltest.cpp
@@ -7,6 +7,7 @@
#include <tests/persistence/persistencetestutils.h>
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/fieldvalue/intfieldvalue.h>
using document::test::makeDocumentBucket;
using namespace ::testing;
diff --git a/storage/src/tests/persistence/testandsettest.cpp b/storage/src/tests/persistence/testandsettest.cpp
index 8cf89b55ad0..816fd7871d3 100644
--- a/storage/src/tests/persistence/testandsettest.cpp
+++ b/storage/src/tests/persistence/testandsettest.cpp
@@ -7,6 +7,7 @@
#include <vespa/document/fieldvalue/fieldvalues.h>
#include <vespa/document/update/documentupdate.h>
#include <vespa/document/update/assignvalueupdate.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/persistence/spi/test.h>
#include <vespa/persistence/spi/persistenceprovider.h>
diff --git a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
index 1aaca53d15a..4c83dde30da 100644
--- a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
+++ b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp
@@ -13,6 +13,7 @@
#include <vespa/storageapi/message/persistence.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/storage/storageserver/changedbucketownershiphandler.h>
#include <vespa/vdslib/distribution/distribution.h>
diff --git a/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp b/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp
index 07b009bf981..cd80244af87 100644
--- a/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp
+++ b/storage/src/tests/storageserver/rpc/storage_api_rpc_service_test.cpp
@@ -3,6 +3,9 @@
#include <tests/common/testhelper.h>
#include <vespa/document/base/testdocman.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/fieldvalue/stringfieldvalue.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/fnet/frt/supervisor.h>
#include <vespa/fnet/frt/target.h>
diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp
index f159bf85d22..4de7df7b366 100644
--- a/storage/src/tests/visiting/visitortest.cpp
+++ b/storage/src/tests/visiting/visitortest.cpp
@@ -3,6 +3,7 @@
#include <vespa/config/common/exceptions.h>
#include <vespa/document/fieldvalue/intfieldvalue.h>
#include <vespa/document/fieldvalue/stringfieldvalue.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/test/make_bucket_space.h>
#include <vespa/documentapi/messagebus/messages/putdocumentmessage.h>
#include <vespa/documentapi/messagebus/messages/removedocumentmessage.h>
diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
index 6a00ddc8d8e..1775658c0e9 100644
--- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
+++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
@@ -12,8 +12,10 @@
#include <vespa/storageapi/message/visitor.h>
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/document/base/testdocman.h>
-#include <vespa/document/document.h>
+#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/update/assignvalueupdate.h>
#include <vespa/document/update/fieldpathupdates.h>
+#include <vespa/document/fieldvalue/intfieldvalue.h>
#include <vespa/document/test/make_document_bucket.h>
#include <vespa/document/test/make_bucket_space.h>
#include <vespa/vespalib/util/growablebytebuffer.h>