summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-06-07 01:08:19 +0200
committerGitHub <noreply@github.com>2017-06-07 01:08:19 +0200
commit51b908469dee1a0d291cd87c14c08aac6588c550 (patch)
tree6cf9a9042c97bb665699625d39d54241ddd6422b
parent9f630dab6b22f50245d6e4379334f75d02864e1f (diff)
parent1bfdfd1f10c32b8f6e70d49f6d08e89d416c9a61 (diff)
Merge pull request #2625 from yahoo/balder/forward-declare-in-config-rebase-1
Balder/forward declare in config rebase 1
-rw-r--r--config/src/tests/configholder/configholder.cpp2
-rw-r--r--config/src/tests/subscription/subscription.cpp4
-rw-r--r--config/src/vespa/config/common/configcontext.h2
-rw-r--r--config/src/vespa/config/common/configparser.cpp7
-rw-r--r--config/src/vespa/config/common/configparser.h6
-rw-r--r--config/src/vespa/config/common/exceptions.cpp1
-rw-r--r--configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java45
-rw-r--r--document/src/tests/arrayfieldvaluetest.cpp1
-rw-r--r--document/src/tests/documentcalculatortestcase.cpp63
-rw-r--r--document/src/tests/documenttestcase.cpp3
-rw-r--r--document/src/tests/primitivefieldvaluetest.cpp1
-rw-r--r--document/src/tests/structfieldvaluetest.cpp2
-rw-r--r--document/src/tests/testxml.cpp2
-rw-r--r--document/src/tests/weightedsetfieldvaluetest.cpp1
-rw-r--r--document/src/vespa/document/annotation/spantree.cpp2
-rw-r--r--document/src/vespa/document/annotation/spantree.h1
-rw-r--r--document/src/vespa/document/base/documentcalculator.cpp5
-rw-r--r--document/src/vespa/document/base/documentcalculator.h8
-rw-r--r--document/src/vespa/document/base/exceptions.cpp1
-rw-r--r--document/src/vespa/document/base/field.cpp1
-rw-r--r--document/src/vespa/document/base/forcelink.cpp2
-rw-r--r--document/src/vespa/document/base/globalid.cpp1
-rw-r--r--document/src/vespa/document/base/idstring.cpp1
-rw-r--r--document/src/vespa/document/bucket/bucketid.cpp1
-rw-r--r--document/src/vespa/document/bucket/bucketselector.cpp1
-rw-r--r--document/src/vespa/document/datatype/annotationreferencedatatype.cpp1
-rw-r--r--document/src/vespa/document/datatype/documenttype.cpp1
-rw-r--r--document/src/vespa/document/datatype/primitivedatatype.cpp1
-rw-r--r--document/src/vespa/document/datatype/structdatatype.cpp5
-rw-r--r--document/src/vespa/document/fieldset/fieldsets.cpp1
-rw-r--r--document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp1
-rw-r--r--document/src/vespa/document/fieldvalue/document.cpp9
-rw-r--r--document/src/vespa/document/fieldvalue/document.h6
-rw-r--r--document/src/vespa/document/fieldvalue/fieldvalue.cpp17
-rw-r--r--document/src/vespa/document/fieldvalue/fieldvalue.h18
-rw-r--r--document/src/vespa/document/fieldvalue/serializablearray.cpp40
-rw-r--r--document/src/vespa/document/fieldvalue/serializablearray.h52
-rw-r--r--document/src/vespa/document/fieldvalue/structfieldvalue.cpp32
-rw-r--r--document/src/vespa/document/fieldvalue/structfieldvalue.h30
-rw-r--r--document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp2
-rw-r--r--document/src/vespa/document/repo/documenttyperepo.cpp69
-rw-r--r--document/src/vespa/document/repo/documenttyperepo.h6
-rw-r--r--document/src/vespa/document/select/branch.cpp2
-rw-r--r--document/src/vespa/document/select/constant.cpp11
-rw-r--r--document/src/vespa/document/select/context.cpp26
-rw-r--r--document/src/vespa/document/select/context.h36
-rw-r--r--document/src/vespa/document/select/doctype.cpp7
-rw-r--r--document/src/vespa/document/select/invalidconstant.cpp10
-rw-r--r--document/src/vespa/document/select/operator.cpp7
-rw-r--r--document/src/vespa/document/select/value.cpp1
-rw-r--r--document/src/vespa/document/select/valuenode.cpp16
-rw-r--r--document/src/vespa/document/select/valuenode.h22
-rw-r--r--document/src/vespa/document/select/variablemap.h15
-rw-r--r--document/src/vespa/document/serialization/vespadocumentdeserializer.cpp1
-rw-r--r--document/src/vespa/document/serialization/vespadocumentserializer.cpp2
-rw-r--r--document/src/vespa/document/update/assignfieldpathupdate.cpp10
-rw-r--r--document/src/vespa/document/update/clearvalueupdate.cpp6
-rw-r--r--document/src/vespa/document/update/documentupdate.cpp28
-rw-r--r--document/src/vespa/document/update/documentupdate.h18
-rw-r--r--document/src/vespa/document/update/fieldupdate.cpp1
-rw-r--r--documentapi/src/tests/messagebus/messagebus_test.cpp1
-rw-r--r--documentapi/src/tests/messages/messages50test.cpp1
-rw-r--r--documentapi/src/tests/messages/messages52test.cpp1
-rw-r--r--documentapi/src/tests/policies/policies_test.cpp2
-rw-r--r--documentapi/src/vespa/documentapi/loadtypes/loadtypeset.cpp1
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.cpp1
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp4
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp20
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h13
-rw-r--r--documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp1
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_tensor_builder.cpp1
-rw-r--r--fastos/src/tests/tests.h1
-rw-r--r--fastos/src/vespa/fastos/app.h2
-rw-r--r--fastos/src/vespa/fastos/unix_process.h2
-rw-r--r--filedistribution/src/vespa/filedistribution/distributor/filedownloader.cpp1
-rw-r--r--filedistribution/src/vespa/filedistribution/distributor/hostname.cpp3
-rw-r--r--filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp1
-rw-r--r--filedistribution/src/vespa/filedistribution/model/zkfacade.cpp10
-rw-r--r--filedistribution/src/vespa/filedistribution/model/zkfiledbmodel.cpp1
-rw-r--r--fnet/src/tests/sync_execute/sync_execute.cpp1
-rw-r--r--memfilepersistence/src/tests/device/devicemanagertest.cpp1
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/common/types.cpp22
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/common/types.h16
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp3
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/spi/joinoperationhandler.cpp1
-rw-r--r--messagebus/src/vespa/messagebus/testlib/slobrok.cpp1
-rw-r--r--metrics/src/vespa/metrics/metric.cpp1
-rw-r--r--metrics/src/vespa/metrics/metricmanager.cpp2
-rw-r--r--metrics/src/vespa/metrics/metricset.cpp2
-rw-r--r--metrics/src/vespa/metrics/printutils.cpp1
-rw-r--r--metrics/src/vespa/metrics/summetric.hpp1
-rw-r--r--metrics/src/vespa/metrics/valuemetric.hpp1
-rw-r--r--metrics/src/vespa/metrics/valuemetricvalues.hpp1
-rw-r--r--persistence/src/tests/proxy/providerproxy_test.cpp1
-rw-r--r--persistence/src/tests/proxy/providerstub_test.cpp1
-rw-r--r--persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp1
-rw-r--r--persistence/src/vespa/persistence/proxy/providerproxy.cpp3
-rw-r--r--persistence/src/vespa/persistence/spi/docentry.cpp1
-rw-r--r--searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp1
-rw-r--r--searchcore/src/tests/proton/common/cachedselect_test.cpp1
-rw-r--r--searchcore/src/tests/proton/common/selectpruner_test.cpp1
-rw-r--r--searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp1
-rw-r--r--searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp1
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdb_test.cpp7
-rw-r--r--searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp1
-rw-r--r--searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp7
-rw-r--r--searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp1
-rw-r--r--searchcore/src/tests/proton/server/documentretriever_test.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchview.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp18
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/bucketdocuments.h1
-rw-r--r--searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp1
-rw-r--r--searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp1
-rw-r--r--searchlib/src/tests/engine/transportserver/transportserver_test.cpp2
-rw-r--r--searchlib/src/tests/features/element_completeness/element_completeness_test.cpp1
-rw-r--r--searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp1
-rw-r--r--searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp1
-rw-r--r--searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp1
-rw-r--r--searchlib/src/tests/features/prod_features_fieldtermmatch.cpp5
-rw-r--r--searchlib/src/tests/features/raw_score/raw_score_test.cpp1
-rw-r--r--searchlib/src/tests/features/subqueries/subqueries_test.cpp1
-rw-r--r--searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/docstore/chunkformat.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/docstore/chunkformats.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/docstore/documentstore.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/docstore/visitcache.cpp7
-rw-r--r--searchlib/src/vespa/searchlib/docstore/visitcache.h6
-rw-r--r--searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/expression/resultnode.cpp15
-rw-r--r--searchlib/src/vespa/searchlib/expression/resultnode.h9
-rw-r--r--searchlib/src/vespa/searchlib/fef/test/ftlib.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/query/querynoderesultbase.h1
-rw-r--r--searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h1
-rw-r--r--slobrok/src/vespa/slobrok/server/rpc_server_manager.cpp1
-rw-r--r--staging_vespalib/src/vespa/vespalib/encoding/base64.cpp9
-rw-r--r--staging_vespalib/src/vespa/vespalib/net/http_server.cpp2
-rw-r--r--staging_vespalib/src/vespa/vespalib/objects/cloneable.h2
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp1
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/jsonstream.cpp11
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/librarypool.cpp12
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/programoptions.cpp5
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp4
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/xmlserializable.hpp2
-rw-r--r--storage/src/tests/bucketdb/bucketmanagertest.cpp1
-rw-r--r--storage/src/tests/persistence/filestorage/filestormanagertest.cpp1
-rw-r--r--storage/src/tests/persistence/splitbitdetectortest.cpp2
-rw-r--r--storage/src/tests/storageserver/documentapiconvertertest.cpp1
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketmanager.cpp1
-rw-r--r--storage/src/vespa/storage/bucketmover/bucketmover.cpp1
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp1
-rw-r--r--storage/src/vespa/storage/distributor/operations/operation.cpp1
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp1
-rw-r--r--storage/src/vespa/storage/storageserver/mergethrottler.cpp2
-rw-r--r--storage/src/vespa/storage/storageserver/messagesink.cpp1
-rw-r--r--storage/src/vespa/storage/tools/generatedistributionbits.cpp2
-rw-r--r--storage/src/vespa/storage/visiting/countvisitor.cpp1
-rw-r--r--storage/src/vespa/storage/visiting/visitor.cpp2
-rw-r--r--storage/src/vespa/storage/visiting/visitormanager.cpp3
-rw-r--r--storageapi/src/vespa/storageapi/message/batch.cpp2
-rw-r--r--storageapi/src/vespa/storageapi/message/bucket.cpp8
-rw-r--r--storageapi/src/vespa/storageapi/message/persistence.cpp1
-rw-r--r--streamingvisitors/src/tests/hitcollector/hitcollector.cpp1
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp1
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp4
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp1
-rw-r--r--vdslib/src/tests/container/documentlisttest.cpp1
-rw-r--r--vdslib/src/vespa/vdslib/container/documentlist.cpp3
-rw-r--r--vdslib/src/vespa/vdslib/container/mutabledocumentlist.cpp1
-rw-r--r--vdslib/src/vespa/vdslib/container/operationlist.cpp4
-rw-r--r--vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp1
-rw-r--r--vespaclient/src/vespa/vespaclient/spoolmaster/application.cpp6
-rw-r--r--vespaclient/src/vespa/vespaclient/vespadoclocator/locator.cpp3
-rw-r--r--vespaclient/src/vespa/vespaclient/vesparoute/application.cpp2
-rw-r--r--vespalib/src/tests/atomic/atomic_bench.cpp1
-rw-r--r--vespalib/src/tests/atomic/atomic_test.cpp6
-rw-r--r--vespalib/src/tests/benchmark_timer/benchmark_timer_test.cpp12
-rw-r--r--vespalib/src/tests/delegatelist/delegatelist.cpp5
-rw-r--r--vespalib/src/tests/exception_classes/exception_classes_test.cpp1
-rw-r--r--vespalib/src/tests/time/time_box_test.cpp6
-rw-r--r--vespalib/src/vespa/vespalib/io/fileutil.cpp10
-rw-r--r--vespalib/src/vespa/vespalib/objects/nbostream.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/buffer.h2
-rw-r--r--vespalib/src/vespa/vespalib/util/exception.h1
-rw-r--r--vespalib/src/vespa/vespalib/util/exceptions.h1
-rw-r--r--vespalib/src/vespa/vespalib/util/memory.h4
-rw-r--r--vespalib/src/vespa/vespalib/util/sync.h1
-rw-r--r--vespalog/src/test/threads/testthreads.cpp2
-rw-r--r--vsm/src/tests/docsum/docsum.cpp3
-rw-r--r--vsm/src/tests/document/document.cpp2
-rw-r--r--vsm/src/vespa/vsm/common/documenttypemapping.cpp1
-rw-r--r--vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp1
-rw-r--r--vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp1
203 files changed, 654 insertions, 445 deletions
diff --git a/config/src/tests/configholder/configholder.cpp b/config/src/tests/configholder/configholder.cpp
index 8901ba65ad4..c103f86f6e9 100644
--- a/config/src/tests/configholder/configholder.cpp
+++ b/config/src/tests/configholder/configholder.cpp
@@ -61,7 +61,7 @@ TEST_MT_F("Require that wait is interrupted", 2, ConfigHolder)
TEST_BARRIER();
} else {
TEST_BARRIER();
- FastOS_Thread::Sleep(500);
+ std::this_thread::sleep_for(std::chrono::milliseconds(500));
f.interrupt();
TEST_BARRIER();
}
diff --git a/config/src/tests/subscription/subscription.cpp b/config/src/tests/subscription/subscription.cpp
index 5974279518a..52b9ec624ac 100644
--- a/config/src/tests/subscription/subscription.cpp
+++ b/config/src/tests/subscription/subscription.cpp
@@ -79,7 +79,7 @@ TEST_MT_F("requireThatNextUpdateReturnsWhenNotified", 2, SubscriptionFixture(Con
ASSERT_TRUE(f1.sub.nextUpdate(2, 5000));
ASSERT_TRUE(timer.MilliSecsToNow() > 200.0);
} else {
- FastOS_Thread::Sleep(500);
+ std::this_thread::sleep_for(std::chrono::milliseconds(500));
f1.holder->handle(ConfigUpdate::UP(new ConfigUpdate(ConfigValue(), 1, 1)));
}
}
@@ -94,7 +94,7 @@ TEST_MT_F("requireThatNextUpdateReturnsInterrupted", 2, SubscriptionFixture(Conf
ASSERT_TRUE(f1.sub.nextUpdate(1, 5000));
ASSERT_TRUE(timer.MilliSecsToNow() > 300.0);
} else {
- FastOS_Thread::Sleep(500);
+ std::this_thread::sleep_for(std::chrono::milliseconds(500));
f1.sub.close();
}
}
diff --git a/config/src/vespa/config/common/configcontext.h b/config/src/vespa/config/common/configcontext.h
index c00bceaef47..4f19be9a928 100644
--- a/config/src/vespa/config/common/configcontext.h
+++ b/config/src/vespa/config/common/configcontext.h
@@ -5,8 +5,6 @@
#include "timingvalues.h"
#include "configmanager.h"
#include <vespa/config/subscription/sourcespec.h>
-#include <vespa/vespalib/util/sync.h>
-#include <vespa/vespalib/stllike/hash_map.h>
namespace config {
diff --git a/config/src/vespa/config/common/configparser.cpp b/config/src/vespa/config/common/configparser.cpp
index fde55f257dc..e0a0b0138b9 100644
--- a/config/src/vespa/config/common/configparser.cpp
+++ b/config/src/vespa/config/common/configparser.cpp
@@ -1,9 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/config/common/configparser.h>
-#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/stllike/asciistream.h>
-#include <stdio.h>
+
+#include "configparser.h"
#include "misc.h"
+#include <vespa/vespalib/stllike/asciistream.h>
namespace config {
diff --git a/config/src/vespa/config/common/configparser.h b/config/src/vespa/config/common/configparser.h
index 3b1185a48fa..613dfc33d94 100644
--- a/config/src/vespa/config/common/configparser.h
+++ b/config/src/vespa/config/common/configparser.h
@@ -2,12 +2,12 @@
#pragma once
#include <vespa/config/common/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <map>
#include <set>
#include <vector>
-#include <errno.h>
-#include <stdint.h>
-#include <vespa/vespalib/stllike/string.h>
+#include <cerrno>
+#include <cstdint>
namespace config {
diff --git a/config/src/vespa/config/common/exceptions.cpp b/config/src/vespa/config/common/exceptions.cpp
index d19c27b5999..b5cbe7f0e06 100644
--- a/config/src/vespa/config/common/exceptions.cpp
+++ b/config/src/vespa/config/common/exceptions.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "exceptions.h"
+#include <vespa/vespalib/util/stringfmt.h>
namespace config {
diff --git a/configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java b/configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java
index 997416e5bfc..49f5275c7fe 100644
--- a/configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java
+++ b/configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java
@@ -8,10 +8,12 @@ import java.io.IOException;
import java.io.FileReader;
import java.io.StringWriter;
import java.io.Writer;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+import java.util.Arrays;
import java.util.StringTokenizer;
+import java.util.stream.Collectors;
/**
@@ -189,15 +191,19 @@ public class CppClassBuilder implements ClassBuilder {
}
void writeNameSpaceBegin(Writer w, String [] namespaceList) throws IOException {
- for (int i = 0; i < namespaceList.length; i++) {
- w.write("namespace " + namespaceList[i] + " {\n\n");
- }
+ w.write("namespace ");
+ w.write(getNestedNameSpace(namespaceList));
+ w.write(" {\n");
+ }
+
+ String getNestedNameSpace(String [] namespaceList) {
+ return Arrays.stream(namespaceList).map(String::toString).collect(Collectors.joining("::"));
}
void writeNameSpaceEnd(Writer w, String [] namespaceList) throws IOException {
- for (int i = 0; i < namespaceList.length; i++) {
- w.write("} // namespace " + namespaceList[i] + "\n\n");
- }
+ w.write("} // namespace ");
+ w.write(getNestedNameSpace(namespaceList));
+ w.write("\n");
}
void writeHeaderHeader(Writer w, CNode root) throws IOException {
@@ -229,17 +235,21 @@ public class CppClassBuilder implements ClassBuilder {
+ "#ifndef CLOUD_CONFIG_" + defineName + "_H\n"
+ "#define CLOUD_CONFIG_" + defineName + "_H\n"
+ "\n"
- + "#include <vespa/config/common/configvalue.h>\n"
- + "#include <vespa/config/configgen/configpayload.h>\n"
+ "#include <vespa/config/configgen/configinstance.h>\n"
- + "#include <vespa/config/print/configdatabuffer.h>\n"
+ "#include <vespa/vespalib/stllike/string.h>\n"
+ "#include <vector>\n"
+ "#include <map>\n"
+ "\n");
+ w.write("namespace config {\n");
+ w.write(" class ConfigValue;\n");
+ w.write(" class ConfigPayload;\n");
+ w.write("}\n\n");
+ w.write("namespace vespalib::slime {\n");
+ w.write(" class Inspector;\n");
+ w.write(" class Cursor;\n");
+ w.write("}\n\n");
writeNameSpaceBegin(w, namespaceList);
- w.write("\n");
- w.write("namespace internal {\n\n");
+ w.write("\nnamespace internal {\n\n");
w.write(""
+ "/**\n"
+ " * This class contains the config. DO NOT USE THIS CLASS DIRECTLY. Use the typedeffed\n"
@@ -551,17 +561,18 @@ public class CppClassBuilder implements ClassBuilder {
w.write("#include <" + subdir + "/" + getFileName(root, "h") + ">");
}
w.write("\n");
+ w.write("#include <vespa/config/common/configvalue.h>\n");
+ w.write("#include <vespa/config/configgen/configpayload.h>\n");
+ w.write("#include <vespa/config/print/configdatabuffer.h>\n");
w.write("#include <vespa/config/common/configparser.h>\n");
w.write("#include <vespa/config/configgen/vector_inserter.h>\n");
w.write("#include <vespa/config/configgen/map_inserter.h>\n");
w.write("#include <vespa/vespalib/data/slime/convenience.h>\n");
w.write("#include <vespa/vespalib/data/slime/slime.h>\n");
w.write("#include <vespa/vespalib/stllike/asciistream.h>\n");
- w.write("#include <set>\n");
- w.write("\n\n");
- writeNameSpaceBegin(w, generateCppNameSpace(root));
w.write("\n");
- w.write("namespace internal {\n\n");
+ writeNameSpaceBegin(w, generateCppNameSpace(root));
+ w.write("\nnamespace internal {\n\n");
w.write("using ::config::ConfigParser;\n");
w.write("using ::config::InvalidConfigException;\n");
w.write("using ::config::ConfigInstance;\n");
diff --git a/document/src/tests/arrayfieldvaluetest.cpp b/document/src/tests/arrayfieldvaluetest.cpp
index 7f31e0c3b3a..0535edc495b 100644
--- a/document/src/tests/arrayfieldvaluetest.cpp
+++ b/document/src/tests/arrayfieldvaluetest.cpp
@@ -4,6 +4,7 @@
#include <vespa/document/serialization/vespadocumentdeserializer.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/document/util/bytebuffer.h>
using vespalib::nbostream;
diff --git a/document/src/tests/documentcalculatortestcase.cpp b/document/src/tests/documentcalculatortestcase.cpp
index a292302ad61..bc112c80a8c 100644
--- a/document/src/tests/documentcalculatortestcase.cpp
+++ b/document/src/tests/documentcalculatortestcase.cpp
@@ -9,6 +9,7 @@
#include <vespa/document/fieldvalue/intfieldvalue.h>
#include <vespa/document/fieldvalue/longfieldvalue.h>
#include <vespa/document/fieldvalue/floatfieldvalue.h>
+#include <vespa/document/select/variablemap.h>
#include <vespa/vespalib/util/exceptions.h>
namespace document {
@@ -52,46 +53,42 @@ CPPUNIT_TEST_SUITE_REGISTRATION(DocumentCalculatorTest);
void
DocumentCalculatorTest::testConstant() {
- DocumentCalculator::VariableMap variables;
+ auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "4.0");
- Document doc(*_testRepo.getDocumentType("testdoctype1"),
- DocumentId("doc:test:foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
}
void
DocumentCalculatorTest::testSimple() {
- DocumentCalculator::VariableMap variables;
+ auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(3 + 5) / 2");
- Document doc(*_testRepo.getDocumentType("testdoctype1"),
- DocumentId("doc:test:foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
}
void
DocumentCalculatorTest::testVariables() {
- DocumentCalculator::VariableMap variables;
- variables["x"] = 3.0;
- variables["y"] = 5.0;
+ auto variables = std::make_unique<select::VariableMap>();
+ (*variables)["x"] = 3.0;
+ (*variables)["y"] = 5.0;
DocumentCalculator calc(getRepo(), "($x + $y) / 2");
- Document doc(*_testRepo.getDocumentType("testdoctype1"),
- DocumentId("doc:test:foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
}
void
DocumentCalculatorTest::testFields() {
- DocumentCalculator::VariableMap variables;
- variables["x"] = 3.0;
- variables["y"] = 5.0;
+ auto variables = std::make_unique<select::VariableMap>();
+ (*variables)["x"] = 3.0;
+ (*variables)["y"] = 5.0;
DocumentCalculator calc(getRepo(), "(testdoctype1.headerval + testdoctype1"
".hfloatval) / testdoctype1.headerlongval");
- Document doc(*_testRepo.getDocumentType("testdoctype1"),
- DocumentId("doc:test:foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("headerval"), IntFieldValue(5));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
@@ -100,14 +97,13 @@ DocumentCalculatorTest::testFields() {
void
DocumentCalculatorTest::testFieldsDivZero() {
- DocumentCalculator::VariableMap variables;
- variables["x"] = 3.0;
- variables["y"] = 5.0;
+ auto variables = std::make_unique<select::VariableMap>();
+ (*variables)["x"] = 3.0;
+ (*variables)["y"] = 5.0;
DocumentCalculator calc(getRepo(), "(testdoctype1.headerval + testdoctype1"
".hfloatval) / testdoctype1.headerlongval");
- Document doc(*_testRepo.getDocumentType("testdoctype1"),
- DocumentId("doc:test:foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("headerval"), IntFieldValue(5));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(0));
@@ -121,11 +117,10 @@ DocumentCalculatorTest::testFieldsDivZero() {
void
DocumentCalculatorTest::testDivideByZero() {
- DocumentCalculator::VariableMap variables;
+ auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(3 + 5) / 0");
- Document doc(*_testRepo.getDocumentType("testdoctype1"),
- DocumentId("doc:test:foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
try {
calc.evaluate(doc, std::move(variables));
CPPUNIT_ASSERT(false);
@@ -136,11 +131,10 @@ DocumentCalculatorTest::testDivideByZero() {
void
DocumentCalculatorTest::testModByZero() {
- DocumentCalculator::VariableMap variables;
+ auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(3 + 5) % 0");
- Document doc(*_testRepo.getDocumentType("testdoctype1"),
- DocumentId("doc:test:foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
try {
calc.evaluate(doc, std::move(variables));
CPPUNIT_ASSERT(false);
@@ -151,12 +145,11 @@ DocumentCalculatorTest::testModByZero() {
void
DocumentCalculatorTest::testFieldNotSet() {
- DocumentCalculator::VariableMap variables;
+ auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "(testdoctype1.headerval + testdoctype1"
".hfloatval) / testdoctype1.headerlongval");
- Document doc(*_testRepo.getDocumentType("testdoctype1"),
- DocumentId("doc:test:foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
try {
@@ -169,13 +162,12 @@ DocumentCalculatorTest::testFieldNotSet() {
void
DocumentCalculatorTest::testFieldNotFound() {
- DocumentCalculator::VariableMap variables;
+ auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(),
"(testdoctype1.mynotfoundfield + testdoctype1"
".hfloatval) / testdoctype1.headerlongval");
- Document doc(*_testRepo.getDocumentType("testdoctype1"),
- DocumentId("doc:test:foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
try {
@@ -188,11 +180,10 @@ DocumentCalculatorTest::testFieldNotFound() {
void
DocumentCalculatorTest::testByteSubtractionZeroResult() {
- DocumentCalculator::VariableMap variables;
+ auto variables = std::make_unique<select::VariableMap>();
DocumentCalculator calc(getRepo(), "testdoctype1.byteval - 3");
- Document doc(*_testRepo.getDocumentType("testdoctype1"),
- DocumentId("doc:test:foo"));
+ Document doc(*_testRepo.getDocumentType("testdoctype1"), DocumentId("doc:test:foo"));
doc.setValue(doc.getField("byteval"), ByteFieldValue(3));
CPPUNIT_ASSERT_EQUAL(0.0, calc.evaluate(doc, std::move(variables)));
}
diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp
index b100487a94e..3bbd5178055 100644
--- a/document/src/tests/documenttestcase.cpp
+++ b/document/src/tests/documenttestcase.cpp
@@ -11,6 +11,7 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/document/util/serializableexceptions.h>
+#include <vespa/document/util/bytebuffer.h>
using vespalib::nbostream;
@@ -75,7 +76,7 @@ void DocumentTest::testSizeOf()
CPPUNIT_ASSERT_EQUAL(120ul, sizeof(Document));
CPPUNIT_ASSERT_EQUAL(64ul, sizeof(StructFieldValue));
CPPUNIT_ASSERT_EQUAL(16ul, sizeof(StructuredFieldValue));
- CPPUNIT_ASSERT_EQUAL(120ul, sizeof(SerializableArray));
+ CPPUNIT_ASSERT_EQUAL(64ul, sizeof(SerializableArray));
}
void DocumentTest::testFieldPath()
diff --git a/document/src/tests/primitivefieldvaluetest.cpp b/document/src/tests/primitivefieldvaluetest.cpp
index 15fd6e00959..018408a2d02 100644
--- a/document/src/tests/primitivefieldvaluetest.cpp
+++ b/document/src/tests/primitivefieldvaluetest.cpp
@@ -4,6 +4,7 @@
#include <vespa/document/serialization/vespadocumentdeserializer.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/document/util/bytebuffer.h>
using vespalib::nbostream;
diff --git a/document/src/tests/structfieldvaluetest.cpp b/document/src/tests/structfieldvaluetest.cpp
index d6e585e0987..1b2fa17a79a 100644
--- a/document/src/tests/structfieldvaluetest.cpp
+++ b/document/src/tests/structfieldvaluetest.cpp
@@ -1,10 +1,12 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/serialization/vespadocumentdeserializer.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/document/util/bytebuffer.h>
using vespalib::nbostream;
using document::config_builder::Struct;
diff --git a/document/src/tests/testxml.cpp b/document/src/tests/testxml.cpp
index da328c7a63f..a9abae531fa 100644
--- a/document/src/tests/testxml.cpp
+++ b/document/src/tests/testxml.cpp
@@ -1,6 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/* $Id$*/
#include <vespa/document/base/testdocrepo.h>
#include <cppunit/extensions/HelperMacros.h>
@@ -8,6 +7,7 @@
#include <vespa/document/update/addvalueupdate.h>
#include <vespa/document/update/assignvalueupdate.h>
#include <vespa/document/update/removevalueupdate.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
#include <vespa/vespalib/text/stringtokenizer.h>
#include <vespa/vespalib/testkit/test_kit.h>
diff --git a/document/src/tests/weightedsetfieldvaluetest.cpp b/document/src/tests/weightedsetfieldvaluetest.cpp
index 81b98da297f..68b94cd2f16 100644
--- a/document/src/tests/weightedsetfieldvaluetest.cpp
+++ b/document/src/tests/weightedsetfieldvaluetest.cpp
@@ -4,6 +4,7 @@
#include <vespa/document/serialization/vespadocumentdeserializer.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/document/util/bytebuffer.h>
using vespalib::nbostream;
diff --git a/document/src/vespa/document/annotation/spantree.cpp b/document/src/vespa/document/annotation/spantree.cpp
index 199040ea8f6..61c7ac48817 100644
--- a/document/src/vespa/document/annotation/spantree.cpp
+++ b/document/src/vespa/document/annotation/spantree.cpp
@@ -1,9 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "spantree.h"
-#include "annotation.h"
#include "spannode.h"
-#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/stllike/asciistream.h>
using std::unique_ptr;
diff --git a/document/src/vespa/document/annotation/spantree.h b/document/src/vespa/document/annotation/spantree.h
index d53e9002598..06558cf6887 100644
--- a/document/src/vespa/document/annotation/spantree.h
+++ b/document/src/vespa/document/annotation/spantree.h
@@ -4,6 +4,7 @@
#include <vespa/document/annotation/annotation.h>
#include <vector>
+#include <cassert>
namespace document {
class SpanNode;
diff --git a/document/src/vespa/document/base/documentcalculator.cpp b/document/src/vespa/document/base/documentcalculator.cpp
index 7a83d80764c..24afdee3bd1 100644
--- a/document/src/vespa/document/base/documentcalculator.cpp
+++ b/document/src/vespa/document/base/documentcalculator.cpp
@@ -5,6 +5,7 @@
#include <vespa/document/select/compare.h>
#include <vespa/document/select/parser.h>
#include <vespa/document/select/valuenode.h>
+#include <vespa/document/select/variablemap.h>
#include <vespa/vespalib/util/exceptions.h>
namespace document {
@@ -21,13 +22,13 @@ DocumentCalculator::DocumentCalculator(
DocumentCalculator::~DocumentCalculator() { }
double
-DocumentCalculator::evaluate(const Document& doc, VariableMap && variables)
+DocumentCalculator::evaluate(const Document& doc, std::unique_ptr<select::VariableMap> variables)
{
select::Compare& compare(static_cast<select::Compare&>(*_selectionNode));
const select::ValueNode& left = compare.getLeft();
select::Context context(doc);
- context._variables = std::move(variables);
+ context.setVariableMap(std::move(variables));
std::unique_ptr<select::Value> value = left.getValue(context);
select::NumberValue* num = dynamic_cast<select::NumberValue*>(value.get());
diff --git a/document/src/vespa/document/base/documentcalculator.h b/document/src/vespa/document/base/documentcalculator.h
index 7e1feaf5688..fc9eb73dea2 100644
--- a/document/src/vespa/document/base/documentcalculator.h
+++ b/document/src/vespa/document/base/documentcalculator.h
@@ -2,18 +2,18 @@
#pragma once
#include <vespa/document/select/node.h>
-#include <vespa/vespalib/stllike/hash_map.h>
namespace document {
+
+namespace select { class VariableMap; }
+
class DocumentTypeRepo;
class DocumentCalculator {
public:
- using VariableMap = vespalib::hash_map<vespalib::string, double>;
-
DocumentCalculator(const DocumentTypeRepo& repo, const vespalib::string& expression);
~DocumentCalculator();
- double evaluate(const Document& doc, VariableMap && variables);
+ double evaluate(const Document& doc, std::unique_ptr<select::VariableMap> variables);
private:
std::unique_ptr<select::Node> _selectionNode;
diff --git a/document/src/vespa/document/base/exceptions.cpp b/document/src/vespa/document/base/exceptions.cpp
index 3e5c464b8b4..dbd3f2bd998 100644
--- a/document/src/vespa/document/base/exceptions.cpp
+++ b/document/src/vespa/document/base/exceptions.cpp
@@ -3,6 +3,7 @@
#include "exceptions.h"
#include <vespa/document/datatype/datatype.h>
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/vespalib/util/stringfmt.h>
namespace document {
diff --git a/document/src/vespa/document/base/field.cpp b/document/src/vespa/document/base/field.cpp
index d62623b64b9..d00fd42081c 100644
--- a/document/src/vespa/document/base/field.cpp
+++ b/document/src/vespa/document/base/field.cpp
@@ -4,6 +4,7 @@
#include <vespa/document/fieldvalue/fieldvalue.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/bobhash.h>
namespace document {
diff --git a/document/src/vespa/document/base/forcelink.cpp b/document/src/vespa/document/base/forcelink.cpp
index b03433081d6..f17c8f582b3 100644
--- a/document/src/vespa/document/base/forcelink.cpp
+++ b/document/src/vespa/document/base/forcelink.cpp
@@ -3,6 +3,8 @@
#include "forcelink.h"
#include <vespa/document/update/updates.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/datatype/documenttype.h>
+
namespace document {
diff --git a/document/src/vespa/document/base/globalid.cpp b/document/src/vespa/document/base/globalid.cpp
index 7fa22d27971..ab8736999aa 100644
--- a/document/src/vespa/document/base/globalid.cpp
+++ b/document/src/vespa/document/base/globalid.cpp
@@ -3,6 +3,7 @@
#include <vespa/document/base/globalid.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/stllike/hash_set.hpp>
#include <cassert>
diff --git a/document/src/vespa/document/base/idstring.cpp b/document/src/vespa/document/base/idstring.cpp
index f5f9f7377b5..d837f512637 100644
--- a/document/src/vespa/document/base/idstring.cpp
+++ b/document/src/vespa/document/base/idstring.cpp
@@ -3,6 +3,7 @@
#include "idstring.h"
#include <vespa/document/bucket/bucketid.h>
#include <vespa/vespalib/util/md5.h>
+#include <vespa/vespalib/util/stringfmt.h>
using vespalib::string;
using vespalib::stringref;
diff --git a/document/src/vespa/document/bucket/bucketid.cpp b/document/src/vespa/document/bucket/bucketid.cpp
index 8554450fb22..c9efe7cd152 100644
--- a/document/src/vespa/document/bucket/bucketid.cpp
+++ b/document/src/vespa/document/bucket/bucketid.cpp
@@ -6,6 +6,7 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/stllike/hash_set.hpp>
+#include <vespa/vespalib/util/stringfmt.h>
using vespalib::nbostream;
using vespalib::asciistream;
diff --git a/document/src/vespa/document/bucket/bucketselector.cpp b/document/src/vespa/document/bucket/bucketselector.cpp
index 8b5e7ada91b..b41b1c284a6 100644
--- a/document/src/vespa/document/bucket/bucketselector.cpp
+++ b/document/src/vespa/document/bucket/bucketselector.cpp
@@ -8,6 +8,7 @@
#include <vespa/document/select/visitor.h>
#include <vespa/document/select/branch.h>
#include <vespa/document/select/compare.h>
+#include <vespa/vespalib/util/stringfmt.h>
namespace document {
diff --git a/document/src/vespa/document/datatype/annotationreferencedatatype.cpp b/document/src/vespa/document/datatype/annotationreferencedatatype.cpp
index 2591cdbf37c..344fc31ed33 100644
--- a/document/src/vespa/document/datatype/annotationreferencedatatype.cpp
+++ b/document/src/vespa/document/datatype/annotationreferencedatatype.cpp
@@ -3,6 +3,7 @@
#include "annotationreferencedatatype.h"
#include <vespa/document/fieldvalue/annotationreferencefieldvalue.h>
#include <ostream>
+#include <cassert>
using std::unique_ptr;
using std::ostream;
diff --git a/document/src/vespa/document/datatype/documenttype.cpp b/document/src/vespa/document/datatype/documenttype.cpp
index 883c4df8f9b..dcf28a9fabf 100644
--- a/document/src/vespa/document/datatype/documenttype.cpp
+++ b/document/src/vespa/document/datatype/documenttype.cpp
@@ -3,6 +3,7 @@
#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <iomanip>
#include <vespa/log/log.h>
diff --git a/document/src/vespa/document/datatype/primitivedatatype.cpp b/document/src/vespa/document/datatype/primitivedatatype.cpp
index 821a22aad4a..afc32e291ea 100644
--- a/document/src/vespa/document/datatype/primitivedatatype.cpp
+++ b/document/src/vespa/document/datatype/primitivedatatype.cpp
@@ -3,6 +3,7 @@
#include "primitivedatatype.h"
#include <vespa/document/fieldvalue/fieldvalues.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <sstream>
namespace document {
diff --git a/document/src/vespa/document/datatype/structdatatype.cpp b/document/src/vespa/document/datatype/structdatatype.cpp
index 6cf9e18656b..f6bd1fc5fa6 100644
--- a/document/src/vespa/document/datatype/structdatatype.cpp
+++ b/document/src/vespa/document/datatype/structdatatype.cpp
@@ -1,12 +1,13 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "structdatatype.h"
-
-#include <iomanip>
#include <vespa/document/base/exceptions.h>
#include <vespa/document/fieldvalue/structfieldvalue.h>
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <iomanip>
+
#include <vespa/log/log.h>
LOG_SETUP(".document.datatype.struct");
diff --git a/document/src/vespa/document/fieldset/fieldsets.cpp b/document/src/vespa/document/fieldset/fieldsets.cpp
index 4ac09820979..51166adec86 100644
--- a/document/src/vespa/document/fieldset/fieldsets.cpp
+++ b/document/src/vespa/document/fieldset/fieldsets.cpp
@@ -2,6 +2,7 @@
#include "fieldsets.h"
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
namespace document {
diff --git a/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp b/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp
index 866c82a63c9..8c05c25e651 100644
--- a/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp
@@ -4,6 +4,7 @@
#include "stringfieldvalue.h"
#include "predicatefieldvalue.h"
#include <vespa/document/util/serializableexceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".document.fieldvalue.array");
diff --git a/document/src/vespa/document/fieldvalue/document.cpp b/document/src/vespa/document/fieldvalue/document.cpp
index f8358cfb544..29f487df989 100644
--- a/document/src/vespa/document/fieldvalue/document.cpp
+++ b/document/src/vespa/document/fieldvalue/document.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "document.h"
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/util/crc.h>
#include <vespa/document/repo/fixedtyperepo.h>
#include <vespa/document/serialization/vespadocumentdeserializer.h>
@@ -8,6 +9,8 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/document/util/serializableexceptions.h>
#include <vespa/document/base/exceptions.h>
+#include <vespa/document/util/bytebuffer.h>
+
#include <sstream>
using vespalib::nbostream;
@@ -15,7 +18,6 @@ using vespalib::make_string;
using vespalib::IllegalArgumentException;
using vespalib::IllegalStateException;
-
namespace document {
namespace {
@@ -153,6 +155,11 @@ Document::swap(Document & rhs)
std::swap(_lastModified, rhs._lastModified);
}
+const DocumentType&
+Document::getType() const {
+ return static_cast<const DocumentType &>(StructuredFieldValue::getType());
+}
+
Document& Document::operator=(const Document& doc)
{
StructuredFieldValue::operator=(doc);
diff --git a/document/src/vespa/document/fieldvalue/document.h b/document/src/vespa/document/fieldvalue/document.h
index f159e9be1d5..02b97238cb2 100644
--- a/document/src/vespa/document/fieldvalue/document.h
+++ b/document/src/vespa/document/fieldvalue/document.h
@@ -18,7 +18,6 @@
#include "structfieldvalue.h"
#include <vespa/document/base/documentid.h>
#include <vespa/document/base/field.h>
-#include <vespa/document/datatype/documenttype.h>
namespace document {
@@ -71,10 +70,7 @@ public:
void accept(FieldValueVisitor &visitor) override { visitor.visit(*this); }
void accept(ConstFieldValueVisitor &visitor) const override { visitor.visit(*this); }
- const DocumentType& getType() const {
- return static_cast<const DocumentType &>(StructuredFieldValue::getType());
- }
-
+ const DocumentType& getType() const;
const DocumentId& getId() const { return _id; }
DocumentId & getId() { return _id; }
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
index fd3093488ea..3279eb77a64 100644
--- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
@@ -10,7 +10,7 @@
#include "doublefieldvalue.h"
#include "bytefieldvalue.h"
#include "predicatefieldvalue.h"
-
+#include <vespa/document/util/bytebuffer.h>
#include <vespa/document/base/exceptions.h>
#include <vespa/document/serialization/vespadocumentserializer.h>
#include <vespa/vespalib/objects/nbostream.h>
@@ -51,6 +51,21 @@ FieldValue::hash() const
return vespalib::hashValue(os.c_str(), os.size()) ;
}
+bool
+FieldValue::isA(const FieldValue& other) const {
+ return (getDataType()->isA(*other.getDataType()));
+}
+int
+FieldValue::compare(const FieldValue& other) const {
+ const DataType & a = *getDataType();
+ const DataType & b = *other.getDataType();
+ return (a < b)
+ ? -1
+ : (b < a)
+ ? 1
+ : 0;
+}
+
FieldValue&
FieldValue::assign(const FieldValue& value)
{
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.h b/document/src/vespa/document/fieldvalue/fieldvalue.h
index bb2a10a3f53..81e207bc31a 100644
--- a/document/src/vespa/document/fieldvalue/fieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/fieldvalue.h
@@ -15,7 +15,6 @@
#include <vespa/document/datatype/datatype.h>
#include <vespa/document/util/xmlserializable.h>
#include <vespa/vespalib/util/polymorphicarrays.h>
-#include <vespa/document/util/bytebuffer.h>
#include <vespa/vespalib/objects/cloneable.h>
#include <map>
@@ -25,6 +24,8 @@ namespace vespalib {
namespace document {
+class ByteBuffer;
+
class FieldValue : public vespalib::Identifiable
{
protected:
@@ -168,27 +169,18 @@ public:
virtual const DataType *getDataType() const = 0;
/** Wrapper for datatypes isA() function. See DataType. */
- virtual bool isA(const FieldValue& other) const
- { return (getDataType()->isA(*other.getDataType())); }
+ virtual bool isA(const FieldValue& other) const;
void serialize(vespalib::nbostream &stream) const;
void serialize(ByteBuffer& buffer) const;
- ByteBuffer::UP serialize() const;
+ std::unique_ptr<ByteBuffer> serialize() const;
/**
* Compares this fieldvalue with another fieldvalue.
* Should return 0 if the two are equal, <0 if this object is "less" than
* the other, and >0 if this object is more than the other.
*/
- virtual int compare(const FieldValue& other) const {
- const DataType & a = *getDataType();
- const DataType & b = *other.getDataType();
- return (a < b)
- ? -1
- : (b < a)
- ? 1
- : 0;
- }
+ virtual int compare(const FieldValue& other) const;
/**
* Returns true if this object have been altered since last
diff --git a/document/src/vespa/document/fieldvalue/serializablearray.cpp b/document/src/vespa/document/fieldvalue/serializablearray.cpp
index 7a174f1ab52..c8beea5e79c 100644
--- a/document/src/vespa/document/fieldvalue/serializablearray.cpp
+++ b/document/src/vespa/document/fieldvalue/serializablearray.cpp
@@ -1,16 +1,29 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "serializablearray.h"
#include <vespa/document/util/serializableexceptions.h>
+#include <vespa/document/util/bytebuffer.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/vespalib/data/databuffer.h>
+#include <vespa/document/util/compressor.h>
#include <vespa/log/log.h>
LOG_SETUP(".document.serializable-array");
-
using std::vector;
namespace document {
+namespace serializablearray {
+
+using BufferMapT = vespalib::hash_map<int, ByteBuffer::UP>;
+
+class BufferMap : public BufferMapT {
+public:
+ using BufferMapT::BufferMapT;
+};
+
+}
+
SerializableArray::Statistics SerializableArray::_stats;
SerializableArray::SerializableArray()
@@ -19,6 +32,13 @@ SerializableArray::SerializableArray()
{
}
+serializablearray::BufferMap & ensure(std::unique_ptr<serializablearray::BufferMap> & owned) {
+ if (!owned) {
+ owned = std::make_unique<serializablearray::BufferMap>();
+ }
+ return *owned;
+}
+
SerializableArray::SerializableArray(const SerializableArray& other)
: Cloneable(),
_entries(other._entries),
@@ -34,7 +54,7 @@ SerializableArray::SerializableArray(const SerializableArray& other)
// Pointing to a buffer in the _owned structure.
ByteBuffer::UP buf(ByteBuffer::copyBuffer(e.getBuffer(_uncompSerData.get()), e.size()));
e.setBuffer(buf->getBuffer());
- _owned[e.id()] = std::move(buf);
+ ensure(_owned)[e.id()] = std::move(buf);
} else {
// If not it is relative to the buffer _uncompSerData, and hence it is valid as is.
}
@@ -79,7 +99,7 @@ SerializableArray::set(int id, ByteBuffer::UP buffer)
{
maybeDecompress();
Entry e(id, buffer->getRemaining(), buffer->getBuffer());
- _owned[id] = std::move(buffer);
+ ensure(_owned)[id] = std::move(buffer);
EntryMap::iterator it = find(id);
if (it == _entries.end()) {
_entries.push_back(e);
@@ -149,7 +169,9 @@ SerializableArray::clear(int id)
EntryMap::iterator it = find(id);
if (it != _entries.end()) {
_entries.erase(it);
- _owned.erase(id);
+ if (_owned) {
+ _owned->erase(id);
+ }
invalidate();
}
}
@@ -215,4 +237,14 @@ void SerializableArray::assign(EntryMap & entries,
}
}
+CompressionInfo
+SerializableArray::getCompressionInfo() const {
+ return CompressionInfo(_uncompressedLength, _compSerData->getRemaining());
+}
+
+const char *
+SerializableArray::Entry::getBuffer(const ByteBuffer * readOnlyBuffer) const {
+ return hasBuffer() ? _data._buffer : readOnlyBuffer->getBuffer() + getOffset();
+}
+
} // document
diff --git a/document/src/vespa/document/fieldvalue/serializablearray.h b/document/src/vespa/document/fieldvalue/serializablearray.h
index 9c0978f1476..1d211a50ab3 100644
--- a/document/src/vespa/document/fieldvalue/serializablearray.h
+++ b/document/src/vespa/document/fieldvalue/serializablearray.h
@@ -16,20 +16,22 @@
#pragma once
-#include <vespa/document/util/bytebuffer.h>
#include <vespa/document/util/compressionconfig.h>
-#include <vespa/document/util/compressor.h>
-#include <vespa/document/util/serializable.h>
-#include <vector>
#include <vespa/vespalib/objects/cloneable.h>
-#include <vespa/vespalib/stllike/hash_map.h>
#include <vespa/vespalib/util/buffer.h>
-#include <vespa/fastos/dynamiclibrary.h>
+#include <vespa/vespalib/util/memory.h>
+#include <vector>
-namespace document
-{
+#define VESPA_DLL_LOCAL __attribute__ ((visibility("hidden")))
+
+namespace document {
class SerializableArrayIterator;
+class ByteBuffer;
+
+namespace serializablearray {
+ class BufferMap;
+}
class SerializableArray : public vespalib::Cloneable
{
@@ -71,7 +73,7 @@ public:
bool operator < (const Entry & e) const { return cmp(e) < 0; }
int cmp(const Entry & e) const { return _id - e._id; }
void setBuffer(const char * buffer) { _data._buffer = buffer; _sz |= BUFFER_MASK; }
- const char * getBuffer(const ByteBuffer * readOnlyBuffer) const { return hasBuffer() ? _data._buffer : readOnlyBuffer->getBuffer() + getOffset(); }
+ VESPA_DLL_LOCAL const char * getBuffer(const ByteBuffer * readOnlyBuffer) const;
private:
uint32_t getOffset() const { return _data._offset; }
enum { BUFFER_MASK=0x80000000 };
@@ -100,12 +102,11 @@ public:
private:
static Statistics _stats;
- typedef vespalib::hash_map<int, uint32_t> HashMap;
-
public:
static Statistics& getStatistics() { return _stats; }
- typedef vespalib::CloneablePtr<SerializableArray> CP;
- typedef std::unique_ptr<SerializableArray> UP;
+ using CP = vespalib::CloneablePtr<SerializableArray>;
+ using UP = std::unique_ptr<SerializableArray>;
+ using ByteBufferUP = std::unique_ptr<ByteBuffer>;
SerializableArray();
virtual ~SerializableArray();
@@ -122,7 +123,7 @@ public:
void set(int id, const char* value, int len);
/** Stores a value in the array. */
- void set(int id, std::unique_ptr<ByteBuffer> buffer);
+ void set(int id, ByteBufferUP buffer);
/**
* Gets a value from the array. This is the faster version of the above.
@@ -152,19 +153,17 @@ public:
void clear();
CompressionConfig::Type getCompression() const { return _serializedCompression; }
- CompressionInfo getCompressionInfo() const {
- return CompressionInfo(_uncompressedLength, _compSerData->getRemaining());
- }
+ CompressionInfo getCompressionInfo() const;
/**
* Sets the serialized data that is the basis for this object's
* content. This is used by deserialization. Any existing entries
* are cleared.
*/
- VESPA_DLL_LOCAL void assign(EntryMap &entries,
- ByteBuffer::UP buffer,
- CompressionConfig::Type comp_type,
- uint32_t uncompressed_length);
+ void assign(EntryMap &entries,
+ ByteBufferUP buffer,
+ CompressionConfig::Type comp_type,
+ uint32_t uncompressed_length);
bool empty() const { return _entries.empty(); }
@@ -189,22 +188,22 @@ private:
return false;
}
- VESPA_DLL_LOCAL bool deCompressAndCatch() const;
+ bool deCompressAndCatch() const;
void maybeDecompress() const {
if ( shouldDecompress() ) {
const_cast<SerializableArray *>(this)->deCompress();
}
}
- VESPA_DLL_LOCAL void deCompress(); // throw (DeserializeException);
+ void deCompress(); // throw (DeserializeException);
/** Contains the stored attributes, with reference to the real data.. */
EntryMap _entries;
/** The buffers we own. */
- vespalib::hash_map<int, ByteBuffer::UP > _owned;
+ std::unique_ptr<serializablearray::BufferMap> _owned;
/** Data we deserialized from, if applicable. */
- ByteBuffer::UP _uncompSerData;
- ByteBuffer::UP _compSerData;
+ ByteBufferUP _uncompSerData;
+ ByteBufferUP _compSerData;
CompressionConfig::Type _serializedCompression;
uint32_t _uncompressedLength;
@@ -215,4 +214,3 @@ private:
};
} // document
-
diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
index 079b730c8cc..74805ce3f10 100644
--- a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
@@ -8,9 +8,9 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/crc.h>
#include <vespa/document/datatype/positiondatatype.h>
-#include <vespa/vespalib/util/vstringfmt.h>
#include <vespa/document/util/serializableexceptions.h>
#include <vespa/document/base/exceptions.h>
+#include <vespa/document/util/bytebuffer.h>
#include <vespa/log/log.h>
LOG_SETUP(".document.structfieldvalue");
@@ -43,6 +43,26 @@ StructFieldValue::~StructFieldValue() { }
StructFieldValue::Chunks::~Chunks() { }
void
+StructFieldValue::Chunks::push_back(SerializableArray::UP item) {
+ assert(_sz < 2);
+ _chunks[_sz++].reset(item.release());
+}
+
+void
+StructFieldValue::Chunks::clear() {
+ _chunks[0].reset();
+ _chunks[1].reset();
+ _sz = 0;
+}
+
+void
+StructFieldValue::Chunks::swap(Chunks & rhs) {
+ _chunks[0].swap(rhs._chunks[0]);
+ _chunks[1].swap(rhs._chunks[1]);
+ std::swap(_sz, rhs._sz);
+}
+
+void
StructFieldValue::swap(StructFieldValue & rhs)
{
StructuredFieldValue::swap(rhs);
@@ -53,6 +73,16 @@ StructFieldValue::swap(StructFieldValue & rhs)
std::swap(_version, _version);
}
+const StructDataType &
+StructFieldValue::getStructType() const {
+ return static_cast<const StructDataType &>(getType());
+}
+
+const CompressionConfig &
+StructFieldValue::getCompressionConfig() const {
+ return getStructType().getCompressionConfig();
+}
+
void
StructFieldValue::lazyDeserialize(const FixedTypeRepo &repo,
uint16_t version,
diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.h b/document/src/vespa/document/fieldvalue/structfieldvalue.h
index a46a36c477d..01a0e732e43 100644
--- a/document/src/vespa/document/fieldvalue/structfieldvalue.h
+++ b/document/src/vespa/document/fieldvalue/structfieldvalue.h
@@ -11,17 +11,16 @@
#include "structuredfieldvalue.h"
#include "serializablearray.h"
-#include <vespa/document/util/compressionconfig.h>
-#include <vespa/document/datatype/structdatatype.h>
-#include <vector>
namespace document {
+
class Document;
class DocumentType;
class DocumentTypeRepo;
class FieldValueWriter;
class FixedTypeRepo;
class FieldSet;
+class StructDataType;
class StructFieldValue : public StructuredFieldValue
{
@@ -32,24 +31,13 @@ public:
~Chunks();
SerializableArray & operator [] (size_t i) { return *_chunks[i]; }
const SerializableArray & operator [] (size_t i) const { return *_chunks[i]; }
- void push_back(SerializableArray::UP item) {
- assert(_sz < 2);
- _chunks[_sz++].reset(item.release());
- }
+ VESPA_DLL_LOCAL void push_back(SerializableArray::UP item);
SerializableArray & back() { return *_chunks[_sz-1]; }
const SerializableArray & back() const { return *_chunks[_sz-1]; }
size_t size() const { return _sz; }
bool empty() const { return _sz == 0; }
- void clear() {
- _chunks[0].reset();
- _chunks[1].reset();
- _sz = 0;
- }
- void swap(Chunks & rhs) {
- _chunks[0].swap(rhs._chunks[0]);
- _chunks[1].swap(rhs._chunks[1]);
- std::swap(_sz, rhs._sz);
- }
+ VESPA_DLL_LOCAL void clear();
+ VESPA_DLL_LOCAL void swap(Chunks & rhs);
private:
SerializableArray::CP _chunks[2];
size_t _sz;
@@ -73,12 +61,12 @@ public:
const DocumentTypeRepo * getRepo() const { return _repo; }
void setDocumentType(const DocumentType & docType) { _doc_type = & docType; }
- const StructDataType & getStructType() const { return static_cast<const StructDataType &>(getType()); }
+ const StructDataType & getStructType() const;
void lazyDeserialize(const FixedTypeRepo &repo,
uint16_t version,
SerializableArray::EntryMap && fields,
- ByteBuffer::UP buffer,
+ std::unique_ptr<ByteBuffer> buffer,
CompressionConfig::Type comp_type,
int32_t uncompressed_length);
@@ -99,8 +87,7 @@ public:
const Field& getField(const vespalib::stringref & name) const override;
void clear() override;
- const CompressionConfig &getCompressionConfig() const
- { return getStructType().getCompressionConfig(); }
+ const CompressionConfig &getCompressionConfig() const;
// FieldValue implementation.
FieldValue& assign(const FieldValue&) override;
@@ -146,4 +133,3 @@ private:
};
} // document
-
diff --git a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp
index d6396c43a46..03b7d50c1c1 100644
--- a/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/tensorfieldvalue.cpp
@@ -3,6 +3,7 @@
#include "tensorfieldvalue.h"
#include <vespa/eval/tensor/tensor.h>
#include <ostream>
+#include <cassert>
using vespalib::tensor::Tensor;
@@ -164,7 +165,6 @@ TensorFieldValue::compare(const FieldValue &other) const
return ((_tensor.get() < rhs._tensor.get()) ? -1 : 1);
}
-
IMPLEMENT_IDENTIFIABLE(TensorFieldValue, FieldValue);
} // document
diff --git a/document/src/vespa/document/repo/documenttyperepo.cpp b/document/src/vespa/document/repo/documenttyperepo.cpp
index 78d668a4886..93adce76efd 100644
--- a/document/src/vespa/document/repo/documenttyperepo.cpp
+++ b/document/src/vespa/document/repo/documenttyperepo.cpp
@@ -3,7 +3,6 @@
#include "documenttyperepo.h"
#include <vespa/document/datatype/annotationreferencedatatype.h>
-#include <vespa/document/datatype/annotationtype.h>
#include <vespa/document/datatype/arraydatatype.h>
#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/datatype/mapdatatype.h>
@@ -11,15 +10,10 @@
#include <vespa/document/datatype/urldatatype.h>
#include <vespa/document/datatype/weightedsetdatatype.h>
#include <vespa/document/datatype/referencedatatype.h>
-#include <vespa/vespalib/objects/identifiable.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
-#include <vespa/vespalib/util/closure.h>
#include <vespa/vespalib/util/exceptions.h>
-#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/document/config/config-documenttypes.h>
#include <fstream>
-#include <memory>
-#include <utility>
#include <vespa/log/log.h>
LOG_SETUP(".documenttyperepo");
@@ -39,6 +33,20 @@ using vespalib::stringref;
namespace document {
+namespace internal {
+
+using DocumentTypeMapT = vespalib::hash_map<int32_t, DataTypeRepo *>;
+
+class DocumentTypeMap : public DocumentTypeMapT
+{
+public:
+ using DocumentTypeMapT::DocumentTypeMapT;
+};
+
+}
+
+using DocumentTypeMap = internal::DocumentTypeMap;
+
namespace {
template <typename Container>
void DeleteContent(Container &c) {
@@ -359,7 +367,6 @@ void addDataTypes(const vector<Datatype> &types, Repo &repo,
}
}
-typedef hash_map<int32_t, DataTypeRepo *> DocumentTypeMap;
void addDocumentTypes(const DocumentTypeMap &type_map, Repo &repo) {
for (DocumentTypeMap::const_iterator
it = type_map.begin(); it != type_map.end(); ++it) {
@@ -515,49 +522,55 @@ void configureAllRepos(const DocumenttypesConfig::DocumenttypeVector &t,
} // namespace
-DocumentTypeRepo::DocumentTypeRepo() {
- addDefaultDocument(_doc_types);
+DocumentTypeRepo::DocumentTypeRepo() :
+ _doc_types(std::make_unique<internal::DocumentTypeMap>())
+{
+ addDefaultDocument(*_doc_types);
}
-DocumentTypeRepo::DocumentTypeRepo(const DocumentType & type) {
- addDefaultDocument(_doc_types);
+DocumentTypeRepo::DocumentTypeRepo(const DocumentType & type) :
+ _doc_types(std::make_unique<internal::DocumentTypeMap>())
+{
+ addDefaultDocument(*_doc_types);
try {
- addDataTypeRepo(makeDataTypeRepo(type, _doc_types), _doc_types);
+ addDataTypeRepo(makeDataTypeRepo(type, *_doc_types), *_doc_types);
} catch (...) {
- DeleteMapContent(_doc_types);
+ DeleteMapContent(*_doc_types);
throw;
}
}
-DocumentTypeRepo::DocumentTypeRepo(const DocumenttypesConfig &config) {
- addDefaultDocument(_doc_types);
+DocumentTypeRepo::DocumentTypeRepo(const DocumenttypesConfig &config) :
+ _doc_types(std::make_unique<internal::DocumentTypeMap>())
+{
+ addDefaultDocument(*_doc_types);
try {
- createAllDocumentTypes(config.documenttype, _doc_types);
- addAllDocumentTypesToRepos(_doc_types);
- configureAllRepos(config.documenttype, _doc_types);
+ createAllDocumentTypes(config.documenttype, *_doc_types);
+ addAllDocumentTypesToRepos(*_doc_types);
+ configureAllRepos(config.documenttype, *_doc_types);
} catch (...) {
- DeleteMapContent(_doc_types);
+ DeleteMapContent(*_doc_types);
throw;
}
}
DocumentTypeRepo::~DocumentTypeRepo() {
- DeleteMapContent(_doc_types);
+ DeleteMapContent(*_doc_types);
}
const DocumentType *DocumentTypeRepo::getDocumentType(int32_t type_id) const {
- const DataTypeRepo *repo = FindPtr(_doc_types, type_id);
+ const DataTypeRepo *repo = FindPtr(*_doc_types, type_id);
return repo ? repo->doc_type : nullptr;
}
const DocumentType *DocumentTypeRepo::getDocumentType(const stringref &name) const {
DocumentTypeMap::const_iterator it =
- _doc_types.find(DocumentType::createId(name));
+ _doc_types->find(DocumentType::createId(name));
- if (it != _doc_types.end() && it->second->doc_type->getName() == name) {
+ if (it != _doc_types->end() && it->second->doc_type->getName() == name) {
return it->second->doc_type;
}
- for (it = _doc_types.begin(); it != _doc_types.end(); ++it) {
+ for (it = _doc_types->begin(); it != _doc_types->end(); ++it) {
if (it->second->doc_type->getName() == name) {
return it->second->doc_type;
}
@@ -567,27 +580,27 @@ const DocumentType *DocumentTypeRepo::getDocumentType(const stringref &name) con
const DataType *
DocumentTypeRepo::getDataType(const DocumentType &doc_type, int32_t id) const {
- const DataTypeRepo *dt_repo = FindPtr(_doc_types, doc_type.getId());
+ const DataTypeRepo *dt_repo = FindPtr(*_doc_types, doc_type.getId());
return dt_repo ? dt_repo->repo.lookup(id) : nullptr;
}
const DataType *
DocumentTypeRepo::getDataType(
const DocumentType &doc_type, const stringref &name) const {
- const DataTypeRepo *dt_repo = FindPtr(_doc_types, doc_type.getId());
+ const DataTypeRepo *dt_repo = FindPtr(*_doc_types, doc_type.getId());
return dt_repo ? dt_repo->repo.lookup(name) : nullptr;
}
const AnnotationType *DocumentTypeRepo::getAnnotationType(
const DocumentType &doc_type, int32_t id) const {
- const DataTypeRepo *dt_repo = FindPtr(_doc_types, doc_type.getId());
+ const DataTypeRepo *dt_repo = FindPtr(*_doc_types, doc_type.getId());
return dt_repo ? dt_repo->annotations.lookup(id) : nullptr;
}
void DocumentTypeRepo::forEachDocumentType(
Closure1<const DocumentType &> &c) const {
for (DocumentTypeMap::const_iterator
- it = _doc_types.begin(); it != _doc_types.end(); ++it) {
+ it = _doc_types->begin(); it != _doc_types->end(); ++it) {
c.call(*it->second->doc_type);
}
}
diff --git a/document/src/vespa/document/repo/documenttyperepo.h b/document/src/vespa/document/repo/documenttyperepo.h
index 55655fe169e..4955f3562db 100644
--- a/document/src/vespa/document/repo/documenttyperepo.h
+++ b/document/src/vespa/document/repo/documenttyperepo.h
@@ -3,7 +3,6 @@
#pragma once
#include <memory>
-#include <vespa/vespalib/stllike/hash_map.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/util/closure.h>
@@ -11,6 +10,7 @@ namespace document {
namespace internal {
class InternalDocumenttypesType;
+ class DocumentTypeMap;
}
class AnnotationType;
@@ -19,9 +19,7 @@ class DataTypeRepo;
class DocumentType;
class DocumentTypeRepo {
- typedef vespalib::hash_map<int32_t, DataTypeRepo *> DocumentTypeMap;
-
- DocumentTypeMap _doc_types;
+ std::unique_ptr<internal::DocumentTypeMap> _doc_types;
public:
using DocumenttypesConfig = const internal::InternalDocumenttypesType;
diff --git a/document/src/vespa/document/select/branch.cpp b/document/src/vespa/document/select/branch.cpp
index ddbad69b14d..ea0d0ef5646 100644
--- a/document/src/vespa/document/select/branch.cpp
+++ b/document/src/vespa/document/select/branch.cpp
@@ -2,6 +2,8 @@
#include "branch.h"
#include "visitor.h"
+#include <cassert>
+#include <ostream>
namespace document {
namespace select {
diff --git a/document/src/vespa/document/select/constant.cpp b/document/src/vespa/document/select/constant.cpp
index 686ab05055c..0e2fdc2ecec 100644
--- a/document/src/vespa/document/select/constant.cpp
+++ b/document/src/vespa/document/select/constant.cpp
@@ -2,9 +2,10 @@
#include "constant.h"
#include "visitor.h"
+#include <cassert>
+#include <ostream>
-namespace document {
-namespace select {
+namespace document::select {
Constant::Constant(const vespalib::stringref & value)
: Node(value),
@@ -46,13 +47,11 @@ Constant::visit(Visitor &v) const
void
-Constant::print(std::ostream& out, bool,
- const std::string&) const
+Constant::print(std::ostream& out, bool, const std::string&) const
{
if (_parentheses) out << '(';
out << _name;
if (_parentheses) out << ')';
}
-} // select
-} // document
+}
diff --git a/document/src/vespa/document/select/context.cpp b/document/src/vespa/document/select/context.cpp
index 44d005e9db2..ef29770ddc8 100644
--- a/document/src/vespa/document/select/context.cpp
+++ b/document/src/vespa/document/select/context.cpp
@@ -1,11 +1,12 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "context.h"
+#include "variablemap.h"
+#include <vespa/document/select/value.h>
-namespace document {
-namespace select {
+namespace document::select {
-Context::Context(void)
+Context::Context()
: _doc(NULL),
_docId(NULL),
_docUpdate(NULL),
@@ -35,5 +36,20 @@ Context::Context(const DocumentUpdate& docUpdate)
Context::~Context() { }
-} // select
-} // document
+std::unique_ptr<Value>
+Context::getValue(const vespalib::string & value) const {
+ VariableMap::const_iterator iter = _variables->find(value);
+
+ if (iter != _variables->end()) {
+ return std::make_unique<FloatValue>(iter->second);
+ } else {
+ return std::make_unique<FloatValue>(0.0);
+ }
+}
+
+void
+Context::setVariableMap(std::unique_ptr<VariableMap> map) {
+ _variables = std::move(map);
+}
+
+}
diff --git a/document/src/vespa/document/select/context.h b/document/src/vespa/document/select/context.h
index 11a3a2be51c..0e347e22bb5 100644
--- a/document/src/vespa/document/select/context.h
+++ b/document/src/vespa/document/select/context.h
@@ -2,9 +2,9 @@
#pragma once
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/stllike/hash_map.h>
+#include <memory>
-namespace document{
+namespace document {
class Document;
class DocumentId;
@@ -12,24 +12,26 @@ class DocumentUpdate;
namespace select {
-class Context
-{
-public:
- typedef vespalib::hash_map<vespalib::string, double> VariableMap;
+class Value;
+class VariableMap;
+class Context {
+public:
Context();
- Context(const Document& doc);
- Context(const DocumentId& docId);
- Context(const DocumentUpdate& docUpdate);
+ Context(const Document & doc);
+ Context(const DocumentId & docId);
+ Context(const DocumentUpdate & docUpdate);
virtual ~Context();
- const Document * _doc;
- const DocumentId * _docId;
- const DocumentUpdate * _docUpdate;
- VariableMap _variables;
-};
-
-} // select
-} // document
+ void setVariableMap(std::unique_ptr<VariableMap> map);
+ std::unique_ptr<Value> getValue(const vespalib::string & value) const;
+ const Document *_doc;
+ const DocumentId *_docId;
+ const DocumentUpdate *_docUpdate;
+private:
+ std::unique_ptr<VariableMap> _variables;
+};
+}
+}
diff --git a/document/src/vespa/document/select/doctype.cpp b/document/src/vespa/document/select/doctype.cpp
index 3c23b2e5ba1..117f97ea1bc 100644
--- a/document/src/vespa/document/select/doctype.cpp
+++ b/document/src/vespa/document/select/doctype.cpp
@@ -5,9 +5,9 @@
#include <vespa/document/update/documentupdate.h>
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
-namespace document {
-namespace select {
+namespace document::select {
namespace {
bool documentTypeEqualsName(const DocumentType& type,
@@ -88,5 +88,4 @@ DocType::print(std::ostream& out, bool verbose,
if (_parentheses) out << ')';
}
-} // select
-} // document
+}
diff --git a/document/src/vespa/document/select/invalidconstant.cpp b/document/src/vespa/document/select/invalidconstant.cpp
index 793e34c7bc5..53e3a6e1647 100644
--- a/document/src/vespa/document/select/invalidconstant.cpp
+++ b/document/src/vespa/document/select/invalidconstant.cpp
@@ -2,9 +2,9 @@
#include "invalidconstant.h"
#include "visitor.h"
+#include <ostream>
-namespace document {
-namespace select {
+namespace document::select {
InvalidConstant::InvalidConstant(const vespalib::stringref & value)
: Node(value)
@@ -26,13 +26,11 @@ InvalidConstant::visit(Visitor &v) const
void
-InvalidConstant::print(std::ostream& out, bool,
- const std::string&) const
+InvalidConstant::print(std::ostream& out, bool, const std::string&) const
{
if (_parentheses) out << '(';
out << _name;
if (_parentheses) out << ')';
}
-} // select
-} // document
+}
diff --git a/document/src/vespa/document/select/operator.cpp b/document/src/vespa/document/select/operator.cpp
index b127e29c1ad..3c09a482cf0 100644
--- a/document/src/vespa/document/select/operator.cpp
+++ b/document/src/vespa/document/select/operator.cpp
@@ -4,9 +4,9 @@
#include <vespa/vespalib/util/regexp.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <cassert>
-namespace document {
-namespace select {
+namespace document::select {
Operator::OperatorMap Operator::_operators;
@@ -228,5 +228,4 @@ GlobOperator::containsVariables(const vespalib::stringref & expression)
const GlobOperator GlobOperator::GLOB("=");
-} // select
-} // document
+}
diff --git a/document/src/vespa/document/select/value.cpp b/document/src/vespa/document/select/value.cpp
index 7638ba3c36e..7a453fe5cf3 100644
--- a/document/src/vespa/document/select/value.cpp
+++ b/document/src/vespa/document/select/value.cpp
@@ -2,7 +2,6 @@
#include "value.h"
#include "operator.h"
-#include <cstdint>
namespace document {
namespace select {
diff --git a/document/src/vespa/document/select/valuenode.cpp b/document/src/vespa/document/select/valuenode.cpp
index ebf0a466ad9..96bc46bd54e 100644
--- a/document/src/vespa/document/select/valuenode.cpp
+++ b/document/src/vespa/document/select/valuenode.cpp
@@ -4,6 +4,7 @@
#include "parser.h"
#include <vespa/document/base/exceptions.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/util/md5.h>
#include <vespa/document/util/stringutil.h>
#include <vespa/vespalib/text/lowercase.h>
@@ -35,6 +36,13 @@ namespace {
}
}
+std::unique_ptr<Value>
+ValueNode::defaultTrace(std::unique_ptr<Value> val, std::ostream& out) const
+{
+ out << "Returning value " << *val << ".\n";
+ return std::move(val);
+}
+
InvalidValueNode::InvalidValueNode(const vespalib::stringref & name)
: _name(name)
{ }
@@ -146,13 +154,7 @@ CurrentTimeValueNode::print(std::ostream& out, bool verbose,
std::unique_ptr<Value>
VariableValueNode::getValue(const Context& context) const {
- VariableMap::const_iterator iter = context._variables.find(_value);
-
- if (iter != context._variables.end()) {
- return std::unique_ptr<Value>(new FloatValue(iter->second));
- } else {
- return std::unique_ptr<Value>(new FloatValue(0.0));
- }
+ return context.getValue(_value);
}
diff --git a/document/src/vespa/document/select/valuenode.h b/document/src/vespa/document/select/valuenode.h
index e3f0b4c4a94..d56b1468508 100644
--- a/document/src/vespa/document/select/valuenode.h
+++ b/document/src/vespa/document/select/valuenode.h
@@ -29,34 +29,25 @@ namespace select {
class ValueNode : public Printable
{
public:
- typedef std::unique_ptr<ValueNode> UP;
- typedef Context::VariableMap VariableMap;
+ using UP = std::unique_ptr<ValueNode>;
ValueNode() : _parentheses(false) {}
virtual ~ValueNode() {}
void setParentheses() { _parentheses = true; }
-
- void clearParentheses()
- {
- _parentheses = false;
- }
-
+ void clearParentheses() { _parentheses = false; }
bool hadParentheses() const { return _parentheses; }
virtual std::unique_ptr<Value>
getValue(const Context& context) const = 0;
virtual std::unique_ptr<Value>
- traceValue(const Context &context,
- std::ostream &out) const {
+ traceValue(const Context &context, std::ostream &out) const {
return defaultTrace(getValue(context), out);
}
virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override = 0;
-
virtual void visit(Visitor&) const = 0;
-
virtual ValueNode::UP clone() const = 0;
private:
bool _parentheses; // Set to true if parentheses was used around this part
@@ -70,12 +61,7 @@ protected:
return ret;
}
- std::unique_ptr<Value> defaultTrace(std::unique_ptr<Value> val,
- std::ostream& out) const
- {
- out << "Returning value " << *val << ".\n";
- return std::move(val);
- }
+ std::unique_ptr<Value> defaultTrace(std::unique_ptr<Value> val, std::ostream& out) const;
};
class InvalidValueNode : public ValueNode
diff --git a/document/src/vespa/document/select/variablemap.h b/document/src/vespa/document/select/variablemap.h
new file mode 100644
index 00000000000..86a1cb85e63
--- /dev/null
+++ b/document/src/vespa/document/select/variablemap.h
@@ -0,0 +1,15 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include <vespa/vespalib/stllike/hash_map.h>
+#include <vespa/vespalib/stllike/string.h>
+
+namespace document::select {
+
+using VariableMapT = vespalib::hash_map<vespalib::string, double>;
+
+class VariableMap : public VariableMapT {
+public:
+ using VariableMapT::VariableMapT;
+};
+
+}
diff --git a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp
index 93856b376aa..b2a2bd098a6 100644
--- a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp
+++ b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp
@@ -27,6 +27,7 @@
#include <vespa/document/util/serializableexceptions.h>
#include <vespa/document/base/exceptions.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/document/util/bytebuffer.h>
#include <vespa/log/log.h>
LOG_SETUP(".vespadocumentdeserializer");
diff --git a/document/src/vespa/document/serialization/vespadocumentserializer.cpp b/document/src/vespa/document/serialization/vespadocumentserializer.cpp
index 11317f2ff0a..1f6a4a4f0b0 100644
--- a/document/src/vespa/document/serialization/vespadocumentserializer.cpp
+++ b/document/src/vespa/document/serialization/vespadocumentserializer.cpp
@@ -24,7 +24,9 @@
#include <vespa/document/update/fieldpathupdates.h>
#include <vespa/vespalib/data/slime/binary_format.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/vespalib/data/databuffer.h>
#include <vespa/eval/tensor/serialization/typed_binary_format.h>
+#include <vespa/document/util/compressor.h>
using std::make_pair;
using std::pair;
diff --git a/document/src/vespa/document/update/assignfieldpathupdate.cpp b/document/src/vespa/document/update/assignfieldpathupdate.cpp
index 0a676c88df2..4b8ee510576 100644
--- a/document/src/vespa/document/update/assignfieldpathupdate.cpp
+++ b/document/src/vespa/document/update/assignfieldpathupdate.cpp
@@ -1,9 +1,10 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "assignfieldpathupdate.h"
#include <vespa/document/fieldvalue/fieldvalues.h>
-#include <vespa/document/repo/fixedtyperepo.h>
#include <vespa/document/select/parser.h>
+#include <vespa/document/select/variablemap.h>
#include <vespa/document/serialization/vespadocumentdeserializer.h>
-#include <vespa/document/update/assignfieldpathupdate.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/exceptions.h>
#include <boost/numeric/conversion/cast.hpp>
@@ -108,7 +109,8 @@ FieldValue::IteratorHandler::ModificationStatus
AssignFieldPathUpdate::AssignExpressionIteratorHandler::doModify(FieldValue& fv) {
LOG(spam, "fv = %s", fv.toString().c_str());
if (fv.inherits(NumericFieldValueBase::classId)) {
- DocumentCalculator::VariableMap vars;
+ std::unique_ptr<select::VariableMap> varHolder = std::make_unique<select::VariableMap>();
+ select::VariableMap & vars = *varHolder;
for (VariableMap::const_iterator i(getVariables().begin()),
e(getVariables().end()); i != e; ++i)
{
@@ -122,7 +124,7 @@ AssignFieldPathUpdate::AssignExpressionIteratorHandler::doModify(FieldValue& fv)
vars["value"] = fv.getAsDouble();
try {
- double res = _calc.evaluate(_doc, std::move(vars));
+ double res = _calc.evaluate(_doc, std::move(varHolder));
if (_removeIfZero && static_cast<uint64_t>(res) == 0) {
return REMOVED;
} else {
diff --git a/document/src/vespa/document/update/clearvalueupdate.cpp b/document/src/vespa/document/update/clearvalueupdate.cpp
index 13143e004ee..cb526852299 100644
--- a/document/src/vespa/document/update/clearvalueupdate.cpp
+++ b/document/src/vespa/document/update/clearvalueupdate.cpp
@@ -1,15 +1,15 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include "clearvalueupdate.h"
#include <vespa/document/base/field.h>
-#include <vespa/document/update/clearvalueupdate.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <ostream>
using vespalib::IllegalArgumentException;
using vespalib::IllegalStateException;
-namespace document
-{
+namespace document {
IMPLEMENT_IDENTIFIABLE(ClearValueUpdate, ValueUpdate);
diff --git a/document/src/vespa/document/update/documentupdate.cpp b/document/src/vespa/document/update/documentupdate.cpp
index 866a215505c..d91b33650d4 100644
--- a/document/src/vespa/document/update/documentupdate.cpp
+++ b/document/src/vespa/document/update/documentupdate.cpp
@@ -1,4 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
#include "documentupdate.h"
#include "documentupdateflags.h"
#include <vespa/document/fieldvalue/fieldvalues.h>
@@ -7,6 +8,7 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/document/util/bufferexceptions.h>
#include <vespa/document/base/exceptions.h>
+#include <vespa/document/datatype/documenttype.h>
using vespalib::IllegalArgumentException;
using vespalib::IllegalStateException;
@@ -103,7 +105,28 @@ DocumentUpdate::affectsDocumentBody() const
return false;
}
-// Print the content of this document update.
+const DocumentType&
+DocumentUpdate::getType() const {
+ return static_cast<const DocumentType &> (*_type);
+}
+
+DocumentUpdate&
+DocumentUpdate::addUpdate(const FieldUpdate& update) {
+ _updates.push_back(update);
+ return *this;
+}
+
+DocumentUpdate&
+DocumentUpdate::addFieldPathUpdate(const FieldPathUpdate::CP& update) {
+ _fieldPathUpdates.push_back(update);
+ return *this;
+}
+
+DocumentUpdate*
+DocumentUpdate::clone() const {
+ return new DocumentUpdate(*this);
+}
+
void
DocumentUpdate::print(std::ostream& out, bool verbose,
const std::string& indent) const
@@ -230,8 +253,7 @@ DocumentUpdate::deserialize42(const DocumentTypeRepo& repo, ByteBuffer& buffer)
try{
buffer.getShortNetwork(_version);
- std::pair<const DocumentType *, DocumentId> typeAndId(
- deserializeTypeAndId(repo, buffer));
+ std::pair<const DocumentType *, DocumentId> typeAndId(deserializeTypeAndId(repo, buffer));
_type = typeAndId.first;
_documentId = typeAndId.second;
// Read field updates, if any.
diff --git a/document/src/vespa/document/update/documentupdate.h b/document/src/vespa/document/update/documentupdate.h
index 5d09bd36816..ce00d00088b 100644
--- a/document/src/vespa/document/update/documentupdate.h
+++ b/document/src/vespa/document/update/documentupdate.h
@@ -29,7 +29,6 @@
#include "fieldpathupdate.h"
#include <vespa/document/base/documentid.h>
#include <vespa/document/base/field.h>
-#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldvalue/fieldvalue.h>
#include <vespa/document/util/bytebuffer.h>
@@ -118,19 +117,13 @@ public:
* Add a field update to this document update.
* @return A reference to this.
*/
- DocumentUpdate& addUpdate(const FieldUpdate& update) {
- _updates.push_back(update);
- return *this;
- }
+ DocumentUpdate& addUpdate(const FieldUpdate& update);
/**
* Add a fieldpath update to this document update.
* @return A reference to this.
*/
- DocumentUpdate& addFieldPathUpdate(const FieldPathUpdate::CP& update) {
- _fieldPathUpdates.push_back(update);
- return *this;
- }
+ DocumentUpdate& addFieldPathUpdate(const FieldPathUpdate::CP& update);
/** @return The list of updates. */
const FieldUpdateV & getUpdates() const { return _updates; }
@@ -141,7 +134,7 @@ public:
bool affectsDocumentBody() const;
/** @return The type of document this update is for. */
- const DocumentType& getType() const { return static_cast<const DocumentType &> (*_type); }
+ const DocumentType& getType() const;
// Printable implementation
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
@@ -159,9 +152,7 @@ public:
void printXml(XmlOutputStream&) const override;
// Cloneable implementation
- virtual DocumentUpdate* clone() const {
- return new DocumentUpdate(*this);
- }
+ virtual DocumentUpdate* clone() const;
/**
* Sets whether this update should create the document it updates if that document does not exist.
@@ -199,7 +190,6 @@ private:
DocumentUpdate();
int deserializeFlags(int sizeAndFlags);
-
};
} // document
diff --git a/document/src/vespa/document/update/fieldupdate.cpp b/document/src/vespa/document/update/fieldupdate.cpp
index 3141fdf3a4f..e25b95e56c1 100644
--- a/document/src/vespa/document/update/fieldupdate.cpp
+++ b/document/src/vespa/document/update/fieldupdate.cpp
@@ -3,6 +3,7 @@
#include "fieldupdate.h"
#include <vespa/document/base/exceptions.h>
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
namespace document {
diff --git a/documentapi/src/tests/messagebus/messagebus_test.cpp b/documentapi/src/tests/messagebus/messagebus_test.cpp
index 58fc96b2e78..e4b04b0afc7 100644
--- a/documentapi/src/tests/messagebus/messagebus_test.cpp
+++ b/documentapi/src/tests/messagebus/messagebus_test.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/base/testdocrepo.h>
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/documentapi/documentapi.h>
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/vespalib/testkit/testapp.h>
diff --git a/documentapi/src/tests/messages/messages50test.cpp b/documentapi/src/tests/messages/messages50test.cpp
index 44aea1cb169..3c9f068468f 100644
--- a/documentapi/src/tests/messages/messages50test.cpp
+++ b/documentapi/src/tests/messages/messages50test.cpp
@@ -4,6 +4,7 @@
#include <vespa/document/datatype/datatype.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/update/fieldpathupdates.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/documentapi/documentapi.h>
#include <vespa/vdslib/container/writabledocumentlist.h>
diff --git a/documentapi/src/tests/messages/messages52test.cpp b/documentapi/src/tests/messages/messages52test.cpp
index 9339d23ee86..37a133add91 100644
--- a/documentapi/src/tests/messages/messages52test.cpp
+++ b/documentapi/src/tests/messages/messages52test.cpp
@@ -5,6 +5,7 @@
#include "messages52test.h"
#include <vespa/documentapi/documentapi.h>
#include <vespa/document/update/fieldpathupdates.h>
+#include <vespa/document/datatype/documenttype.h>
using document::DocumentTypeRepo;
diff --git a/documentapi/src/tests/policies/policies_test.cpp b/documentapi/src/tests/policies/policies_test.cpp
index 3527e62840b..5d92b495c48 100644
--- a/documentapi/src/tests/policies/policies_test.cpp
+++ b/documentapi/src/tests/policies/policies_test.cpp
@@ -23,7 +23,9 @@
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/document/base/testdocrepo.h>
#include <vespa/document/fieldvalue/longfieldvalue.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP("policies_test");
diff --git a/documentapi/src/vespa/documentapi/loadtypes/loadtypeset.cpp b/documentapi/src/vespa/documentapi/loadtypes/loadtypeset.cpp
index 4f0f3508d20..062ed58ca87 100644
--- a/documentapi/src/vespa/documentapi/loadtypes/loadtypeset.cpp
+++ b/documentapi/src/vespa/documentapi/loadtypes/loadtypeset.cpp
@@ -3,6 +3,7 @@
#include "loadtypeset.h"
#include <vespa/config-load-type.h>
#include <vespa/config/config.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/config/helper/configgetter.hpp>
diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.cpp
index 61c6648aee6..4dae20e52d5 100644
--- a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.cpp
+++ b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.cpp
@@ -12,6 +12,7 @@
#include <vespa/messagebus/emptyreply.h>
#include <vespa/messagebus/routing/routingtable.h>
#include <vespa/messagebus/messagebus.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".documentrouteselectorpolicy");
diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp
index 3a35e995805..d1a2e7b135b 100644
--- a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp
+++ b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.cpp
@@ -3,9 +3,7 @@
#include <boost/tokenizer.hpp>
#include <vespa/documentapi/messagebus/documentprotocol.h>
#include <vespa/messagebus/emptyreply.h>
-#include <vespa/messagebus/errorcode.h>
-#include <vespa/messagebus/routing/route.h>
-#include <vespa/messagebus/routing/routingcontext.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/slobrok/sbmirror.h>
#include <vespa/fnet/frt/frt.h>
diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp
index 4d260a8e81f..ba4d0cff079 100644
--- a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp
+++ b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.cpp
@@ -1,12 +1,26 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
#include "messagetypepolicy.h"
#include <vespa/documentapi/messagebus/documentprotocol.h>
+#include <vespa/messagebus/routing/route.h>
+#include <vespa/messagebus/routing/routingcontext.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
using vespa::config::content::MessagetyperouteselectorpolicyConfig;
namespace documentapi {
+namespace policy {
+
+using MessageTypeMapT = vespalib::hash_map<int, mbus::Route>;
+
+class MessageTypeMap : public MessageTypeMapT {
+public:
+ using MessageTypeMapT::MessageTypeMapT;
+};
+
+}
+
MessageTypePolicy::MessageTypePolicy(const config::ConfigUri & configUri) :
mbus::IRoutingPolicy(),
config::IFetcherCallback<MessagetyperouteselectorpolicyConfig>(),
@@ -23,7 +37,7 @@ MessageTypePolicy::~MessageTypePolicy() {}
void
MessageTypePolicy::configure(std::unique_ptr<MessagetyperouteselectorpolicyConfig> cfg)
{
- std::unique_ptr<MessageTypeMap> map(new MessageTypeMap);
+ auto map = std::make_unique<policy::MessageTypeMap>();
for (size_t i(0), m(cfg->route.size()); i < m; i++) {
const MessagetyperouteselectorpolicyConfig::Route & r = cfg->route[i];
(*map)[r.messagetype] = mbus::Route::parse(r.name);
@@ -38,8 +52,8 @@ void
MessageTypePolicy::select(mbus::RoutingContext & context)
{
int messageType = context.getMessage().getType();
- std::shared_ptr<MessageTypeMap> map = _map.get();
- MessageTypeMap::const_iterator found = map->find(messageType);
+ std::shared_ptr<policy::MessageTypeMap> map = _map.get();
+ policy::MessageTypeMap::const_iterator found = map->find(messageType);
if (found != map->end()) {
context.addChild(found->second);
} else {
diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h
index d9a324a79c5..18ae4d1acb8 100644
--- a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h
+++ b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h
@@ -1,20 +1,20 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/document/select/node.h>
-#include <map>
#include <vespa/messagebus/routing/iroutingpolicy.h>
-#include <vespa/messagebus/routing/route.h>
-#include <vespa/messagebus/routing/routingcontext.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/vespalib/util/ptrholder.h>
#include <vespa/config-messagetyperouteselectorpolicy.h>
#include <vespa/config/config.h>
#include <vespa/config/helper/configfetcher.h>
#include <vespa/documentapi/common.h>
+namespace mbus {
+ class RoutingContext;
+ class Route;
+}
namespace documentapi {
+namespace policy {class MessageTypeMap; }
/**
* This policy is responsible for selecting among the given recipient routes
* according to the configured document selection properties. To factilitate
@@ -26,8 +26,7 @@ class MessageTypePolicy : public mbus::IRoutingPolicy,
public config::IFetcherCallback<vespa::config::content::MessagetyperouteselectorpolicyConfig>
{
private:
- typedef vespalib::hash_map<int, mbus::Route> MessageTypeMap;
- typedef vespalib::PtrHolder<MessageTypeMap> MessageTypeHolder;
+ typedef vespalib::PtrHolder<policy::MessageTypeMap> MessageTypeHolder;
typedef vespalib::PtrHolder<mbus::Route> RouteHolder;
MessageTypeHolder _map;
diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp
index 5aaf7919d71..f19e0c4c85f 100644
--- a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp
+++ b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.cpp
@@ -7,6 +7,7 @@
#include <vespa/documentapi/documentapi.h>
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/config-stor-distribution.h>
#include <vespa/config/helper/ifetchercallback.h>
#include <vespa/config/helper/configfetcher.h>
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_builder.cpp b/eval/src/vespa/eval/tensor/dense/dense_tensor_builder.cpp
index a00537ffa50..3c6e182a143 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_tensor_builder.cpp
+++ b/eval/src/vespa/eval/tensor/dense/dense_tensor_builder.cpp
@@ -2,6 +2,7 @@
#include "dense_tensor_builder.h"
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <cassert>
using vespalib::IllegalArgumentException;
diff --git a/fastos/src/tests/tests.h b/fastos/src/tests/tests.h
index cc54e66292f..6807741f86f 100644
--- a/fastos/src/tests/tests.h
+++ b/fastos/src/tests/tests.h
@@ -2,6 +2,7 @@
#include <vespa/fastos/app.h>
#include <vespa/fastos/socket.h>
+#include <vespa/fastos/thread.h>
class BaseTest : public FastOS_Application
{
diff --git a/fastos/src/vespa/fastos/app.h b/fastos/src/vespa/fastos/app.h
index 75fb5c30d43..faa6ff55c7d 100644
--- a/fastos/src/vespa/fastos/app.h
+++ b/fastos/src/vespa/fastos/app.h
@@ -13,8 +13,8 @@
#include <vespa/fastos/types.h>
class FastOS_ProcessInterface;
+class FastOS_ThreadPool;
-#include <vespa/fastos/thread.h>
#include <vespa/fastos/mutex.h>
/**
diff --git a/fastos/src/vespa/fastos/unix_process.h b/fastos/src/vespa/fastos/unix_process.h
index d3b3f0f3d96..7438b96d434 100644
--- a/fastos/src/vespa/fastos/unix_process.h
+++ b/fastos/src/vespa/fastos/unix_process.h
@@ -13,7 +13,7 @@
#include <string>
#include <memory>
-class FastOS_ThreadPool;
+class FastOS_BoolCond;
class FastOS_UNIX_RealProcess;
#include <vespa/fastos/ringbuffer.h>
diff --git a/filedistribution/src/vespa/filedistribution/distributor/filedownloader.cpp b/filedistribution/src/vespa/filedistribution/distributor/filedownloader.cpp
index cbd93eb2e57..14cb8844d8b 100644
--- a/filedistribution/src/vespa/filedistribution/distributor/filedownloader.cpp
+++ b/filedistribution/src/vespa/filedistribution/distributor/filedownloader.cpp
@@ -2,6 +2,7 @@
#include "filedownloader.h"
#include "hostname.h"
#include <vespa/filedistribution/model/zkfacade.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
diff --git a/filedistribution/src/vespa/filedistribution/distributor/hostname.cpp b/filedistribution/src/vespa/filedistribution/distributor/hostname.cpp
index 7b33632df81..f307ae1fca3 100644
--- a/filedistribution/src/vespa/filedistribution/distributor/hostname.cpp
+++ b/filedistribution/src/vespa/filedistribution/distributor/hostname.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "hostname.h"
+#include "hostname.h"
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/net/socket_address.h>
#include <vespa/log/log.h>
LOG_SETUP(".hostname");
diff --git a/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp b/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp
index 3b4d043a30b..15ff198b8d5 100644
--- a/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp
+++ b/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp
@@ -4,6 +4,7 @@
#include "zkfiledbmodel.h"
#include "deployedfilestodownload.h"
#include "filedistributionmodelimpl.h"
+#include <vespa/vespalib/util/stringfmt.h>
#include <boost/filesystem.hpp>
#include <zookeeper/zookeeper.h>
diff --git a/filedistribution/src/vespa/filedistribution/model/zkfacade.cpp b/filedistribution/src/vespa/filedistribution/model/zkfacade.cpp
index 2400eae9eb7..28e0e82f79a 100644
--- a/filedistribution/src/vespa/filedistribution/model/zkfacade.cpp
+++ b/filedistribution/src/vespa/filedistribution/model/zkfacade.cpp
@@ -2,15 +2,15 @@
#include "zkfacade.h"
#include <vespa/vespalib/net/socket_address.h>
-#include <sstream>
-#include <thread>
-#include <boost/function_output_iterator.hpp>
-
-#include <zookeeper/zookeeper.h>
#include <vespa/filedistribution/common/logfwd.h>
#include <vespa/defaults.h>
#include <vespa/vespalib/util/sync.h>
#include <vespa/vespalib/text/stringtokenizer.h>
+#include <vespa/vespalib/util/stringfmt.h>
+#include <zookeeper/zookeeper.h>
+#include <sstream>
+#include <thread>
+#include <boost/function_output_iterator.hpp>
typedef std::unique_lock<std::mutex> UniqueLock;
diff --git a/filedistribution/src/vespa/filedistribution/model/zkfiledbmodel.cpp b/filedistribution/src/vespa/filedistribution/model/zkfiledbmodel.cpp
index 5198b6bbeb7..4030b777afa 100644
--- a/filedistribution/src/vespa/filedistribution/model/zkfiledbmodel.cpp
+++ b/filedistribution/src/vespa/filedistribution/model/zkfiledbmodel.cpp
@@ -5,6 +5,7 @@
#include "zkfiledbmodel.h"
#include "deployedfilestodownload.h"
#include <vespa/filedistribution/common/logfwd.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <sys/file.h>
#include <ostream>
#include <algorithm>
diff --git a/fnet/src/tests/sync_execute/sync_execute.cpp b/fnet/src/tests/sync_execute/sync_execute.cpp
index ca77ab6f73b..8b0edb4476f 100644
--- a/fnet/src/tests/sync_execute/sync_execute.cpp
+++ b/fnet/src/tests/sync_execute/sync_execute.cpp
@@ -2,6 +2,7 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/fnet/transport.h>
#include <vespa/fnet/iexecutable.h>
+#include <vespa/fastos/thread.h>
struct DoIt : public FNET_IExecutable {
vespalib::Gate gate;
diff --git a/memfilepersistence/src/tests/device/devicemanagertest.cpp b/memfilepersistence/src/tests/device/devicemanagertest.cpp
index f5e16032361..50a4e8ef56c 100644
--- a/memfilepersistence/src/tests/device/devicemanagertest.cpp
+++ b/memfilepersistence/src/tests/device/devicemanagertest.cpp
@@ -3,6 +3,7 @@
#include <vespa/memfilepersistence/device/devicemanager.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/util/exception.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
namespace storage {
diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/types.cpp b/memfilepersistence/src/vespa/memfilepersistence/common/types.cpp
index f02423cb194..2bc85fbc422 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/common/types.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/common/types.cpp
@@ -1,11 +1,11 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "types.h"
-#include <sstream>
#include <vespa/vespalib/util/exceptions.h>
+#include <cassert>
+#include <sstream>
-namespace storage {
-namespace memfile {
+namespace storage::memfile {
const framework::MicroSecTime Types::MAX_TIMESTAMP(framework::MicroSecTime::max());
const framework::MicroSecTime Types::UNSET_TIMESTAMP(0);
@@ -34,5 +34,17 @@ operator<<(std::ostream& os, const DataLocation& loc)
return os;
}
-} // memfile
-} // storage
+const char*
+Types::getMemFileFlagName(MemFileFlag flag) {
+ switch (flag) {
+ case FILE_EXIST: return "FILE_EXIST";
+ case HEADER_BLOCK_READ: return "HEADER_BLOCK_READ";
+ case BODY_BLOCK_READ: return "BODY_BLOCK_READ";
+ case BUCKET_INFO_OUTDATED: return "BUCKET_INFO_OUTDATED";
+ case SLOTS_ALTERED: return "SLOTS_ALTERED";
+ case LEGAL_MEMFILE_FLAGS: assert(false); // Not a single flag
+ default: return "INVALID";
+ }
+}
+
+}
diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/types.h b/memfilepersistence/src/vespa/memfilepersistence/common/types.h
index 7758e6091ac..c1f29571037 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/common/types.h
+++ b/memfilepersistence/src/vespa/memfilepersistence/common/types.h
@@ -173,21 +173,9 @@ struct Types {
}
}
- static const char* getMemFileFlagName(MemFileFlag flag) {
- switch (flag) {
- case FILE_EXIST: return "FILE_EXIST";
- case HEADER_BLOCK_READ: return "HEADER_BLOCK_READ";
- case BODY_BLOCK_READ: return "BODY_BLOCK_READ";
- case BUCKET_INFO_OUTDATED: return "BUCKET_INFO_OUTDATED";
- case SLOTS_ALTERED: return "SLOTS_ALTERED";
- case LEGAL_MEMFILE_FLAGS: assert(false); // Not a single flag
- default: return "INVALID";
- }
- }
-
- static void verifyLegalFlags(uint32_t flags, uint32_t legal,
- const char* operation);
+ static const char* getMemFileFlagName(MemFileFlag flag);
+ static void verifyLegalFlags(uint32_t flags, uint32_t legal, const char* operation);
protected:
~Types() {} // Noone should refer to objects as Types objects
};
diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp
index 1f5344d466e..6bda3d69113 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp
@@ -2,10 +2,11 @@
#include "simplememfileiobuffer.h"
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/memfilepersistence/common/environment.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/document/util/bytebuffer.h>
#include <vespa/log/log.h>
-
LOG_SETUP(".memfile.simpleiobuffer");
namespace storage::memfile {
diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/joinoperationhandler.cpp b/memfilepersistence/src/vespa/memfilepersistence/spi/joinoperationhandler.cpp
index 1f82ffb2172..0fc2aa2ece6 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/spi/joinoperationhandler.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/spi/joinoperationhandler.cpp
@@ -3,6 +3,7 @@
#include "joinoperationhandler.h"
#include "cacheevictionguard.h"
#include <vespa/memfilepersistence/mapper/memfilemapper.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".persistence.memfile.handler.join");
diff --git a/messagebus/src/vespa/messagebus/testlib/slobrok.cpp b/messagebus/src/vespa/messagebus/testlib/slobrok.cpp
index 10c501db854..12f53e31764 100644
--- a/messagebus/src/vespa/messagebus/testlib/slobrok.cpp
+++ b/messagebus/src/vespa/messagebus/testlib/slobrok.cpp
@@ -4,6 +4,7 @@
#include <vespa/slobrok/server/sbenv.h>
#include <vespa/fnet/frt/supervisor.h>
#include <vespa/fnet/transport.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".slobrok");
diff --git a/metrics/src/vespa/metrics/metric.cpp b/metrics/src/vespa/metrics/metric.cpp
index 57ce8e5ffc1..0c99409a8bb 100644
--- a/metrics/src/vespa/metrics/metric.cpp
+++ b/metrics/src/vespa/metrics/metric.cpp
@@ -8,6 +8,7 @@
#include <vespa/vespalib/text/stringtokenizer.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <iterator>
namespace metrics {
diff --git a/metrics/src/vespa/metrics/metricmanager.cpp b/metrics/src/vespa/metrics/metricmanager.cpp
index 572779be855..db05ea16488 100644
--- a/metrics/src/vespa/metrics/metricmanager.cpp
+++ b/metrics/src/vespa/metrics/metricmanager.cpp
@@ -10,7 +10,7 @@
#include "xmlwriter.h"
#include <vespa/config/print/ostreamconfigwriter.h>
#include <vespa/vespalib/text/stringtokenizer.h>
-
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/log/log.h>
diff --git a/metrics/src/vespa/metrics/metricset.cpp b/metrics/src/vespa/metrics/metricset.cpp
index 15ee22ba1f2..c9acbaafce2 100644
--- a/metrics/src/vespa/metrics/metricset.cpp
+++ b/metrics/src/vespa/metrics/metricset.cpp
@@ -4,10 +4,10 @@
#include "memoryconsumption.h"
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <list>
#include <vespa/log/log.h>
-
LOG_SETUP(".metrics.metricsset");
namespace metrics {
diff --git a/metrics/src/vespa/metrics/printutils.cpp b/metrics/src/vespa/metrics/printutils.cpp
index 2373d2391ff..2209ebd5da7 100644
--- a/metrics/src/vespa/metrics/printutils.cpp
+++ b/metrics/src/vespa/metrics/printutils.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "printutils.h"
+#include <vespa/vespalib/util/stringfmt.h>
namespace metrics {
namespace printutils {
diff --git a/metrics/src/vespa/metrics/summetric.hpp b/metrics/src/vespa/metrics/summetric.hpp
index 1a54067b01f..3e85aa0e215 100644
--- a/metrics/src/vespa/metrics/summetric.hpp
+++ b/metrics/src/vespa/metrics/summetric.hpp
@@ -5,6 +5,7 @@
#include "metricset.h"
#include "memoryconsumption.h"
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <ostream>
namespace metrics {
diff --git a/metrics/src/vespa/metrics/valuemetric.hpp b/metrics/src/vespa/metrics/valuemetric.hpp
index 65a0c2bb5b2..b09f35e3272 100644
--- a/metrics/src/vespa/metrics/valuemetric.hpp
+++ b/metrics/src/vespa/metrics/valuemetric.hpp
@@ -4,6 +4,7 @@
#include "valuemetric.h"
#include "memoryconsumption.h"
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <sstream>
namespace metrics {
diff --git a/metrics/src/vespa/metrics/valuemetricvalues.hpp b/metrics/src/vespa/metrics/valuemetricvalues.hpp
index d8becca3e72..e7f3e9e3239 100644
--- a/metrics/src/vespa/metrics/valuemetricvalues.hpp
+++ b/metrics/src/vespa/metrics/valuemetricvalues.hpp
@@ -3,6 +3,7 @@
#include "valuemetricvalues.h"
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <ostream>
namespace metrics {
diff --git a/persistence/src/tests/proxy/providerproxy_test.cpp b/persistence/src/tests/proxy/providerproxy_test.cpp
index 514d9516c65..28ce33a2b5b 100644
--- a/persistence/src/tests/proxy/providerproxy_test.cpp
+++ b/persistence/src/tests/proxy/providerproxy_test.cpp
@@ -8,6 +8,7 @@
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/persistence/proxy/providerproxy.h>
#include <vespa/persistence/proxy/providerstub.h>
#include <vespa/persistence/spi/abstractpersistenceprovider.h>
diff --git a/persistence/src/tests/proxy/providerstub_test.cpp b/persistence/src/tests/proxy/providerstub_test.cpp
index 1028e06b8bc..c750a3c94af 100644
--- a/persistence/src/tests/proxy/providerstub_test.cpp
+++ b/persistence/src/tests/proxy/providerstub_test.cpp
@@ -7,6 +7,7 @@
#include <vespa/document/util/bytebuffer.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/persistence/proxy/buildid.h>
#include <vespa/persistence/proxy/providerstub.h>
#include <vespa/persistence/spi/abstractpersistenceprovider.h>
diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
index d2a3ab3be65..05e21096fef 100644
--- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
+++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
@@ -9,6 +9,7 @@
#include <vespa/document/fieldset/fieldsetrepo.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/atomic.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/log/log.h>
diff --git a/persistence/src/vespa/persistence/proxy/providerproxy.cpp b/persistence/src/vespa/persistence/proxy/providerproxy.cpp
index 1f6d0b19be6..29b09af9953 100644
--- a/persistence/src/vespa/persistence/proxy/providerproxy.cpp
+++ b/persistence/src/vespa/persistence/proxy/providerproxy.cpp
@@ -8,9 +8,8 @@
#include <vespa/document/fieldset/fieldsetrepo.h>
#include <vespa/document/serialization/vespadocumentdeserializer.h>
#include <vespa/document/serialization/vespadocumentserializer.h>
-#include <vespa/document/util/bytebuffer.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/objects/nbostream.h>
-#include <vespa/vespalib/util/noncopyable.hpp>
#include <vespa/fnet/frt/frt.h>
#include <vespa/log/log.h>
LOG_SETUP(".providerproxy");
diff --git a/persistence/src/vespa/persistence/spi/docentry.cpp b/persistence/src/vespa/persistence/spi/docentry.cpp
index c9ceda982e0..1061a06fd28 100644
--- a/persistence/src/vespa/persistence/spi/docentry.cpp
+++ b/persistence/src/vespa/persistence/spi/docentry.cpp
@@ -3,6 +3,7 @@
#include "docentry.h"
#include <vespa/document/fieldvalue/document.h>
#include <sstream>
+#include <cassert>
namespace storage {
namespace spi {
diff --git a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp
index bfbe27cb26c..58844dc969c 100644
--- a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp
+++ b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp
@@ -5,6 +5,7 @@
#include <vespa/config/common/configsystem.h>
#include <vespa/fnet/frt/frt.h>
#include <vespa/vespalib/util/host_name.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/fastos/app.h>
#include <algorithm>
#include <string>
diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp
index fb5e40767ab..1117234f18f 100644
--- a/searchcore/src/tests/proton/common/cachedselect_test.cpp
+++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp
@@ -23,6 +23,7 @@
#include <vespa/document/fieldvalue/stringfieldvalue.h>
#include <vespa/document/fieldvalue/intfieldvalue.h>
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/log/log.h>
LOG_SETUP("cachedselect_test");
diff --git a/searchcore/src/tests/proton/common/selectpruner_test.cpp b/searchcore/src/tests/proton/common/selectpruner_test.cpp
index 4ecefde024c..29ef6ef016c 100644
--- a/searchcore/src/tests/proton/common/selectpruner_test.cpp
+++ b/searchcore/src/tests/proton/common/selectpruner_test.cpp
@@ -3,6 +3,7 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/searchcore/proton/common/selectpruner.h>
#include <vespa/document/select/parser.h>
#include <vespa/document/select/cloningvisitor.h>
diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
index 0ccd5b8d6ee..8261ae80e02 100644
--- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
+++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
@@ -2,6 +2,7 @@
#include <vespa/document/fieldset/fieldsets.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/persistence/spi/bucket.h>
#include <vespa/persistence/spi/docentry.h>
#include <vespa/persistence/spi/result.h>
diff --git a/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp b/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp
index 6a2c283dc8d..db95898e349 100644
--- a/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_scan_iterator/document_scan_iterator_test.cpp
@@ -4,6 +4,7 @@
#include <vespa/vespalib/test/insertion_operators.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/document/base/documentid.h>
+#include <vespa/vespalib/util/stringfmt.h>
using namespace document;
using namespace proton;
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
index 5b550f9c49d..d757e48e7d0 100644
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
@@ -1,10 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <tests/proton/common/dummydbowner.h>
-#include <vespa/document/repo/documenttyperepo.h>
-#include <vespa/messagebus/emptyreply.h>
-#include <vespa/messagebus/testlib/receptor.h>
-#include <vespa/searchcommon/common/schema.h>
#include <vespa/searchcore/proton/attribute/flushableattribute.h>
#include <vespa/searchcore/proton/common/feedtoken.h>
#include <vespa/searchcore/proton/common/hw_info.h>
@@ -26,6 +22,9 @@
#include <vespa/searchcorespi/index/indexflushtarget.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/transactionlog/translogserver.h>
+#include <vespa/messagebus/emptyreply.h>
+#include <vespa/messagebus/testlib/receptor.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/testkit/test_kit.h>
diff --git a/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp b/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp
index 6077ca5fe76..1c8165d9f17 100644
--- a/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp
+++ b/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp
@@ -25,6 +25,7 @@
#include <vespa/document/fieldvalue/fieldvalues.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/testkit/testapp.h>
using document::BucketId;
diff --git a/searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp b/searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp
index 45931307c0e..816e214aa0c 100644
--- a/searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp
+++ b/searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp
@@ -1,12 +1,13 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("documentdb_job_trackers_test");
#include <vespa/searchcore/proton/metrics/documentdb_job_trackers.h>
#include <vespa/searchcore/proton/metrics/job_tracked_flush_target.h>
#include <vespa/searchcore/proton/test/dummy_flush_target.h>
#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/log/log.h>
+LOG_SETUP("documentdb_job_trackers_test");
+
using namespace proton;
using namespace searchcorespi;
@@ -61,7 +62,7 @@ TEST_F("require that job metrics are updated", Fixture)
// Update metrics 2 times to ensure that all jobs are running
// in the last interval we actually care about.
f._trackers.updateMetrics(f._metrics);
- FastOS_Thread::Sleep(100);
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
f._trackers.updateMetrics(f._metrics);
EXPECT_APPROX(1.0, f._metrics.attributeFlush.getLast(), EPS);
diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
index 19843cb9531..8dea47e850f 100644
--- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
+++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
@@ -1,5 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/persistence/spi/documentselection.h>
#include <vespa/searchcore/proton/persistenceengine/bucket_guard.h>
#include <vespa/searchcore/proton/persistenceengine/ipersistenceengineowner.h>
diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp
index bd2fe12e894..b0541f9ac71 100644
--- a/searchcore/src/tests/proton/server/documentretriever_test.cpp
+++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp
@@ -5,6 +5,7 @@
#include <vespa/document/bucket/bucketid.h>
#include <vespa/document/datatype/datatype.h>
#include <vespa/document/datatype/positiondatatype.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldvalue/arrayfieldvalue.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/fieldvalue/doublefieldvalue.h>
@@ -29,11 +30,7 @@
#include <vespa/searchlib/attribute/integerbase.h>
#include <vespa/searchlib/attribute/predicate_attribute.h>
#include <vespa/searchlib/attribute/stringbase.h>
-#include <vespa/searchlib/docstore/cachestats.h>
-#include <vespa/searchlib/docstore/idocumentstore.h>
-#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/stringfmt.h>
using document::ArrayFieldValue;
using document::FieldValue;
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
index 60cc292cbeb..a357fb92980 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
@@ -5,6 +5,7 @@
#include <vespa/searchcore/proton/common/attrupdate.h>
#include <vespa/searchlib/attribute/attributevector.hpp>
#include <vespa/searchlib/common/isequencedtaskexecutor.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.attributeadapter");
diff --git a/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp b/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp
index c166dfbe634..001eb7d16f3 100644
--- a/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/selectpruner.cpp
@@ -2,15 +2,13 @@
#include "selectpruner.h"
#include <vespa/document/base/exceptions.h>
-#include <vespa/document/base/fieldpath.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/document/select/compare.h>
-#include <vespa/document/select/operator.h>
#include <vespa/document/select/constant.h>
#include <vespa/document/select/branch.h>
#include <vespa/document/select/doctype.h>
#include <vespa/document/select/invalidconstant.h>
-#include <vespa/document/select/constant.h>
#include <vespa/searchlib/attribute/iattributemanager.h>
using document::select::And;
diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.cpp
index 2a369cb821b..2cbfee1d5c9 100644
--- a/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.cpp
+++ b/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.cpp
@@ -1,8 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "moveoperation.h"
-#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/document/fieldvalue/document.h>
+#include <cassert>
using document::BucketId;
using document::Document;
diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp
index 9df67a6bf11..79629410b00 100644
--- a/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp
+++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp
@@ -4,6 +4,7 @@
#include <vespa/document/select/gid_filter.h>
#include <vespa/document/select/node.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/vespalib/stllike/hash_map.h>
#include <vespa/log/log.h>
LOG_SETUP(".proton.persistenceengine.document_iterator");
diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp
index 78eb1cfb3f6..94bac320ef3 100644
--- a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp
+++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "transport_latch.h"
+#include <vespa/vespalib/util/stringfmt.h>
using storage::spi::Result;
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp b/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp
index a3566de66b9..e40d6480cc3 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp
@@ -2,6 +2,7 @@
#include "documentretriever.h"
#include <vespa/document/datatype/positiondatatype.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/searchcore/proton/attribute/document_field_retriever.h>
#include <vespa/vespalib/geo/zcurve.h>
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.cpp b/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.cpp
index 07a04905beb..63cfded1962 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentretrieverbase.cpp
@@ -2,6 +2,7 @@
#include "documentretrieverbase.h"
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/stllike/lrucache_map.hpp>
using document::DocumentId;
diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
index 2f36f5140df..aa1541d766e 100644
--- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
@@ -12,15 +12,13 @@
#include <vespa/documentapi/messagebus/messages/feedreply.h>
#include <vespa/documentapi/messagebus/messages/removedocumentreply.h>
#include <vespa/documentapi/messagebus/messages/updatedocumentreply.h>
-#include <vespa/searchcore/proton/common/bucketfactory.h>
-#include <vespa/searchcore/proton/feedoperation/moveoperation.h>
-#include <vespa/searchcore/proton/feedoperation/operations.h>
#include <vespa/searchcore/proton/persistenceengine/transport_latch.h>
#include <vespa/searchcore/proton/bucketdb/ibucketdbhandler.h>
#include <vespa/searchcorespi/index/ithreadingservice.h>
#include <vespa/vespalib/util/closuretask.h>
#include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.feedhandler");
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
index 86ee2fe2ac0..c567930d68d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
@@ -4,6 +4,7 @@
#include "searchcontext.h"
#include <vespa/searchlib/engine/searchrequest.h>
#include <vespa/searchlib/engine/searchreply.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.matchview");
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index be8df97b683..271c127bcee 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -21,6 +21,7 @@
#include <vespa/searchlib/util/fileheadertk.h>
#include <vespa/searchcommon/common/schemaconfigurer.h>
#include <vespa/document/base/exceptions.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/closuretask.h>
#include <vespa/vespalib/util/host_name.h>
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
index ac24469e4d2..e27a710022f 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
@@ -2,23 +2,21 @@
#include "ireplayconfig.h"
#include "storeonlyfeedview.h"
-#include <vespa/searchcore/proton/common/bucketfactory.h>
-#include <vespa/searchcore/proton/common/commit_time_tracker.h>
-#include <vespa/searchcore/proton/common/feedtoken.h>
-#include <vespa/searchcore/proton/metrics/feed_metrics.h>
-#include <vespa/searchcore/proton/documentmetastore/ilidreusedelayer.h>
-#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/text/stringtokenizer.h>
-#include <vespa/vespalib/util/closuretask.h>
-#include <vespa/searchcore/proton/feedoperation/moveoperation.h>
#include "forcecommitcontext.h"
#include "operationdonecontext.h"
#include "removedonecontext.h"
#include "updatedonecontext.h"
#include "putdonecontext.h"
-#include <vespa/searchlib/common/lambdatask.h>
+#include <vespa/searchcore/proton/common/commit_time_tracker.h>
+#include <vespa/searchcore/proton/common/feedtoken.h>
+#include <vespa/searchcore/proton/metrics/feed_metrics.h>
+#include <vespa/searchcore/proton/documentmetastore/ilidreusedelayer.h>
#include <vespa/searchlib/common/scheduletaskcallback.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/text/stringtokenizer.h>
+#include <vespa/vespalib/util/closuretask.h>
+
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.storeonlyfeedview");
diff --git a/searchcore/src/vespa/searchcore/proton/test/bucketdocuments.h b/searchcore/src/vespa/searchcore/proton/test/bucketdocuments.h
index b2fc3ff6dbc..f0d10d9ecbd 100644
--- a/searchcore/src/vespa/searchcore/proton/test/bucketdocuments.h
+++ b/searchcore/src/vespa/searchcore/proton/test/bucketdocuments.h
@@ -2,6 +2,7 @@
#pragma once
#include "document.h"
+#include <cassert>
namespace proton {
diff --git a/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp b/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp
index 6c628b761b4..df1fffa2a0e 100644
--- a/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp
+++ b/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp
@@ -7,6 +7,7 @@
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/common/bitvector.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/stllike/asciistream.h>
diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
index fc69cf12d74..46e7333ebb7 100644
--- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
+++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp
@@ -3,6 +3,7 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/searchlib/docstore/chunkformats.h>
#include <vespa/searchlib/docstore/logdocumentstore.h>
#include <vespa/searchlib/docstore/storebybucket.h>
diff --git a/searchlib/src/tests/engine/transportserver/transportserver_test.cpp b/searchlib/src/tests/engine/transportserver/transportserver_test.cpp
index b7932ea2381..d8fd8a52b0e 100644
--- a/searchlib/src/tests/engine/transportserver/transportserver_test.cpp
+++ b/searchlib/src/tests/engine/transportserver/transportserver_test.cpp
@@ -4,7 +4,7 @@
#include <vespa/document/base/documentid.h>
#include <vespa/searchlib/common/packets.h>
#include <vespa/searchlib/engine/transportserver.h>
-
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/fnet/fnet.h>
#include <vespa/searchlib/engine/errorcodes.h>
#include <vespa/log/log.h>
diff --git a/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp b/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp
index 44077d06d15..16670c0ff30 100644
--- a/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp
+++ b/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp
@@ -7,6 +7,7 @@
#include <vespa/searchlib/features/element_completeness_feature.h>
#include <vespa/searchlib/fef/test/ftlib.h>
#include <vespa/searchlib/fef/test/dummy_dependency_handler.h>
+#include <vespa/vespalib/util/stringfmt.h>
using namespace search::fef;
using namespace search::fef::test;
diff --git a/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp b/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp
index d693062bb00..f9e1fc902c8 100644
--- a/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp
+++ b/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp
@@ -8,6 +8,7 @@
#include <vespa/searchlib/fef/test/ftlib.h>
#include <initializer_list>
#include <vespa/searchlib/fef/test/dummy_dependency_handler.h>
+#include <vespa/vespalib/util/stringfmt.h>
using namespace search::fef;
using namespace search::fef::test;
diff --git a/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp b/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp
index 51405064ac6..44f4fd46765 100644
--- a/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp
+++ b/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp
@@ -9,6 +9,7 @@
#include <vespa/searchlib/fef/fef.h>
#include <vespa/searchlib/fef/test/dummy_dependency_handler.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/stringfmt.h>
using search::feature_t;
using namespace search::fef;
diff --git a/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp b/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp
index 93313c69a3f..a84e8f42847 100644
--- a/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp
+++ b/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp
@@ -8,6 +8,7 @@
#include <vespa/searchlib/fef/fef.h>
#include <vespa/searchlib/query/weight.h>
#include <vespa/searchlib/fef/test/dummy_dependency_handler.h>
+#include <vespa/vespalib/util/stringfmt.h>
using search::feature_t;
using namespace search::fef;
diff --git a/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp b/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp
index 7ae7ba8b26a..3a3dba039ff 100644
--- a/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp
+++ b/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp
@@ -1,9 +1,10 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP(".prod_features_fieldtermmatch");
#include "prod_features.h"
#include <vespa/searchlib/features/fieldtermmatchfeature.h>
+#include <vespa/vespalib/util/stringfmt.h>
+#include <vespa/log/log.h>
+LOG_SETUP(".prod_features_fieldtermmatch");
using namespace search::features;
using namespace search::fef;
diff --git a/searchlib/src/tests/features/raw_score/raw_score_test.cpp b/searchlib/src/tests/features/raw_score/raw_score_test.cpp
index 8b97a8edbcc..acf5066b2c3 100644
--- a/searchlib/src/tests/features/raw_score/raw_score_test.cpp
+++ b/searchlib/src/tests/features/raw_score/raw_score_test.cpp
@@ -7,6 +7,7 @@
#include <vespa/searchlib/features/raw_score_feature.h>
#include <vespa/searchlib/fef/fef.h>
#include <vespa/searchlib/fef/test/dummy_dependency_handler.h>
+#include <vespa/vespalib/util/stringfmt.h>
using search::feature_t;
using namespace search::fef;
diff --git a/searchlib/src/tests/features/subqueries/subqueries_test.cpp b/searchlib/src/tests/features/subqueries/subqueries_test.cpp
index 233b3a65b9f..0dfe2858735 100644
--- a/searchlib/src/tests/features/subqueries/subqueries_test.cpp
+++ b/searchlib/src/tests/features/subqueries/subqueries_test.cpp
@@ -7,6 +7,7 @@
#include <vespa/searchlib/features/subqueries_feature.h>
#include <vespa/searchlib/fef/fef.h>
#include <vespa/searchlib/fef/test/dummy_dependency_handler.h>
+#include <vespa/vespalib/util/stringfmt.h>
using search::feature_t;
using namespace search::fef;
diff --git a/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp b/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp
index 88b043cb2e8..bf5416291d7 100644
--- a/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp
+++ b/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp
@@ -8,6 +8,7 @@
#include <vespa/searchlib/fef/test/ftlib.h>
#include <initializer_list>
#include <vespa/searchlib/fef/test/dummy_dependency_handler.h>
+#include <vespa/vespalib/util/stringfmt.h>
using namespace search::fef;
using namespace search::fef::test;
diff --git a/searchlib/src/vespa/searchlib/docstore/chunkformat.cpp b/searchlib/src/vespa/searchlib/docstore/chunkformat.cpp
index cd44d34ea22..cddf8c96b2e 100644
--- a/searchlib/src/vespa/searchlib/docstore/chunkformat.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/chunkformat.cpp
@@ -2,6 +2,7 @@
#include "chunkformats.h"
#include <vespa/document/util/compressor.h>
+#include <vespa/vespalib/util/stringfmt.h>
namespace search {
diff --git a/searchlib/src/vespa/searchlib/docstore/chunkformats.cpp b/searchlib/src/vespa/searchlib/docstore/chunkformats.cpp
index c715f8a2129..0843d473121 100644
--- a/searchlib/src/vespa/searchlib/docstore/chunkformats.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/chunkformats.cpp
@@ -3,6 +3,7 @@
#include "chunkformats.h"
#include <vespa/vespalib/util/crc.h>
#include <vespa/vespalib/xxhash/xxhash.h>
+#include <vespa/vespalib/util/stringfmt.h>
namespace search {
diff --git a/searchlib/src/vespa/searchlib/docstore/documentstore.cpp b/searchlib/src/vespa/searchlib/docstore/documentstore.cpp
index dd6a0f07197..fd7df29cd49 100644
--- a/searchlib/src/vespa/searchlib/docstore/documentstore.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/documentstore.cpp
@@ -5,6 +5,8 @@
#include "visitcache.h"
#include "ibucketizer.h"
#include <vespa/vespalib/stllike/cache.hpp>
+#include <vespa/vespalib/data/databuffer.h>
+#include <vespa/document/util/compressor.h>
namespace search {
diff --git a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp
index c424cb61d8c..8fac288a23a 100644
--- a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp
@@ -4,9 +4,10 @@
#include "ibucketizer.h"
#include <vespa/vespalib/stllike/cache.hpp>
#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/vespalib/data/databuffer.h>
+#include <vespa/document/util/compressor.h>
-namespace search {
-namespace docstore {
+namespace search::docstore {
using vespalib::ConstBufferRef;
using vespalib::LockGuard;
@@ -241,5 +242,3 @@ VisitCache::Cache::onRemove(const K & key) {
}
}
-}
-
diff --git a/searchlib/src/vespa/searchlib/docstore/visitcache.h b/searchlib/src/vespa/searchlib/docstore/visitcache.h
index d47796d446a..6e5887349ee 100644
--- a/searchlib/src/vespa/searchlib/docstore/visitcache.h
+++ b/searchlib/src/vespa/searchlib/docstore/visitcache.h
@@ -6,11 +6,12 @@
#include "cachestats.h"
#include <vespa/vespalib/stllike/cache.h>
#include <vespa/vespalib/stllike/hash_set.h>
+#include <vespa/vespalib/stllike/hash_map.h>
#include <vespa/vespalib/util/alloc.h>
#include <vespa/vespalib/objects/nbostream.h>
+#include <vespa/document/util/bytebuffer.h>
-namespace search {
-namespace docstore {
+namespace search::docstore {
/**
* Represents a unique set of keys that together acts as a key in a map.
@@ -160,4 +161,3 @@ private:
};
}
-}
diff --git a/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.cpp b/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.cpp
index 7d443219f29..eaa96587d6d 100644
--- a/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.cpp
+++ b/searchlib/src/vespa/searchlib/expression/arrayatlookupfunctionnode.cpp
@@ -4,7 +4,7 @@
#include "integerresultnode.h"
#include "stringresultnode.h"
#include <vespa/searchcommon/attribute/iattributecontext.h>
-
+#include <vespa/vespalib/util/stringfmt.h>
namespace search {
namespace expression {
diff --git a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp
index 3a5375b672b..d9e4f6a3253 100644
--- a/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp
+++ b/searchlib/src/vespa/searchlib/expression/documentfieldnode.cpp
@@ -3,6 +3,7 @@
#include "getdocidnamespacespecificfunctionnode.h"
#include "getymumchecksumfunctionnode.h"
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/encoding/base64.h>
#include <vespa/log/log.h>
diff --git a/searchlib/src/vespa/searchlib/expression/resultnode.cpp b/searchlib/src/vespa/searchlib/expression/resultnode.cpp
index 3306068efdf..bd8a5ff03d5 100644
--- a/searchlib/src/vespa/searchlib/expression/resultnode.cpp
+++ b/searchlib/src/vespa/searchlib/expression/resultnode.cpp
@@ -1,10 +1,18 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
#include "resultnode.h"
-#include <stdexcept>
+#include <vespa/vespalib/util/stringfmt.h>
+#include <vespa/vespalib/util/exception.h>
namespace search {
namespace expression {
+int64_t
+ResultNode::onGetEnum(size_t index) const {
+ (void) index;
+ throw vespalib::Exception("search::expression::ResultNode onGetEnum is not implemented");
+}
+
uint64_t ResultNode::radixAsc(const void * buf) const
{
(void) buf;
@@ -65,6 +73,11 @@ size_t ResultNode::getRawByteSize() const
throw std::runtime_error("ResultNode::getRawByteSize() const must be overloaded by '" + vespalib::string(getClass().name()) + "'.");
}
+const BucketResultNode&
+ResultNode::getNullBucket() const {
+ throw std::runtime_error(vespalib::make_string("No null bucket defined for this type"));
+}
+
}
}
diff --git a/searchlib/src/vespa/searchlib/expression/resultnode.h b/searchlib/src/vespa/searchlib/expression/resultnode.h
index 6343e90dc6b..26849d27ed3 100644
--- a/searchlib/src/vespa/searchlib/expression/resultnode.h
+++ b/searchlib/src/vespa/searchlib/expression/resultnode.h
@@ -3,7 +3,6 @@
#include "expressionnode.h"
#include "serializer.h"
-#include <vespa/vespalib/util/exception.h>
#include <vespa/vespalib/util/buffer.h>
namespace search {
@@ -49,10 +48,7 @@ public:
private:
virtual int64_t onGetInteger(size_t index) const = 0;
- virtual int64_t onGetEnum(size_t index) const {
- (void) index;
- throw vespalib::Exception("search::expression::ResultNode onGetEnum is not implemented");
- }
+ virtual int64_t onGetEnum(size_t index) const;
virtual double onGetFloat(size_t index) const = 0;
virtual ConstBufferRef onGetString(size_t index, BufferRef buf) const = 0;
@@ -124,9 +120,8 @@ public:
virtual ResultDeserializer & onDeserializeResult(ResultDeserializer & is);
virtual size_t getRawByteSize() const;
virtual bool isMultiValue() const { return false; }
- virtual const BucketResultNode& getNullBucket() const { throw std::runtime_error(vespalib::make_string("No null bucket defined for this type")); }
+ virtual const BucketResultNode& getNullBucket() const;
};
}
}
-
diff --git a/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp b/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp
index 1a359b4056e..08a0017c3e2 100644
--- a/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp
+++ b/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp
@@ -3,6 +3,7 @@
#include "ftlib.h"
#include "dummy_dependency_handler.h"
#include <vespa/searchlib/features/utils.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <boost/tokenizer.hpp>
#include <vespa/log/log.h>
diff --git a/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp b/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp
index 1f59cfb52b8..02782565f80 100644
--- a/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp
+++ b/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp
@@ -4,6 +4,7 @@
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/searchlib/attribute/attributevector.hpp>
#include <vespa/searchlib/attribute/stringbase.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".fef.matchdatabuilder");
diff --git a/searchlib/src/vespa/searchlib/query/querynoderesultbase.h b/searchlib/src/vespa/searchlib/query/querynoderesultbase.h
index c0d47f0f11d..05f0c9033d5 100644
--- a/searchlib/src/vespa/searchlib/query/querynoderesultbase.h
+++ b/searchlib/src/vespa/searchlib/query/querynoderesultbase.h
@@ -2,6 +2,7 @@
#pragma once
#include <vespa/vespalib/objects/cloneable.h>
+#include <memory>
namespace search {
diff --git a/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h b/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h
index 4b376df2bdd..eb278280156 100644
--- a/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h
+++ b/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h
@@ -15,6 +15,7 @@
#include <vespa/searchlib/query/queryterm.h>
#include <vespa/searchcommon/attribute/attributecontent.h>
#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <algorithm>
#include <future>
#include <map>
diff --git a/slobrok/src/vespa/slobrok/server/rpc_server_manager.cpp b/slobrok/src/vespa/slobrok/server/rpc_server_manager.cpp
index 84ef6432f74..9d34d29fc0b 100644
--- a/slobrok/src/vespa/slobrok/server/rpc_server_manager.cpp
+++ b/slobrok/src/vespa/slobrok/server/rpc_server_manager.cpp
@@ -5,6 +5,7 @@
#include "rpc_server_map.h"
#include "remote_slobrok.h"
#include "sbenv.h"
+#include <vespa/vespalib/util/stringfmt.h>
#include <sstream>
#include <vespa/log/log.h>
diff --git a/staging_vespalib/src/vespa/vespalib/encoding/base64.cpp b/staging_vespalib/src/vespa/vespalib/encoding/base64.cpp
index 10bc2af51ce..54ac8363bf6 100644
--- a/staging_vespalib/src/vespa/vespalib/encoding/base64.cpp
+++ b/staging_vespalib/src/vespa/vespalib/encoding/base64.cpp
@@ -8,7 +8,8 @@
#include <vespa/vespalib/encoding/base64.h>
#include <vespa/vespalib/util/exceptions.h>
-#include <assert.h>
+#include <vespa/vespalib/util/stringfmt.h>
+#include <cassert>
namespace vespalib {
@@ -129,9 +130,8 @@ Base64::decode(const char* inBuffer, int inLen, char* outBuffer, int outLen)
continue; // Some illegal chars will be skipped.
} else if (curchar == -1) {
// Other illegal characters will generate failure
- throw vespalib::IllegalArgumentException(vespalib::make_string(
- "Illegal base64 character %u found.",
- (unsigned int) *thischar), VESPA_STRLOC);
+ throw IllegalArgumentException(make_string("Illegal base64 character %u found.",
+ (unsigned int) *thischar), VESPA_STRLOC);
} else {
// Four bytes from input (eqals three bytes in output)
@@ -162,4 +162,3 @@ Base64::decode(const char* inBuffer, int inLen, char* outBuffer, int outLen)
}
} // namespace vespalib
-
diff --git a/staging_vespalib/src/vespa/vespalib/net/http_server.cpp b/staging_vespalib/src/vespa/vespalib/net/http_server.cpp
index 32b9caab687..2c67a3c48c9 100644
--- a/staging_vespalib/src/vespa/vespalib/net/http_server.cpp
+++ b/staging_vespalib/src/vespa/vespalib/net/http_server.cpp
@@ -3,7 +3,7 @@
#include "http_server.h"
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/host_name.h>
-#include <algorithm>
+#include <vespa/vespalib/util/stringfmt.h>
namespace vespalib {
diff --git a/staging_vespalib/src/vespa/vespalib/objects/cloneable.h b/staging_vespalib/src/vespa/vespalib/objects/cloneable.h
index c0b12272797..ea9c8002d6e 100644
--- a/staging_vespalib/src/vespa/vespalib/objects/cloneable.h
+++ b/staging_vespalib/src/vespa/vespalib/objects/cloneable.h
@@ -5,8 +5,6 @@
* @brief Superclass for objects implementing clone() deep copy.
*/
-#include <memory>
-
namespace vespalib {
class Cloneable {
diff --git a/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp b/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp
index 7c581c89af0..576343245e4 100644
--- a/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/document_runnable.cpp
@@ -2,6 +2,7 @@
#include "document_runnable.h"
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
namespace document {
diff --git a/staging_vespalib/src/vespa/vespalib/util/jsonstream.cpp b/staging_vespalib/src/vespa/vespalib/util/jsonstream.cpp
index e8f242879d8..c7a7ac34ef3 100644
--- a/staging_vespalib/src/vespa/vespalib/util/jsonstream.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/jsonstream.cpp
@@ -4,6 +4,7 @@
#include "jsonexception.h"
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/stringfmt.h>
namespace vespalib {
@@ -18,7 +19,7 @@ JsonStream::getStateName(const State& s) {
throw IllegalStateException("Control should not reach this point", VESPA_STRLOC);
}
-JsonStream::JsonStream(vespalib::asciistream& as, bool createIndents)
+JsonStream::JsonStream(asciistream& as, bool createIndents)
: _writer(as)
{
if (createIndents) _writer.setPretty();
@@ -28,7 +29,7 @@ JsonStream::JsonStream(vespalib::asciistream& as, bool createIndents)
JsonStream::~JsonStream() {}
JsonStream&
-JsonStream::operator<<(vespalib::stringref value)
+JsonStream::operator<<(stringref value)
{
if (_state.empty()) {
fail("Stream already finalized. Can't add a string value.");
@@ -314,7 +315,7 @@ JsonStream::finalize()
string
JsonStream::getStateString() const
{
- vespalib::asciistream as;
+ asciistream as;
for (auto it(_state.begin()), mt(_state.end()); it != mt; it++) {
switch (it->state) {
case State::OBJECT_EXPECTING_KEY:
@@ -343,7 +344,7 @@ JsonStream::getStateString() const
return as.str();
}
-vespalib::string
+string
JsonStream::getJsonStreamState() const
{
asciistream report;
@@ -360,4 +361,4 @@ JsonStream::fail(stringref error) const
throw JsonStreamException(report.str(), "", VESPA_STRLOC);
}
-} // vespalib
+}
diff --git a/staging_vespalib/src/vespa/vespalib/util/librarypool.cpp b/staging_vespalib/src/vespa/vespalib/util/librarypool.cpp
index 8dd6995a6c1..d992b1b6db8 100644
--- a/staging_vespalib/src/vespa/vespalib/util/librarypool.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/librarypool.cpp
@@ -1,6 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
#include <vespa/vespalib/util/librarypool.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
namespace vespalib {
@@ -17,14 +19,14 @@ LibraryPool::~LibraryPool()
}
void
-LibraryPool::loadLibrary(const vespalib::stringref & libName)
+LibraryPool::loadLibrary(const stringref & libName)
{
LockGuard guard(_lock);
if (_libraries.find(libName) == _libraries.end()) {
DynamicLibrarySP lib(new FastOS_DynamicLibrary);
- vespalib::string file(libName);
+ string file(libName);
if (!lib->Open(file.c_str())) {
- vespalib::string error = lib->GetLastErrorString();
+ string error = lib->GetLastErrorString();
throw IllegalArgumentException(make_string("Failed loading dynamic library '%s' due to '%s'.",
file.c_str(), error.c_str()));
} else {
@@ -34,7 +36,7 @@ LibraryPool::loadLibrary(const vespalib::stringref & libName)
}
FastOS_DynamicLibrary *
-LibraryPool::get(const vespalib::stringref & name)
+LibraryPool::get(const stringref & name)
{
LockGuard guard(_lock);
LibraryMap::const_iterator found(_libraries.find(name));
@@ -44,7 +46,7 @@ LibraryPool::get(const vespalib::stringref & name)
}
const FastOS_DynamicLibrary *
-LibraryPool::get(const vespalib::stringref & name) const
+LibraryPool::get(const stringref & name) const
{
LockGuard guard(_lock);
LibraryMap::const_iterator found(_libraries.find(name));
diff --git a/staging_vespalib/src/vespa/vespalib/util/programoptions.cpp b/staging_vespalib/src/vespa/vespalib/util/programoptions.cpp
index 41ff561011b..6573390c712 100644
--- a/staging_vespalib/src/vespa/vespalib/util/programoptions.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/programoptions.cpp
@@ -1,7 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/util/programoptions.h>
-
-#include <iostream>
+#include "programoptions.h"
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/exceptions.h>
#include <boost/lexical_cast.hpp>
diff --git a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp
index 58a5489647d..043cddc3259 100644
--- a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp
+++ b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp
@@ -1,9 +1,9 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/util/xmlserializable.hpp>
+#include "xmlserializable.hpp"
#include <vespa/vespalib/encoding/base64.h>
#include <vespa/vespalib/stllike/asciistream.h>
-#include <vector>
+#include <vespa/vespalib/util/stringfmt.h>
#include <cassert>
namespace vespalib {
diff --git a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.hpp b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.hpp
index 7fcc964d8f1..0da684d6b28 100644
--- a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.hpp
+++ b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.hpp
@@ -3,8 +3,8 @@
#pragma once
#include "xmlserializable.h"
-#include <sstream>
#include <vespa/vespalib/util/exceptions.h>
+#include <sstream>
namespace vespalib {
namespace xml {
diff --git a/storage/src/tests/bucketdb/bucketmanagertest.cpp b/storage/src/tests/bucketdb/bucketmanagertest.cpp
index f9ae4f57fa5..227dd40b34d 100644
--- a/storage/src/tests/bucketdb/bucketmanagertest.cpp
+++ b/storage/src/tests/bucketdb/bucketmanagertest.cpp
@@ -16,6 +16,7 @@
#include <tests/common/testhelper.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/config/helper/configgetter.hpp>
#include <future>
diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
index e2f41aa5b3e..52b976586e8 100644
--- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
+++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp
@@ -11,6 +11,7 @@
#include <vespa/vdslib/container/mutabledocumentlist.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/io/fileutil.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/storageapi/message/bucket.h>
#include <vespa/storageapi/message/bucketsplitting.h>
#include <vespa/storageapi/message/multioperation.h>
diff --git a/storage/src/tests/persistence/splitbitdetectortest.cpp b/storage/src/tests/persistence/splitbitdetectortest.cpp
index 3251dd9a9a8..47efaaa371e 100644
--- a/storage/src/tests/persistence/splitbitdetectortest.cpp
+++ b/storage/src/tests/persistence/splitbitdetectortest.cpp
@@ -1,7 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vdstestlib/cppunit/macros.h>
-#include <fstream>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/storage/persistence/splitbitdetector.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/persistence/dummyimpl/dummypersistence.h>
diff --git a/storage/src/tests/storageserver/documentapiconvertertest.cpp b/storage/src/tests/storageserver/documentapiconvertertest.cpp
index 1f1198efc3c..b7d3554e506 100644
--- a/storage/src/tests/storageserver/documentapiconvertertest.cpp
+++ b/storage/src/tests/storageserver/documentapiconvertertest.cpp
@@ -3,6 +3,7 @@
#include <vespa/document/base/testdocrepo.h>
#include <cppunit/extensions/HelperMacros.h>
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/documentapi/documentapi.h>
#include <vespa/messagebus/emptyreply.h>
#include <vespa/storage/storageserver/documentapiconverter.h>
diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
index 0570d0a3e27..18fc5efb4b5 100644
--- a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
+++ b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
@@ -15,6 +15,7 @@
#include <vespa/storageapi/message/state.h>
#include <vespa/storageapi/message/bucketsplitting.h>
#include <vespa/storageapi/message/stat.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/config/config.h>
#include <unordered_map>
diff --git a/storage/src/vespa/storage/bucketmover/bucketmover.cpp b/storage/src/vespa/storage/bucketmover/bucketmover.cpp
index e4ddc3cb5a7..bda0a394802 100644
--- a/storage/src/vespa/storage/bucketmover/bucketmover.cpp
+++ b/storage/src/vespa/storage/bucketmover/bucketmover.cpp
@@ -6,6 +6,7 @@
#include <vespa/storage/common/bucketmessages.h>
#include <vespa/storage/common/nodestateupdater.h>
#include <vespa/storage/storageutil/log.h>
+#include <vespa/vespalib/util/stringfmt.h>
LOG_SETUP(".bucketmover");
diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
index 5b907d21fcd..54ef503a772 100644
--- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp
@@ -5,6 +5,7 @@
#include "putoperation.h"
#include "updateoperation.h"
#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/select/parser.h>
#include <vespa/storageapi/message/persistence.h>
#include <vespa/storageapi/message/batch.h>
diff --git a/storage/src/vespa/storage/distributor/operations/operation.cpp b/storage/src/vespa/storage/distributor/operations/operation.cpp
index 37e997d6080..8f6acc3258d 100644
--- a/storage/src/vespa/storage/distributor/operations/operation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/operation.cpp
@@ -5,6 +5,7 @@
#include <vespa/storageapi/messageapi/storagemessage.h>
#include <vespa/storageapi/messageapi/storagecommand.h>
#include <vespa/storageapi/messageapi/storagereply.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".distributor.callback");
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
index a3c8fc3d671..43d5de4a5a0 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
@@ -17,6 +17,7 @@
#include <vespa/storage/common/bucketoperationlogger.h>
#include <vespa/storage/bucketdb/lockablemap.hpp>
#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/vespalib/util/stringfmt.h>
LOG_SETUP(".persistence.filestor.manager");
diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.cpp b/storage/src/vespa/storage/storageserver/mergethrottler.cpp
index 577fedb58e1..ede7be3b9ad 100644
--- a/storage/src/vespa/storage/storageserver/mergethrottler.cpp
+++ b/storage/src/vespa/storage/storageserver/mergethrottler.cpp
@@ -2,9 +2,9 @@
#include "mergethrottler.h"
#include "storagemetricsset.h"
-#include <iostream>
#include <sstream>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/storage/common/nodestateupdater.h>
#include <vespa/storage/persistence/messages.h>
#include <vespa/log/log.h>
diff --git a/storage/src/vespa/storage/storageserver/messagesink.cpp b/storage/src/vespa/storage/storageserver/messagesink.cpp
index 0df24ef3536..4960cd2085e 100644
--- a/storage/src/vespa/storage/storageserver/messagesink.cpp
+++ b/storage/src/vespa/storage/storageserver/messagesink.cpp
@@ -2,6 +2,7 @@
#include "messagesink.h"
#include <vespa/storageapi/message/persistence.h>
+#include <ostream>
using std::shared_ptr;
diff --git a/storage/src/vespa/storage/tools/generatedistributionbits.cpp b/storage/src/vespa/storage/tools/generatedistributionbits.cpp
index 53c7c7cf1a1..3f5b3f4ae3d 100644
--- a/storage/src/vespa/storage/tools/generatedistributionbits.cpp
+++ b/storage/src/vespa/storage/tools/generatedistributionbits.cpp
@@ -1,9 +1,11 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
#include <vespa/document/bucket/bucketidfactory.h>
#include <vespa/vespalib/util/programoptions.h>
#include <vespa/vdslib/distribution/distribution.h>
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/storage/bucketdb/judyarray.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <iomanip>
#include <iostream>
#include <vespa/config-stor-distribution.h>
diff --git a/storage/src/vespa/storage/visiting/countvisitor.cpp b/storage/src/vespa/storage/visiting/countvisitor.cpp
index 282e2f32873..ca6678c1b3d 100644
--- a/storage/src/vespa/storage/visiting/countvisitor.cpp
+++ b/storage/src/vespa/storage/visiting/countvisitor.cpp
@@ -3,6 +3,7 @@
#include "countvisitor.h"
#include <vespa/document/fieldvalue/document.h>
#include <vespa/documentapi/messagebus/messages/visitor.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".visitor.instance.countvisitor");
diff --git a/storage/src/vespa/storage/visiting/visitor.cpp b/storage/src/vespa/storage/visiting/visitor.cpp
index 704b523a3b6..6940706e211 100644
--- a/storage/src/vespa/storage/visiting/visitor.cpp
+++ b/storage/src/vespa/storage/visiting/visitor.cpp
@@ -10,7 +10,9 @@
#include <vespa/document/select/node.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <unordered_map>
+
#include <vespa/log/log.h>
LOG_SETUP(".visitor.instance");
diff --git a/storage/src/vespa/storage/visiting/visitormanager.cpp b/storage/src/vespa/storage/visiting/visitormanager.cpp
index 7b8ce974ca9..0df82dad80f 100644
--- a/storage/src/vespa/storage/visiting/visitormanager.cpp
+++ b/storage/src/vespa/storage/visiting/visitormanager.cpp
@@ -8,10 +8,9 @@
#include "testvisitor.h"
#include "recoveryvisitor.h"
#include <vespa/storageframework/generic/memory/memorymanagerinterface.h>
-#include <vespa/storageapi/message/visitor.h>
#include <vespa/storage/common/statusmessages.h>
-#include <vespa/storage/storageserver/storagemetricsset.h>
#include <vespa/documentapi/loadtypes/loadtypeset.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".visitor.manager");
diff --git a/storageapi/src/vespa/storageapi/message/batch.cpp b/storageapi/src/vespa/storageapi/message/batch.cpp
index 405d5b4c9d2..ee7bbbcbdf6 100644
--- a/storageapi/src/vespa/storageapi/message/batch.cpp
+++ b/storageapi/src/vespa/storageapi/message/batch.cpp
@@ -2,7 +2,7 @@
//
#include "batch.h"
#include <vespa/document/bucket/bucketidfactory.h>
-#include <algorithm>
+#include <ostream>
using namespace storage::api;
diff --git a/storageapi/src/vespa/storageapi/message/bucket.cpp b/storageapi/src/vespa/storageapi/message/bucket.cpp
index 3400e0d6399..e4e6f796ac2 100644
--- a/storageapi/src/vespa/storageapi/message/bucket.cpp
+++ b/storageapi/src/vespa/storageapi/message/bucket.cpp
@@ -4,9 +4,10 @@
#include <vespa/document/fieldvalue/document.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/array.hpp>
+#include <ostream>
+#include <iterator>
-namespace storage {
-namespace api {
+namespace storage::api {
IMPLEMENT_COMMAND(CreateBucketCommand, CreateBucketReply)
IMPLEMENT_REPLY(CreateBucketReply)
@@ -625,7 +626,6 @@ SetBucketStateReply::print(std::ostream& out,
}
}
-} // api
-} // storage
+}
template class vespalib::Array<storage::api::RequestBucketInfoReply::Entry>;
diff --git a/storageapi/src/vespa/storageapi/message/persistence.cpp b/storageapi/src/vespa/storageapi/message/persistence.cpp
index 6de53d9db82..ce1adcfa2ca 100644
--- a/storageapi/src/vespa/storageapi/message/persistence.cpp
+++ b/storageapi/src/vespa/storageapi/message/persistence.cpp
@@ -3,6 +3,7 @@
#include "persistence.h"
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <ostream>
namespace storage {
namespace api {
diff --git a/streamingvisitors/src/tests/hitcollector/hitcollector.cpp b/streamingvisitors/src/tests/hitcollector/hitcollector.cpp
index dc10ea168c0..4e1ac516a7b 100644
--- a/streamingvisitors/src/tests/hitcollector/hitcollector.cpp
+++ b/streamingvisitors/src/tests/hitcollector/hitcollector.cpp
@@ -2,6 +2,7 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/searchlib/fef/matchdata.h>
#include <vespa/searchlib/fef/feature_resolver.h>
#include <vespa/searchvisitor/hitcollector.h>
diff --git a/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp b/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp
index 5ca14fd617d..074070d2ccd 100644
--- a/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/hitcollector.cpp
@@ -2,6 +2,7 @@
#include "hitcollector.h"
#include <vespa/searchlib/fef/feature_resolver.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".searchvisitor.hitcollector");
diff --git a/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp b/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp
index d25154aba7f..4befe163377 100644
--- a/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp
@@ -3,7 +3,7 @@
#include "rankmanager.h"
#include <vespa/searchlib/features/setup.h>
#include <vespa/searchlib/fef/functiontablefactory.h>
-#include <vespa/vespalib/util/vstringfmt.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/log/log.h>
LOG_SETUP(".searchvisitor.rankmanager");
@@ -106,7 +106,7 @@ RankManager::Snapshot::initRankSetup(const BlueprintFactory & factory)
LOG(debug, "Number of index environments and rank setups: %u", (uint32_t)_indexEnv.size());
LOG_ASSERT(_properties.size() == _rankSetup.size());
for (uint32_t i = 0; i < _properties.size(); ++i) {
- vespalib::string number = vespalib::make_vespa_string("%u", i);
+ vespalib::string number = vespalib::make_string("%u", i);
_rpmap[number] = i;
}
for (uint32_t i = 0; i < _properties.size(); ++i) {
diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
index 616da034c54..56c95e7fbc7 100644
--- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
@@ -4,6 +4,7 @@
#include "searchenvironment.h"
#include "searchvisitor.h"
#include <vespa/document/datatype/positiondatatype.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/searchlib/aggregation/modifiers.h>
#include <vespa/searchlib/common/packets.h>
#include <vespa/searchlib/uca/ucaconverter.h>
diff --git a/vdslib/src/tests/container/documentlisttest.cpp b/vdslib/src/tests/container/documentlisttest.cpp
index 5120c4efa05..02e2d0fd935 100644
--- a/vdslib/src/tests/container/documentlisttest.cpp
+++ b/vdslib/src/tests/container/documentlisttest.cpp
@@ -6,6 +6,7 @@
#include <vespa/document/update/documentupdate.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/random.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <cppunit/extensions/HelperMacros.h>
diff --git a/vdslib/src/vespa/vdslib/container/documentlist.cpp b/vdslib/src/vespa/vdslib/container/documentlist.cpp
index 2b105a77408..71bee5cf624 100644
--- a/vdslib/src/vespa/vdslib/container/documentlist.cpp
+++ b/vdslib/src/vespa/vdslib/container/documentlist.cpp
@@ -5,8 +5,9 @@
#include <vespa/document/util/stringutil.h>
#include <vespa/document/util/serializableexceptions.h>
#include <vespa/document/update/documentupdate.h>
-#include <vespa/log/log.h>
+#include <vespa/document/datatype/documenttype.h>
+#include <vespa/log/log.h>
LOG_SETUP(".vdslib.container.documentlist");
using document::ByteBuffer;
diff --git a/vdslib/src/vespa/vdslib/container/mutabledocumentlist.cpp b/vdslib/src/vespa/vdslib/container/mutabledocumentlist.cpp
index 1c80e3ba8ee..f265a6c947f 100644
--- a/vdslib/src/vespa/vdslib/container/mutabledocumentlist.cpp
+++ b/vdslib/src/vespa/vdslib/container/mutabledocumentlist.cpp
@@ -2,6 +2,7 @@
#include "mutabledocumentlist.h"
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/objects/nbostream.h>
using vespalib::nbostream;
diff --git a/vdslib/src/vespa/vdslib/container/operationlist.cpp b/vdslib/src/vespa/vdslib/container/operationlist.cpp
index 6af338a4c0e..8c4515f15ff 100644
--- a/vdslib/src/vespa/vdslib/container/operationlist.cpp
+++ b/vdslib/src/vespa/vdslib/container/operationlist.cpp
@@ -3,6 +3,7 @@
#include "operationlist.h"
#include "documentlist.h"
#include <vespa/document/update/documentupdate.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/objects/nbostream.h>
namespace vdslib {
@@ -22,8 +23,7 @@ int OperationList::getRequiredBufferSize() const {
switch(_operations[i].opt) {
case OperationList::Operation::REMOVE:
{
- document::Document doc(*document::DataType::DOCUMENT,
- _operations[i].docId);
+ document::Document doc(*document::DataType::DOCUMENT, _operations[i].docId);
doc.serializeHeader(stream);
break;
}
diff --git a/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp b/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp
index 64ff1377128..5e1c7c6b1b4 100644
--- a/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp
+++ b/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp
@@ -4,6 +4,7 @@
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <fstream>
#include <atomic>
diff --git a/vespaclient/src/vespa/vespaclient/spoolmaster/application.cpp b/vespaclient/src/vespa/vespaclient/spoolmaster/application.cpp
index fe0880d9ea1..e708e623592 100644
--- a/vespaclient/src/vespa/vespaclient/spoolmaster/application.cpp
+++ b/vespaclient/src/vespa/vespaclient/spoolmaster/application.cpp
@@ -1,10 +1,8 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/defaults.h>
-#include <vector>
-#include <string>
+#include <thread>
#include <iostream>
#include <algorithm>
-#include <cstdio>
#include <dirent.h>
#include <unistd.h>
@@ -189,7 +187,7 @@ Application::Main()
if (scanInbox() && findOutboxes()) {
moveLinks();
} else {
- FastOS_Thread::Sleep(200);
+ std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
}
}
diff --git a/vespaclient/src/vespa/vespaclient/vespadoclocator/locator.cpp b/vespaclient/src/vespa/vespaclient/vespadoclocator/locator.cpp
index 030f284c182..af805d461fc 100644
--- a/vespaclient/src/vespa/vespaclient/vespadoclocator/locator.cpp
+++ b/vespaclient/src/vespa/vespaclient/vespadoclocator/locator.cpp
@@ -6,8 +6,7 @@
#include <vespa/messagebus/iconfighandler.h>
#include <vespa/messagebus/routing/routingspec.h>
#include <vespa/vdslib/bucketdistribution.h>
-#include <vespa/messagebus/config-messagebus.h>
-#include <vespa/config/helper/configgetter.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/config/helper/configgetter.hpp>
diff --git a/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp b/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp
index e9482c1eddc..baf7c01d631 100644
--- a/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp
+++ b/vespaclient/src/vespa/vespaclient/vesparoute/application.cpp
@@ -12,7 +12,7 @@
#include <vespa/messagebus/rpcmessagebus.h>
#include <vespa/slobrok/sbmirror.h>
#include <vespa/config/helper/configgetter.hpp>
-
+#include <vespa/vespalib/util/stringfmt.h>
using config::ConfigGetter;
using document::DocumenttypesConfig;
diff --git a/vespalib/src/tests/atomic/atomic_bench.cpp b/vespalib/src/tests/atomic/atomic_bench.cpp
index 003ef25ba45..6294f956507 100644
--- a/vespalib/src/tests/atomic/atomic_bench.cpp
+++ b/vespalib/src/tests/atomic/atomic_bench.cpp
@@ -2,6 +2,7 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/atomic.h>
+#include <vespa/fastos/thread.h>
#include <vector>
#include <algorithm>
#include <sstream>
diff --git a/vespalib/src/tests/atomic/atomic_test.cpp b/vespalib/src/tests/atomic/atomic_test.cpp
index 1133d9b51bd..09fc99edeb9 100644
--- a/vespalib/src/tests/atomic/atomic_test.cpp
+++ b/vespalib/src/tests/atomic/atomic_test.cpp
@@ -1,12 +1,14 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("atomic_test");
+
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/atomic.h>
+#include <vespa/fastos/thread.h>
#include <vector>
#include <algorithm>
#include <sstream>
+#include <vespa/log/log.h>
+LOG_SETUP("atomic_test");
class Test : public vespalib::TestApp
{
diff --git a/vespalib/src/tests/benchmark_timer/benchmark_timer_test.cpp b/vespalib/src/tests/benchmark_timer/benchmark_timer_test.cpp
index b0cd577cc66..ac6a57358d6 100644
--- a/vespalib/src/tests/benchmark_timer/benchmark_timer_test.cpp
+++ b/vespalib/src/tests/benchmark_timer/benchmark_timer_test.cpp
@@ -8,7 +8,7 @@ TEST("require that the benchmark timer can be used as advertised") {
BenchmarkTimer timer(1.0);
while (timer.has_budget()) {
timer.before();
- FastOS_Thread::Sleep(5);
+ std::this_thread::sleep_for(std::chrono::milliseconds(5));
timer.after();
}
EXPECT_TRUE(timer.min_time() >= 0.0);
@@ -17,15 +17,15 @@ TEST("require that the benchmark timer can be used as advertised") {
TEST("require that the benchmark timer all-in-one benchmarking works") {
uint32_t sleep_time = 5;
- double t = BenchmarkTimer::benchmark([sleep_time](){FastOS_Thread::Sleep(sleep_time);}, 1.0);
+ double t = BenchmarkTimer::benchmark([sleep_time](){std::this_thread::sleep_for(std::chrono::milliseconds(sleep_time));}, 1.0);
fprintf(stderr, "5 ms sleep takes: %g ms\n", t * 1000.0);
}
TEST("require that the benchmark timer all-in-one benchmarking with baseline works") {
uint32_t work_time = 10;
uint32_t baseline_time = 5;
- double t = BenchmarkTimer::benchmark([&](){FastOS_Thread::Sleep(work_time);},
- [&](){FastOS_Thread::Sleep(baseline_time);}, 1.0);
+ double t = BenchmarkTimer::benchmark([&](){std::this_thread::sleep_for(std::chrono::milliseconds(work_time));},
+ [&](){std::this_thread::sleep_for(std::chrono::milliseconds(baseline_time));}, 1.0);
fprintf(stderr, "10 ms sleep - 5 ms sleep takes: %g ms\n", t * 1000.0);
}
@@ -33,8 +33,8 @@ TEST("require that the benchmark timer all-in-one benchmarking with baseline and
uint32_t work_time = 2;
uint32_t baseline_time = 1;
uint32_t loop_cnt = 0;
- double t = BenchmarkTimer::benchmark([&](){FastOS_Thread::Sleep(work_time); ++loop_cnt;},
- [&](){FastOS_Thread::Sleep(baseline_time);}, 7, 0.0);
+ double t = BenchmarkTimer::benchmark([&](){std::this_thread::sleep_for(std::chrono::milliseconds(work_time)); ++loop_cnt;},
+ [&](){std::this_thread::sleep_for(std::chrono::milliseconds(baseline_time));}, 7, 0.0);
EXPECT_EQUAL(loop_cnt, 7u);
fprintf(stderr, "2 ms sleep - 1 ms sleep takes: %g ms\n", t * 1000.0);
}
diff --git a/vespalib/src/tests/delegatelist/delegatelist.cpp b/vespalib/src/tests/delegatelist/delegatelist.cpp
index 11dd4d7d9e2..6a9751440a6 100644
--- a/vespalib/src/tests/delegatelist/delegatelist.cpp
+++ b/vespalib/src/tests/delegatelist/delegatelist.cpp
@@ -3,10 +3,7 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/delegatelist.hpp>
#include <vespa/vespalib/util/guard.h>
-
-#include <memory>
-#include <algorithm>
-#include <vector>
+#include <vespa/fastos/thread.h>
#include <queue>
#include <vespa/log/log.h>
diff --git a/vespalib/src/tests/exception_classes/exception_classes_test.cpp b/vespalib/src/tests/exception_classes/exception_classes_test.cpp
index 946c3fa32e4..a418cb421ed 100644
--- a/vespalib/src/tests/exception_classes/exception_classes_test.cpp
+++ b/vespalib/src/tests/exception_classes/exception_classes_test.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/stringfmt.h>
using namespace vespalib;
diff --git a/vespalib/src/tests/time/time_box_test.cpp b/vespalib/src/tests/time/time_box_test.cpp
index 478d749e15d..32cf1eb66b3 100644
--- a/vespalib/src/tests/time/time_box_test.cpp
+++ b/vespalib/src/tests/time/time_box_test.cpp
@@ -10,13 +10,13 @@ TEST("require that long-lived timebox returns falling time left numbers") {
double timeLeft = box.timeLeft();
EXPECT_TRUE(timeLeft <= last_timeLeft);
last_timeLeft = timeLeft;
- FastOS_Thread::Sleep(10);
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
TEST("require that short-lived timebox times out") {
vespalib::TimeBox box(0.125);
- FastOS_Thread::Sleep(150);
+ std::this_thread::sleep_for(std::chrono::milliseconds(150));
EXPECT_FALSE(box.hasTimeLeft());
EXPECT_EQUAL(box.timeLeft(), 0.0);
}
@@ -27,7 +27,7 @@ TEST("require that short-lived timebox always returns at least minimum time") {
double timeLeft = box.timeLeft();
EXPECT_TRUE(timeLeft <= 0.250);
EXPECT_TRUE(timeLeft >= 0.125);
- FastOS_Thread::Sleep(30);
+ std::this_thread::sleep_for(std::chrono::milliseconds(30));
}
EXPECT_FALSE(box.hasTimeLeft());
EXPECT_EQUAL(box.timeLeft(), 0.125);
diff --git a/vespalib/src/vespa/vespalib/io/fileutil.cpp b/vespalib/src/vespa/vespalib/io/fileutil.cpp
index c9778971efd..2e3994d329f 100644
--- a/vespalib/src/vespa/vespalib/io/fileutil.cpp
+++ b/vespalib/src/vespa/vespalib/io/fileutil.cpp
@@ -1,16 +1,12 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "fileutil.h"
-
-#include <errno.h>
-#include <ostream>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
#include <vespa/vespalib/util/exceptions.h>
-#include <vespa/vespalib/util/error.h>
#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/fastos/file.h>
+#include <ostream>
+#include <sys/stat.h>
#include <vespa/log/log.h>
LOG_SETUP(".vespalib.io.fileutil");
diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.cpp b/vespalib/src/vespa/vespalib/objects/nbostream.cpp
index ec04ffb8b3b..e37399bdfcc 100644
--- a/vespalib/src/vespa/vespalib/objects/nbostream.cpp
+++ b/vespalib/src/vespa/vespalib/objects/nbostream.cpp
@@ -2,7 +2,7 @@
#include "nbostream.hpp"
#include "hexdump.h"
#include <vespa/vespalib/util/exceptions.h>
-
+#include <vespa/vespalib/util/stringfmt.h>
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/util/buffer.h b/vespalib/src/vespa/vespalib/util/buffer.h
index 88fe6359aae..3a43a2c0dc4 100644
--- a/vespalib/src/vespa/vespalib/util/buffer.h
+++ b/vespalib/src/vespa/vespalib/util/buffer.h
@@ -1,7 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <sys/types.h>
+#include <cstddef>
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/util/exception.h b/vespalib/src/vespa/vespalib/util/exception.h
index 44911ea5555..05f48295bfa 100644
--- a/vespalib/src/vespa/vespalib/util/exception.h
+++ b/vespalib/src/vespa/vespalib/util/exception.h
@@ -5,7 +5,6 @@
#include <vespa/vespalib/util/macro.h>
#include <vespa/vespalib/util/error.h>
-#include <vespa/vespalib/util/stringfmt.h>
#include <exception>
#define VESPALIB_EXCEPTION_USEBACKTRACES
diff --git a/vespalib/src/vespa/vespalib/util/exceptions.h b/vespalib/src/vespa/vespalib/util/exceptions.h
index 65d17baf654..ca05dac107f 100644
--- a/vespalib/src/vespa/vespalib/util/exceptions.h
+++ b/vespalib/src/vespa/vespalib/util/exceptions.h
@@ -13,6 +13,7 @@
#pragma once
#include <vespa/vespalib/util/exception.h>
+#include <vespa/vespalib/util/stringfmt.h>
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/util/memory.h b/vespalib/src/vespa/vespalib/util/memory.h
index 2d940882320..85c8e46dcc2 100644
--- a/vespalib/src/vespa/vespalib/util/memory.h
+++ b/vespalib/src/vespa/vespalib/util/memory.h
@@ -4,8 +4,8 @@
#pragma once
#include <memory>
-#include <string.h>
-#include <stdlib.h>
+#include <cstring>
+#include <cstdlib>
/// Macro to give you number of elements in a defined array.
#define VESPA_NELEMS(a) (sizeof(a)/sizeof(a[0]))
diff --git a/vespalib/src/vespa/vespalib/util/sync.h b/vespalib/src/vespa/vespalib/util/sync.h
index a44763ec755..315bb79487e 100644
--- a/vespalib/src/vespa/vespalib/util/sync.h
+++ b/vespalib/src/vespa/vespalib/util/sync.h
@@ -34,7 +34,6 @@ public:
};
#endif
-
/**
* @brief A Lock is a synchronization primitive used to ensure mutual
* exclusion.
diff --git a/vespalog/src/test/threads/testthreads.cpp b/vespalog/src/test/threads/testthreads.cpp
index a708777f350..056f5aad2a2 100644
--- a/vespalog/src/test/threads/testthreads.cpp
+++ b/vespalog/src/test/threads/testthreads.cpp
@@ -1,12 +1,12 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/fastos/app.h>
#include <vespa/fastos/time.h>
+#include <vespa/fastos/thread.h>
#include <vespa/log/log.h>
#include <iostream>
using std::string;
-
LOG_SETUP(".threadtest");
class FileThread : public FastOS_Runnable
diff --git a/vsm/src/tests/docsum/docsum.cpp b/vsm/src/tests/docsum/docsum.cpp
index d854421ecb5..1b0fbf70623 100644
--- a/vsm/src/tests/docsum/docsum.cpp
+++ b/vsm/src/tests/docsum/docsum.cpp
@@ -1,8 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/testapp.h>
-
-#include <vector>
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/datatype/structdatatype.h>
#include <vespa/vsm/common/docsum.h>
#include <vespa/vsm/vsm/flattendocsumwriter.h>
#include <vespa/vsm/vsm/slimefieldwriter.h>
diff --git a/vsm/src/tests/document/document.cpp b/vsm/src/tests/document/document.cpp
index 35ca55826ba..629e2954953 100644
--- a/vsm/src/tests/document/document.cpp
+++ b/vsm/src/tests/document/document.cpp
@@ -2,10 +2,10 @@
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/document/fieldvalue/fieldvalues.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vsm/common/storagedocument.h>
#include <vespa/vespalib/stllike/asciistream.h>
-
using namespace document;
namespace vsm {
diff --git a/vsm/src/vespa/vsm/common/documenttypemapping.cpp b/vsm/src/vespa/vsm/common/documenttypemapping.cpp
index 96a7effae57..9a8bbb28f65 100644
--- a/vsm/src/vespa/vsm/common/documenttypemapping.cpp
+++ b/vsm/src/vespa/vsm/common/documenttypemapping.cpp
@@ -2,6 +2,7 @@
#include "documenttypemapping.h"
#include <vespa/document/repo/documenttyperepo.h>
+#include <vespa/document/datatype/documenttype.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/log/log.h>
diff --git a/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp b/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp
index 8e444102930..c713e0284ac 100644
--- a/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp
+++ b/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "utf8stringfieldsearcherbase.h"
+#include <cassert>
using search::QueryTerm;
using search::QueryTermList;
diff --git a/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp b/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp
index 23e64d0bf5e..b5d49f463ef 100644
--- a/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp
+++ b/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp
@@ -1,5 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "utf8substringsnippetmodifier.h"
+#include <cassert>
using search::byte;
using search::QueryTerm;