From 4df58a007e58e558571bb5af2f1a9aaa4b92dd69 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 2 Jun 2017 00:15:30 +0200 Subject: Use forward declarations to reduce included footprint --- .../com/yahoo/config/codegen/CppClassBuilder.java | 41 +++++++++++++--------- 1 file changed, 24 insertions(+), 17 deletions(-) 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..ef14f997e8b 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,17 @@ public class CppClassBuilder implements ClassBuilder { + "#ifndef CLOUD_CONFIG_" + defineName + "_H\n" + "#define CLOUD_CONFIG_" + defineName + "_H\n" + "\n" - + "#include \n" - + "#include \n" + "#include \n" - + "#include \n" + "#include \n" + "#include \n" + "#include \n" + "\n"); + w.write("namespace config {\n"); + w.write(" class ConfigValue;\n"); + w.write(" class ConfigPayload;\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 +557,18 @@ public class CppClassBuilder implements ClassBuilder { w.write("#include <" + subdir + "/" + getFileName(root, "h") + ">"); } w.write("\n"); + w.write("#include \n"); + w.write("#include \n"); + w.write("#include \n"); w.write("#include \n"); w.write("#include \n"); w.write("#include \n"); w.write("#include \n"); w.write("#include \n"); w.write("#include \n"); - w.write("#include \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"); -- cgit v1.2.3 From 38e516c3dfe6df8281f4c2914d80296de5c35a87 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 2 Jun 2017 00:44:50 +0200 Subject: Also forward declare slime::Inspector. --- configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java | 3 +++ 1 file changed, 3 insertions(+) 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 ef14f997e8b..0e89288b6ad 100644 --- a/configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java +++ b/configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java @@ -244,6 +244,9 @@ public class CppClassBuilder implements ClassBuilder { 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("}\n\n"); writeNameSpaceBegin(w, namespaceList); w.write("\nnamespace internal {\n\n"); w.write("" -- cgit v1.2.3 From 058c307d819e3955a39e01658c57e8c75b9dc6bb Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 2 Jun 2017 00:50:32 +0200 Subject: Also forward declare slime::Cursor --- configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java | 1 + 1 file changed, 1 insertion(+) 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 0e89288b6ad..49f5275c7fe 100644 --- a/configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java +++ b/configgen/src/main/java/com/yahoo/config/codegen/CppClassBuilder.java @@ -246,6 +246,7 @@ public class CppClassBuilder implements ClassBuilder { 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("\nnamespace internal {\n\n"); -- cgit v1.2.3 From 280a8aca27af8cea3a532900809b251fa353cd52 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 2 Jun 2017 02:13:59 +0200 Subject: Include stringfmt where it was needed. --- config/src/vespa/config/common/configparser.cpp | 7 +++---- config/src/vespa/config/common/configparser.h | 6 +++--- config/src/vespa/config/common/exceptions.cpp | 1 + document/src/vespa/document/base/exceptions.cpp | 1 + document/src/vespa/document/base/field.cpp | 1 + document/src/vespa/document/base/globalid.cpp | 1 + document/src/vespa/document/base/idstring.cpp | 1 + document/src/vespa/document/bucket/bucketid.cpp | 1 + document/src/vespa/document/bucket/bucketselector.cpp | 1 + document/src/vespa/document/datatype/documenttype.cpp | 1 + .../src/vespa/document/datatype/primitivedatatype.cpp | 1 + document/src/vespa/document/datatype/structdatatype.cpp | 5 +++-- .../src/vespa/document/fieldvalue/arrayfieldvalue.cpp | 1 + documentapi/src/tests/policies/policies_test.cpp | 1 + .../src/vespa/documentapi/loadtypes/loadtypeset.cpp | 1 + .../messagebus/policies/documentrouteselectorpolicy.cpp | 1 + .../documentapi/messagebus/policies/externpolicy.cpp | 4 +--- .../documentapi/messagebus/policies/storagepolicy.cpp | 1 + eval/src/vespa/eval/tensor/dense/dense_tensor_builder.cpp | 1 + .../vespa/filedistribution/distributor/filedownloader.cpp | 1 + .../src/vespa/filedistribution/distributor/hostname.cpp | 3 ++- .../filedistribution/model/filedistributionmodelimpl.cpp | 1 + .../src/vespa/filedistribution/model/zkfacade.cpp | 10 +++++----- .../src/vespa/filedistribution/model/zkfiledbmodel.cpp | 1 + memfilepersistence/src/tests/device/devicemanagertest.cpp | 1 + .../vespa/memfilepersistence/spi/joinoperationhandler.cpp | 1 + messagebus/src/vespa/messagebus/testlib/slobrok.cpp | 1 + metrics/src/vespa/metrics/metric.cpp | 1 + metrics/src/vespa/metrics/metricmanager.cpp | 2 +- metrics/src/vespa/metrics/metricset.cpp | 2 +- metrics/src/vespa/metrics/printutils.cpp | 1 + metrics/src/vespa/metrics/summetric.hpp | 1 + metrics/src/vespa/metrics/valuemetric.hpp | 1 + metrics/src/vespa/metrics/valuemetricvalues.hpp | 1 + persistence/src/vespa/persistence/proxy/providerproxy.cpp | 3 +-- searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp | 1 + .../document_scan_iterator_test.cpp | 1 + .../proton/persistenceengine/transport_latch.cpp | 1 + .../src/vespa/searchcore/proton/server/matchview.cpp | 1 + .../tests/engine/transportserver/transportserver_test.cpp | 2 +- .../element_completeness/element_completeness_test.cpp | 1 + .../element_similarity_feature_test.cpp | 1 + .../tests/features/item_raw_score/item_raw_score_test.cpp | 1 + .../native_dot_product/native_dot_product_test.cpp | 1 + .../src/tests/features/prod_features_fieldtermmatch.cpp | 5 +++-- searchlib/src/tests/features/raw_score/raw_score_test.cpp | 1 + .../src/tests/features/subqueries/subqueries_test.cpp | 1 + .../text_similarity_feature_test.cpp | 1 + searchlib/src/vespa/searchlib/docstore/chunkformat.cpp | 1 + searchlib/src/vespa/searchlib/docstore/chunkformats.cpp | 1 + .../searchlib/expression/arrayatlookupfunctionnode.cpp | 2 +- searchlib/src/vespa/searchlib/expression/resultnode.cpp | 15 ++++++++++++++- searchlib/src/vespa/searchlib/expression/resultnode.h | 9 ++------- searchlib/src/vespa/searchlib/fef/test/ftlib.cpp | 1 + .../src/vespa/searchlib/fef/test/matchdatabuilder.cpp | 1 + .../src/vespa/searchlib/test/imported_attribute_fixture.h | 1 + slobrok/src/vespa/slobrok/server/rpc_server_manager.cpp | 1 + staging_vespalib/src/vespa/vespalib/encoding/base64.cpp | 9 ++++----- staging_vespalib/src/vespa/vespalib/net/http_server.cpp | 2 +- .../src/vespa/vespalib/util/document_runnable.cpp | 1 + staging_vespalib/src/vespa/vespalib/util/jsonstream.cpp | 11 ++++++----- staging_vespalib/src/vespa/vespalib/util/librarypool.cpp | 12 +++++++----- .../src/vespa/vespalib/util/programoptions.cpp | 5 ++--- .../src/vespa/vespalib/util/xmlserializable.cpp | 4 ++-- .../src/vespa/vespalib/util/xmlserializable.hpp | 2 +- storage/src/tests/bucketdb/bucketmanagertest.cpp | 1 + .../tests/persistence/filestorage/filestormanagertest.cpp | 1 + storage/src/tests/persistence/splitbitdetectortest.cpp | 2 +- storage/src/vespa/storage/bucketdb/bucketmanager.cpp | 1 + storage/src/vespa/storage/bucketmover/bucketmover.cpp | 1 + .../vespa/storage/distributor/operations/operation.cpp | 1 + .../storage/persistence/filestorage/filestormanager.cpp | 1 + .../src/vespa/storage/storageserver/mergethrottler.cpp | 2 +- .../src/vespa/storage/tools/generatedistributionbits.cpp | 2 ++ storage/src/vespa/storage/visiting/countvisitor.cpp | 1 + storage/src/vespa/storage/visiting/visitor.cpp | 2 ++ storage/src/vespa/storage/visiting/visitormanager.cpp | 3 +-- .../src/vespa/searchvisitor/hitcollector.cpp | 1 + streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp | 4 ++-- vdslib/src/tests/container/documentlisttest.cpp | 1 + vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp | 1 + .../src/vespa/vespaclient/vespadoclocator/locator.cpp | 3 +-- .../src/vespa/vespaclient/vesparoute/application.cpp | 2 +- .../tests/exception_classes/exception_classes_test.cpp | 1 + vespalib/src/vespa/vespalib/io/fileutil.cpp | 10 +++------- vespalib/src/vespa/vespalib/objects/nbostream.cpp | 2 +- vespalib/src/vespa/vespalib/util/exception.h | 1 - vespalib/src/vespa/vespalib/util/exceptions.h | 1 + 88 files changed, 135 insertions(+), 74 deletions(-) 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 -#include -#include -#include + +#include "configparser.h" #include "misc.h" +#include 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 +#include #include #include #include -#include -#include -#include +#include +#include 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 namespace config { 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 #include +#include 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 #include #include +#include #include 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 #include #include +#include #include #include 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 #include +#include 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 #include #include +#include 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 #include #include +#include namespace document { 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 #include #include +#include #include #include 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 #include +#include #include 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 #include #include #include +#include #include +#include + #include LOG_SETUP(".document.datatype.struct"); 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 +#include #include LOG_SETUP(".document.fieldvalue.array"); diff --git a/documentapi/src/tests/policies/policies_test.cpp b/documentapi/src/tests/policies/policies_test.cpp index 3527e62840b..43c2b6c6e24 100644 --- a/documentapi/src/tests/policies/policies_test.cpp +++ b/documentapi/src/tests/policies/policies_test.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include 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 #include +#include #include #include 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 #include #include +#include #include 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 #include #include -#include -#include -#include +#include #include #include 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 #include #include +#include #include #include #include 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 +#include #include using vespalib::IllegalArgumentException; 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 +#include #include #include 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 #include #include 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 #include #include 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 -#include -#include -#include - -#include #include #include #include #include +#include +#include +#include +#include +#include typedef std::unique_lock 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 +#include #include #include #include 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 #include #include +#include #include namespace storage { 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 +#include #include 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 #include #include +#include #include 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 #include #include +#include #include 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 #include - +#include #include #include #include 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 #include +#include #include #include - 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 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 +#include #include 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 +#include #include 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 +#include #include namespace metrics { 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 #include #include -#include +#include #include -#include #include #include LOG_SETUP(".providerproxy"); 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 #include #include +#include #include #include #include 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 #include #include +#include using namespace document; using namespace proton; 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 using storage::spi::Result; 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 #include +#include #include LOG_SETUP(".proton.server.matchview"); 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 #include #include - +#include #include #include #include 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 #include #include +#include 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 #include #include +#include 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 #include #include +#include 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 #include #include +#include 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 -LOG_SETUP(".prod_features_fieldtermmatch"); #include "prod_features.h" #include +#include +#include +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 #include #include +#include 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 #include #include +#include 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 #include #include +#include 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 +#include 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 #include +#include namespace search { 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 - +#include namespace search { namespace expression { 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 +#include +#include 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 #include 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 +#include #include #include 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 #include #include +#include #include LOG_SETUP(".fef.matchdatabuilder"); 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 #include #include +#include #include #include #include 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 #include #include 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 #include -#include +#include +#include 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 #include -#include +#include namespace vespalib { 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 +#include 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 #include +#include 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 #include +#include 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 - -#include +#include "programoptions.h" +#include #include #include 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 +#include "xmlserializable.hpp" #include #include -#include +#include #include 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 #include +#include 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 #include #include +#include #include #include 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 #include #include +#include #include #include #include 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 -#include +#include #include #include #include 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 #include #include +#include #include #include #include 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 #include #include +#include LOG_SETUP(".bucketmover"); 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 #include #include +#include #include 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 #include #include +#include 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 #include #include +#include #include #include #include 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 #include #include #include #include +#include #include #include #include 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 #include +#include #include 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 #include #include +#include #include + #include 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 -#include #include -#include #include +#include #include LOG_SETUP(".visitor.manager"); 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 +#include #include 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 #include -#include +#include #include 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/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 #include #include +#include #include #include 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 #include +#include #include #include 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 #include #include -#include -#include +#include #include 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 #include #include - +#include using config::ConfigGetter; using document::DocumenttypesConfig; 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 #include +#include using namespace vespalib; 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 -#include -#include -#include -#include #include -#include #include +#include #include +#include +#include #include 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 - +#include 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 #include -#include #include #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 +#include namespace vespalib { -- cgit v1.2.3 From 82afdb2210bc76dd2d52d939957fb17bd5025420 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 2 Jun 2017 02:41:03 +0200 Subject: Remove unused includes --- config/src/vespa/config/common/configcontext.h | 2 -- 1 file changed, 2 deletions(-) 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 -#include -#include namespace config { -- cgit v1.2.3 From f54e69173d5bea16c9ee898246bc894260035631 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 2 Jun 2017 08:50:56 +0200 Subject: Forward declare DocumentType. --- document/src/tests/structfieldvaluetest.cpp | 1 + document/src/vespa/document/fieldset/fieldsets.cpp | 1 + .../src/vespa/document/fieldvalue/document.cpp | 7 +++ document/src/vespa/document/fieldvalue/document.h | 6 +- .../src/vespa/document/repo/documenttyperepo.cpp | 67 +++++++++++++--------- .../src/vespa/document/repo/documenttyperepo.h | 6 +- document/src/vespa/document/update/fieldupdate.cpp | 1 + .../mapper/simplememfileiobuffer.cpp | 1 + .../src/tests/proton/common/cachedselect_test.cpp | 1 + .../tests/proton/server/documentretriever_test.cpp | 1 + .../searchcore/proton/server/documentretriever.cpp | 1 + .../proton/server/documentretrieverbase.cpp | 1 + .../document_store_visitor_test.cpp | 1 + .../docstore/logdatastore/logdatastore_test.cpp | 1 + .../searchlib/expression/documentfieldnode.cpp | 1 + .../src/tests/hitcollector/hitcollector.cpp | 1 + .../src/vespa/searchvisitor/searchvisitor.cpp | 1 + vsm/src/tests/document/document.cpp | 2 +- vsm/src/vespa/vsm/common/documenttypemapping.cpp | 1 + 19 files changed, 66 insertions(+), 36 deletions(-) diff --git a/document/src/tests/structfieldvaluetest.cpp b/document/src/tests/structfieldvaluetest.cpp index d6e585e0987..9940f2de5b3 100644 --- a/document/src/tests/structfieldvaluetest.cpp +++ b/document/src/tests/structfieldvaluetest.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 +#include #include #include #include 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 +#include namespace document { diff --git a/document/src/vespa/document/fieldvalue/document.cpp b/document/src/vespa/document/fieldvalue/document.cpp index f8358cfb544..8e8f6ab52d8 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 #include #include #include @@ -8,6 +9,7 @@ #include #include #include + #include using vespalib::nbostream; @@ -153,6 +155,11 @@ Document::swap(Document & rhs) std::swap(_lastModified, rhs._lastModified); } +const DocumentType& +Document::getType() const { + return static_cast(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 #include -#include 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(StructuredFieldValue::getType()); - } - + const DocumentType& getType() const; const DocumentId& getId() const { return _id; } DocumentId & getId() { return _id; } diff --git a/document/src/vespa/document/repo/documenttyperepo.cpp b/document/src/vespa/document/repo/documenttyperepo.cpp index 78d668a4886..b555e25c4cc 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 -#include #include #include #include @@ -11,11 +10,8 @@ #include #include #include -#include #include -#include #include -#include #include #include #include @@ -39,6 +35,20 @@ using vespalib::stringref; namespace document { +namespace internal { + +using DocumentTypeMapT = vespalib::hash_map; + +class DocumentTypeMap : public DocumentTypeMapT +{ +public: + using DocumentTypeMapT::DocumentTypeMapT; +}; + +} + +using DocumentTypeMap = internal::DocumentTypeMap; + namespace { template void DeleteContent(Container &c) { @@ -359,7 +369,6 @@ void addDataTypes(const vector &types, Repo &repo, } } -typedef hash_map DocumentTypeMap; void addDocumentTypes(const DocumentTypeMap &type_map, Repo &repo) { for (DocumentTypeMap::const_iterator it = type_map.begin(); it != type_map.end(); ++it) { @@ -515,49 +524,55 @@ void configureAllRepos(const DocumenttypesConfig::DocumenttypeVector &t, } // namespace -DocumentTypeRepo::DocumentTypeRepo() { - addDefaultDocument(_doc_types); +DocumentTypeRepo::DocumentTypeRepo() : + _doc_types(std::make_unique()) +{ + addDefaultDocument(*_doc_types); } -DocumentTypeRepo::DocumentTypeRepo(const DocumentType & type) { - addDefaultDocument(_doc_types); +DocumentTypeRepo::DocumentTypeRepo(const DocumentType & type) : + _doc_types(std::make_unique()) +{ + 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()) +{ + 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 +582,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 &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 -#include #include #include @@ -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 DocumentTypeMap; - - DocumentTypeMap _doc_types; + std::unique_ptr _doc_types; public: using DocumenttypesConfig = const internal::InternalDocumenttypesType; 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 #include +#include namespace document { diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp index 1f5344d466e..ccf63ed3504 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp @@ -2,6 +2,7 @@ #include "simplememfileiobuffer.h" #include +#include #include #include #include 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 #include #include +#include #include LOG_SETUP("cachedselect_test"); diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp index bd2fe12e894..093853addcc 100644 --- a/searchcore/src/tests/proton/server/documentretriever_test.cpp +++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include 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 +#include #include #include #include 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 +#include #include using document::DocumentId; 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 #include #include +#include #include #include #include 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 #include #include +#include #include #include #include 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 +#include #include #include 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 #include +#include #include #include #include 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 +#include #include #include #include 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 #include +#include #include #include - 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 +#include #include #include -- cgit v1.2.3 From 8e0c48091d4c944bec4a4c56ae49f25125262c82 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 2 Jun 2017 11:35:21 +0200 Subject: Forward declare ByteBuffer and FastOS_Thread --- config/src/tests/configholder/configholder.cpp | 2 +- config/src/tests/subscription/subscription.cpp | 4 ++-- document/src/tests/testxml.cpp | 2 +- .../src/vespa/document/annotation/spantree.cpp | 2 -- document/src/vespa/document/annotation/spantree.h | 1 + document/src/vespa/document/base/forcelink.cpp | 2 ++ .../datatype/annotationreferencedatatype.cpp | 1 + .../src/vespa/document/fieldvalue/fieldvalue.cpp | 17 ++++++++++++- .../src/vespa/document/fieldvalue/fieldvalue.h | 18 ++++---------- .../vespa/document/fieldvalue/structfieldvalue.cpp | 11 ++++++++- .../vespa/document/fieldvalue/structfieldvalue.h | 9 ++++--- .../vespa/document/fieldvalue/tensorfieldvalue.cpp | 2 +- .../src/vespa/document/repo/documenttyperepo.cpp | 2 -- document/src/vespa/document/select/branch.cpp | 1 + document/src/vespa/document/select/constant.cpp | 7 +++--- document/src/vespa/document/select/doctype.cpp | 7 +++--- document/src/vespa/document/select/operator.cpp | 7 +++--- document/src/vespa/document/select/valuenode.cpp | 1 + .../src/vespa/document/update/documentupdate.cpp | 28 +++++++++++++++++++--- .../src/vespa/document/update/documentupdate.h | 18 ++++---------- .../src/tests/messagebus/messagebus_test.cpp | 1 + documentapi/src/tests/messages/messages50test.cpp | 1 + documentapi/src/tests/messages/messages52test.cpp | 1 + documentapi/src/tests/policies/policies_test.cpp | 1 + fastos/src/tests/tests.h | 1 + fastos/src/vespa/fastos/app.h | 2 +- fastos/src/vespa/fastos/unix_process.h | 2 +- fnet/src/tests/sync_execute/sync_execute.cpp | 1 + persistence/src/tests/proxy/providerproxy_test.cpp | 1 + persistence/src/tests/proxy/providerstub_test.cpp | 1 + .../src/tests/proton/common/selectpruner_test.cpp | 1 + .../document_iterator/document_iterator_test.cpp | 1 + .../tests/proton/documentdb/documentdb_test.cpp | 7 +++--- .../proton/feedoperation/feedoperation_test.cpp | 1 + .../documentdb_job_trackers_test.cpp | 7 +++--- .../persistenceengine/persistenceengine_test.cpp | 1 + .../tests/proton/server/documentretriever_test.cpp | 4 ---- .../proton/attribute/attribute_writer.cpp | 1 + .../searchcore/proton/common/selectpruner.cpp | 4 +--- .../vespa/searchcore/proton/server/feedhandler.cpp | 4 +--- .../src/vespa/searchcore/proton/server/proton.cpp | 1 + .../searchcore/proton/server/storeonlyfeedview.cpp | 18 +++++++------- .../vespa/searchlib/query/querynoderesultbase.h | 1 + .../src/vespa/vespalib/objects/cloneable.h | 2 -- .../storageserver/documentapiconvertertest.cpp | 1 + .../external/twophaseupdateoperation.cpp | 1 + vdslib/src/vespa/vdslib/container/documentlist.cpp | 3 ++- .../vespa/vdslib/container/mutabledocumentlist.cpp | 1 + .../src/vespa/vdslib/container/operationlist.cpp | 4 ++-- .../vespa/vespaclient/spoolmaster/application.cpp | 6 ++--- vespalib/src/tests/atomic/atomic_bench.cpp | 1 + vespalib/src/tests/atomic/atomic_test.cpp | 6 +++-- .../tests/benchmark_timer/benchmark_timer_test.cpp | 12 +++++----- vespalib/src/tests/delegatelist/delegatelist.cpp | 5 +--- vespalib/src/tests/time/time_box_test.cpp | 6 ++--- vespalog/src/test/threads/testthreads.cpp | 2 +- vsm/src/tests/docsum/docsum.cpp | 3 +-- 57 files changed, 144 insertions(+), 114 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/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 #include @@ -8,6 +7,7 @@ #include #include #include +#include #include #include #include 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 #include 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 #include +#include namespace document { class SpanNode; 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 #include +#include + 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 #include +#include using std::unique_ptr; using std::ostream; 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 #include #include #include @@ -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 #include #include -#include #include #include @@ -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 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/structfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp index 079b730c8cc..d3cbcb77ba2 100644 --- a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include @@ -53,6 +52,16 @@ StructFieldValue::swap(StructFieldValue & rhs) std::swap(_version, _version); } +const StructDataType & +StructFieldValue::getStructType() const { + return static_cast(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..d57c8b965f7 100644 --- a/document/src/vespa/document/fieldvalue/structfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/structfieldvalue.h @@ -12,16 +12,17 @@ #include "structuredfieldvalue.h" #include "serializablearray.h" #include -#include #include namespace document { + class Document; class DocumentType; class DocumentTypeRepo; class FieldValueWriter; class FixedTypeRepo; class FieldSet; +class StructDataType; class StructFieldValue : public StructuredFieldValue { @@ -73,7 +74,7 @@ public: const DocumentTypeRepo * getRepo() const { return _repo; } void setDocumentType(const DocumentType & docType) { _doc_type = & docType; } - const StructDataType & getStructType() const { return static_cast(getType()); } + const StructDataType & getStructType() const; void lazyDeserialize(const FixedTypeRepo &repo, uint16_t version, @@ -99,8 +100,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 +146,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 #include +#include 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 b555e25c4cc..93adce76efd 100644 --- a/document/src/vespa/document/repo/documenttyperepo.cpp +++ b/document/src/vespa/document/repo/documenttyperepo.cpp @@ -14,8 +14,6 @@ #include #include #include -#include -#include #include LOG_SETUP(".documenttyperepo"); diff --git a/document/src/vespa/document/select/branch.cpp b/document/src/vespa/document/select/branch.cpp index ddbad69b14d..85e42dd74b5 100644 --- a/document/src/vespa/document/select/branch.cpp +++ b/document/src/vespa/document/select/branch.cpp @@ -2,6 +2,7 @@ #include "branch.h" #include "visitor.h" +#include namespace document { namespace select { diff --git a/document/src/vespa/document/select/constant.cpp b/document/src/vespa/document/select/constant.cpp index 686ab05055c..a48492685f3 100644 --- a/document/src/vespa/document/select/constant.cpp +++ b/document/src/vespa/document/select/constant.cpp @@ -2,9 +2,9 @@ #include "constant.h" #include "visitor.h" +#include -namespace document { -namespace select { +namespace document::select { Constant::Constant(const vespalib::stringref & value) : Node(value), @@ -54,5 +54,4 @@ Constant::print(std::ostream& out, bool, if (_parentheses) out << ')'; } -} // select -} // document +} 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 #include +#include -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/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 #include #include +#include -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/valuenode.cpp b/document/src/vespa/document/select/valuenode.cpp index ebf0a466ad9..49eab9d75ff 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 #include +#include #include #include #include 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 @@ -7,6 +8,7 @@ #include #include #include +#include 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 (*_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 typeAndId( - deserializeTypeAndId(repo, buffer)); + std::pair 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 #include -#include #include #include @@ -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 (*_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/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 #include +#include #include #include #include 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 #include #include +#include #include #include 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 #include +#include using document::DocumentTypeRepo; diff --git a/documentapi/src/tests/policies/policies_test.cpp b/documentapi/src/tests/policies/policies_test.cpp index 43c2b6c6e24..5d92b495c48 100644 --- a/documentapi/src/tests/policies/policies_test.cpp +++ b/documentapi/src/tests/policies/policies_test.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include 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 #include +#include 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 class FastOS_ProcessInterface; +class FastOS_ThreadPool; -#include #include /** 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 #include -class FastOS_ThreadPool; +class FastOS_BoolCond; class FastOS_UNIX_RealProcess; #include 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 #include #include +#include struct DoIt : public FNET_IExecutable { vespalib::Gate gate; 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 #include #include +#include #include #include #include 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 #include #include +#include #include #include #include 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 #include #include +#include #include #include #include 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 #include +#include #include #include #include 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 -#include -#include -#include -#include #include #include #include @@ -26,6 +22,9 @@ #include #include #include +#include +#include +#include #include #include 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 #include #include +#include #include 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 -LOG_SETUP("documentdb_job_trackers_test"); #include #include #include #include +#include +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 +#include #include #include #include diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp index 093853addcc..b0541f9ac71 100644 --- a/searchcore/src/tests/proton/server/documentretriever_test.cpp +++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp @@ -30,11 +30,7 @@ #include #include #include -#include -#include -#include #include -#include 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 #include #include +#include #include 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 -#include +#include #include #include -#include #include #include #include #include -#include #include using document::select::And; 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 #include #include -#include -#include -#include #include #include #include #include #include #include +#include #include LOG_SETUP(".proton.server.feedhandler"); 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 #include #include +#include #include #include #include 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 -#include -#include -#include -#include -#include -#include -#include -#include #include "forcecommitcontext.h" #include "operationdonecontext.h" #include "removedonecontext.h" #include "updatedonecontext.h" #include "putdonecontext.h" -#include +#include +#include +#include +#include #include +#include #include +#include +#include + #include LOG_SETUP(".proton.server.storeonlyfeedview"); 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 +#include namespace search { 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 - namespace vespalib { class Cloneable { 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 #include #include +#include #include #include #include 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 +#include #include #include #include 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 #include #include -#include +#include +#include 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 +#include #include 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 +#include #include 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/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 -#include -#include +#include #include #include -#include #include #include @@ -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/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 #include +#include #include #include #include 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 -LOG_SETUP("atomic_test"); + #include #include +#include #include #include #include +#include +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 #include #include - -#include -#include -#include +#include #include #include 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/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 #include +#include #include #include 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 - -#include #include +#include #include #include #include -- cgit v1.2.3 From 02a2201dbce24db2586d94f37a6093192a0da691 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 2 Jun 2017 13:15:05 +0200 Subject: checkpoint for slimmer SerializableArray --- .../document/fieldvalue/serializablearray.cpp | 36 +++++++++++++-- .../vespa/document/fieldvalue/serializablearray.h | 52 +++++++++++----------- vespalib/src/vespa/vespalib/util/buffer.h | 2 +- vespalib/src/vespa/vespalib/util/memory.h | 4 +- vespalib/src/vespa/vespalib/util/sync.h | 1 - 5 files changed, 60 insertions(+), 35 deletions(-) diff --git a/document/src/vespa/document/fieldvalue/serializablearray.cpp b/document/src/vespa/document/fieldvalue/serializablearray.cpp index 7a174f1ab52..77204490dc0 100644 --- a/document/src/vespa/document/fieldvalue/serializablearray.cpp +++ b/document/src/vespa/document/fieldvalue/serializablearray.cpp @@ -1,16 +1,27 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "serializablearray.h" #include +#include #include #include LOG_SETUP(".document.serializable-array"); - using std::vector; namespace document { +namespace serializablearray { + +using BufferMapT = vespalib::hash_map; + +class BufferMap : public BufferMapT { +public: + using BufferMapT::BufferMapT; +}; + +} + SerializableArray::Statistics SerializableArray::_stats; SerializableArray::SerializableArray() @@ -19,6 +30,13 @@ SerializableArray::SerializableArray() { } +serializablearray::BufferMap & ensure(std::unique_ptr & owned) { + if (!owned) { + owned = std::make_unique(); + } + return *owned; +} + SerializableArray::SerializableArray(const SerializableArray& other) : Cloneable(), _entries(other._entries), @@ -34,7 +52,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 +97,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 +167,7 @@ SerializableArray::clear(int id) EntryMap::iterator it = find(id); if (it != _entries.end()) { _entries.erase(it); - _owned.erase(id); + _owned->erase(id); invalidate(); } } @@ -215,4 +233,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 #include -#include -#include -#include #include -#include #include -#include +#include +#include -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 HashMap; - public: static Statistics& getStatistics() { return _stats; } - typedef vespalib::CloneablePtr CP; - typedef std::unique_ptr UP; + using CP = vespalib::CloneablePtr; + using UP = std::unique_ptr; + using ByteBufferUP = std::unique_ptr; 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 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(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 _owned; + std::unique_ptr _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/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 +#include 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 -#include -#include +#include +#include /// 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. -- cgit v1.2.3 From fdfc2ee5b03c00caa4c655a4ba3dab5554ba354a Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Sat, 3 Jun 2017 08:39:54 +0200 Subject: Hide the implementation details. --- document/src/tests/arrayfieldvaluetest.cpp | 1 + document/src/tests/documentcalculatortestcase.cpp | 63 ++++++++++------------ document/src/tests/documenttestcase.cpp | 1 + document/src/tests/primitivefieldvaluetest.cpp | 1 + document/src/tests/structfieldvaluetest.cpp | 1 + document/src/tests/weightedsetfieldvaluetest.cpp | 1 + .../src/vespa/document/base/documentcalculator.cpp | 5 +- .../src/vespa/document/base/documentcalculator.h | 8 +-- .../src/vespa/document/fieldvalue/document.cpp | 2 +- .../document/fieldvalue/serializablearray.cpp | 2 + .../vespa/document/fieldvalue/structfieldvalue.cpp | 21 ++++++++ .../vespa/document/fieldvalue/structfieldvalue.h | 21 ++------ document/src/vespa/document/select/branch.cpp | 1 + document/src/vespa/document/select/constant.cpp | 4 +- document/src/vespa/document/select/context.cpp | 26 +++++++-- document/src/vespa/document/select/context.h | 36 +++++++------ .../src/vespa/document/select/invalidconstant.cpp | 10 ++-- document/src/vespa/document/select/value.cpp | 1 - document/src/vespa/document/select/valuenode.cpp | 15 +++--- document/src/vespa/document/select/valuenode.h | 22 ++------ document/src/vespa/document/select/variablemap.h | 15 ++++++ .../serialization/vespadocumentdeserializer.cpp | 1 + .../serialization/vespadocumentserializer.cpp | 2 + .../document/update/assignfieldpathupdate.cpp | 10 ++-- .../src/vespa/document/update/clearvalueupdate.cpp | 6 +-- .../messagebus/policies/messagetypepolicy.cpp | 20 +++++-- .../messagebus/policies/messagetypepolicy.h | 13 +++-- .../src/vespa/memfilepersistence/common/types.cpp | 22 ++++++-- .../src/vespa/memfilepersistence/common/types.h | 16 +----- .../mapper/simplememfileiobuffer.cpp | 2 +- .../persistence/dummyimpl/dummypersistence.cpp | 1 + persistence/src/vespa/persistence/spi/docentry.cpp | 1 + .../proton/feedoperation/moveoperation.cpp | 2 +- .../proton/persistenceengine/document_iterator.cpp | 1 + .../vespa/searchcore/proton/test/bucketdocuments.h | 1 + .../src/vespa/searchlib/docstore/documentstore.cpp | 2 + .../src/vespa/searchlib/docstore/visitcache.cpp | 7 ++- .../src/vespa/searchlib/docstore/visitcache.h | 6 +-- .../vespa/storage/storageserver/messagesink.cpp | 1 + storageapi/src/vespa/storageapi/message/batch.cpp | 2 +- storageapi/src/vespa/storageapi/message/bucket.cpp | 8 +-- .../src/vespa/storageapi/message/persistence.cpp | 1 + .../vsm/searcher/utf8stringfieldsearcherbase.cpp | 1 + .../vsm/searcher/utf8substringsnippetmodifier.cpp | 1 + 44 files changed, 218 insertions(+), 166 deletions(-) create mode 100644 document/src/vespa/document/select/variablemap.h 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 #include #include +#include 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 #include #include +#include #include namespace document { @@ -52,46 +53,42 @@ CPPUNIT_TEST_SUITE_REGISTRATION(DocumentCalculatorTest); void DocumentCalculatorTest::testConstant() { - DocumentCalculator::VariableMap variables; + auto variables = std::make_unique(); 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(); 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(); + (*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(); + (*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(); + (*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(); 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(); 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(); 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(); 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(); 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..c844f2cf5a2 100644 --- a/document/src/tests/documenttestcase.cpp +++ b/document/src/tests/documenttestcase.cpp @@ -11,6 +11,7 @@ #include #include #include +#include using vespalib::nbostream; 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 #include #include +#include using vespalib::nbostream; diff --git a/document/src/tests/structfieldvaluetest.cpp b/document/src/tests/structfieldvaluetest.cpp index 9940f2de5b3..1b2fa17a79a 100644 --- a/document/src/tests/structfieldvaluetest.cpp +++ b/document/src/tests/structfieldvaluetest.cpp @@ -6,6 +6,7 @@ #include #include #include +#include using vespalib::nbostream; using document::config_builder::Struct; 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 #include #include +#include using vespalib::nbostream; 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 #include #include +#include #include 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 variables) { select::Compare& compare(static_cast(*_selectionNode)); const select::ValueNode& left = compare.getLeft(); select::Context context(doc); - context._variables = std::move(variables); + context.setVariableMap(std::move(variables)); std::unique_ptr value = left.getValue(context); select::NumberValue* num = dynamic_cast(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 -#include namespace document { + +namespace select { class VariableMap; } + class DocumentTypeRepo; class DocumentCalculator { public: - using VariableMap = vespalib::hash_map; - DocumentCalculator(const DocumentTypeRepo& repo, const vespalib::string& expression); ~DocumentCalculator(); - double evaluate(const Document& doc, VariableMap && variables); + double evaluate(const Document& doc, std::unique_ptr variables); private: std::unique_ptr _selectionNode; diff --git a/document/src/vespa/document/fieldvalue/document.cpp b/document/src/vespa/document/fieldvalue/document.cpp index 8e8f6ab52d8..29f487df989 100644 --- a/document/src/vespa/document/fieldvalue/document.cpp +++ b/document/src/vespa/document/fieldvalue/document.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include @@ -17,7 +18,6 @@ using vespalib::make_string; using vespalib::IllegalArgumentException; using vespalib::IllegalStateException; - namespace document { namespace { diff --git a/document/src/vespa/document/fieldvalue/serializablearray.cpp b/document/src/vespa/document/fieldvalue/serializablearray.cpp index 77204490dc0..f5aa25d4d0c 100644 --- a/document/src/vespa/document/fieldvalue/serializablearray.cpp +++ b/document/src/vespa/document/fieldvalue/serializablearray.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include LOG_SETUP(".document.serializable-array"); diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp index d3cbcb77ba2..74805ce3f10 100644 --- a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include LOG_SETUP(".document.structfieldvalue"); @@ -41,6 +42,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) { diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.h b/document/src/vespa/document/fieldvalue/structfieldvalue.h index d57c8b965f7..01a0e732e43 100644 --- a/document/src/vespa/document/fieldvalue/structfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/structfieldvalue.h @@ -11,8 +11,6 @@ #include "structuredfieldvalue.h" #include "serializablearray.h" -#include -#include namespace document { @@ -33,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; @@ -79,7 +66,7 @@ public: void lazyDeserialize(const FixedTypeRepo &repo, uint16_t version, SerializableArray::EntryMap && fields, - ByteBuffer::UP buffer, + std::unique_ptr buffer, CompressionConfig::Type comp_type, int32_t uncompressed_length); diff --git a/document/src/vespa/document/select/branch.cpp b/document/src/vespa/document/select/branch.cpp index 85e42dd74b5..ea0d0ef5646 100644 --- a/document/src/vespa/document/select/branch.cpp +++ b/document/src/vespa/document/select/branch.cpp @@ -3,6 +3,7 @@ #include "branch.h" #include "visitor.h" #include +#include namespace document { namespace select { diff --git a/document/src/vespa/document/select/constant.cpp b/document/src/vespa/document/select/constant.cpp index a48492685f3..0e2fdc2ecec 100644 --- a/document/src/vespa/document/select/constant.cpp +++ b/document/src/vespa/document/select/constant.cpp @@ -3,6 +3,7 @@ #include "constant.h" #include "visitor.h" #include +#include namespace document::select { @@ -46,8 +47,7 @@ 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; 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 -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 +Context::getValue(const vespalib::string & value) const { + VariableMap::const_iterator iter = _variables->find(value); + + if (iter != _variables->end()) { + return std::make_unique(iter->second); + } else { + return std::make_unique(0.0); + } +} + +void +Context::setVariableMap(std::unique_ptr 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 -#include +#include -namespace document{ +namespace document { class Document; class DocumentId; @@ -12,24 +12,26 @@ class DocumentUpdate; namespace select { -class Context -{ -public: - typedef vespalib::hash_map 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 map); + std::unique_ptr getValue(const vespalib::string & value) const; + const Document *_doc; + const DocumentId *_docId; + const DocumentUpdate *_docUpdate; +private: + std::unique_ptr _variables; +}; +} +} 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 -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/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 namespace document { namespace select { diff --git a/document/src/vespa/document/select/valuenode.cpp b/document/src/vespa/document/select/valuenode.cpp index 49eab9d75ff..96bc46bd54e 100644 --- a/document/src/vespa/document/select/valuenode.cpp +++ b/document/src/vespa/document/select/valuenode.cpp @@ -36,6 +36,13 @@ namespace { } } +std::unique_ptr +ValueNode::defaultTrace(std::unique_ptr val, std::ostream& out) const +{ + out << "Returning value " << *val << ".\n"; + return std::move(val); +} + InvalidValueNode::InvalidValueNode(const vespalib::stringref & name) : _name(name) { } @@ -147,13 +154,7 @@ CurrentTimeValueNode::print(std::ostream& out, bool verbose, std::unique_ptr VariableValueNode::getValue(const Context& context) const { - VariableMap::const_iterator iter = context._variables.find(_value); - - if (iter != context._variables.end()) { - return std::unique_ptr(new FloatValue(iter->second)); - } else { - return std::unique_ptr(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 UP; - typedef Context::VariableMap VariableMap; + using UP = std::unique_ptr; 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 getValue(const Context& context) const = 0; virtual std::unique_ptr - 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 defaultTrace(std::unique_ptr val, - std::ostream& out) const - { - out << "Returning value " << *val << ".\n"; - return std::move(val); - } + std::unique_ptr defaultTrace(std::unique_ptr 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 +#include + +namespace document::select { + +using VariableMapT = vespalib::hash_map; + +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 #include #include +#include #include 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 #include #include +#include #include +#include 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 -#include #include +#include #include -#include #include #include #include @@ -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 varHolder = std::make_unique(); + 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(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 -#include #include #include +#include using vespalib::IllegalArgumentException; using vespalib::IllegalStateException; -namespace document -{ +namespace document { IMPLEMENT_IDENTIFIABLE(ClearValueUpdate, ValueUpdate); 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 +#include +#include #include using vespa::config::content::MessagetyperouteselectorpolicyConfig; namespace documentapi { +namespace policy { + +using MessageTypeMapT = vespalib::hash_map; + +class MessageTypeMap : public MessageTypeMapT { +public: + using MessageTypeMapT::MessageTypeMapT; +}; + +} + MessageTypePolicy::MessageTypePolicy(const config::ConfigUri & configUri) : mbus::IRoutingPolicy(), config::IFetcherCallback(), @@ -23,7 +37,7 @@ MessageTypePolicy::~MessageTypePolicy() {} void MessageTypePolicy::configure(std::unique_ptr cfg) { - std::unique_ptr map(new MessageTypeMap); + auto map = std::make_unique(); 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 map = _map.get(); - MessageTypeMap::const_iterator found = map->find(messageType); + std::shared_ptr 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 -#include #include -#include -#include -#include #include #include #include #include #include +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 { private: - typedef vespalib::hash_map MessageTypeMap; - typedef vespalib::PtrHolder MessageTypeHolder; + typedef vespalib::PtrHolder MessageTypeHolder; typedef vespalib::PtrHolder RouteHolder; MessageTypeHolder _map; 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 #include +#include +#include -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 ccf63ed3504..6bda3d69113 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp @@ -5,8 +5,8 @@ #include #include #include +#include #include - LOG_SETUP(".memfile.simpleiobuffer"); namespace storage::memfile { 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 #include #include +#include #include #include 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 #include +#include namespace storage { namespace spi { 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 #include +#include 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 #include #include +#include #include LOG_SETUP(".proton.persistenceengine.document_iterator"); 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 namespace proton { 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 +#include +#include 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 #include +#include +#include -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 #include +#include #include #include +#include -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/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 +#include using std::shared_ptr; 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 -#include +#include 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 #include #include +#include +#include -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; 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 #include +#include namespace storage { namespace api { 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 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 using search::byte; using search::QueryTerm; -- cgit v1.2.3 From 31c553b610dbb43634f8b0f2efbc438ed04faaed Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 6 Jun 2017 09:10:06 +0200 Subject: Only remove if it can potentially exist. --- document/src/vespa/document/fieldvalue/serializablearray.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/document/src/vespa/document/fieldvalue/serializablearray.cpp b/document/src/vespa/document/fieldvalue/serializablearray.cpp index f5aa25d4d0c..c8beea5e79c 100644 --- a/document/src/vespa/document/fieldvalue/serializablearray.cpp +++ b/document/src/vespa/document/fieldvalue/serializablearray.cpp @@ -169,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(); } } -- cgit v1.2.3 From 1bfdfd1f10c32b8f6e70d49f6d08e89d416c9a61 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 6 Jun 2017 09:11:08 +0200 Subject: Reduced memory footprint of SerializableArray from 120 to 64 bytes --- document/src/tests/documenttestcase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp index c844f2cf5a2..3bbd5178055 100644 --- a/document/src/tests/documenttestcase.cpp +++ b/document/src/tests/documenttestcase.cpp @@ -76,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() -- cgit v1.2.3