aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-09-23 07:16:31 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-09-23 07:16:31 +0000
commitaec20e0986d71c1a8cd4a7a7153bf81b304a233f (patch)
treeaf01498e5b3eeb4645112bdfabe29d0062076f46
parentdd30a9a839f4b7f5c99e265af091c3f88613f4cd (diff)
Reduce include and visibility of ptrholder.h
-rw-r--r--searchlib/src/vespa/searchcommon/common/schema.cpp13
-rw-r--r--searchlib/src/vespa/searchcommon/common/schema.h13
-rw-r--r--searchlib/src/vespa/searchlib/docstore/filechunk.h1
-rw-r--r--slobrok/src/vespa/slobrok/cfg.h3
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/getoperation.cpp9
-rw-r--r--storage/src/vespa/storage/distributor/operations/external/getoperation.h2
-rw-r--r--vdslib/src/vespa/vdslib/state/nodestate.h2
-rw-r--r--vespalib/src/vespa/vespalib/util/ptrholder.h5
8 files changed, 24 insertions, 24 deletions
diff --git a/searchlib/src/vespa/searchcommon/common/schema.cpp b/searchlib/src/vespa/searchcommon/common/schema.cpp
index 0cc9d3cb2d8..1f2f924a4cd 100644
--- a/searchlib/src/vespa/searchcommon/common/schema.cpp
+++ b/searchlib/src/vespa/searchcommon/common/schema.cpp
@@ -6,6 +6,7 @@
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/stllike/hashtable.hpp>
#include <vespa/fastos/file.h>
+#include <limits>
#include <vespa/log/log.h>
LOG_SETUP(".index.schema");
@@ -48,7 +49,7 @@ writeFieldSets(vespalib::asciistream &os,
struct FieldName {
vespalib::string name;
- FieldName(const config::StringVector & lines)
+ explicit FieldName(const config::StringVector & lines)
: name(ConfigParser::parse<vespalib::string>("name", lines))
{
}
@@ -184,9 +185,9 @@ Schema::FieldSet::FieldSet(const config::StringVector & lines) :
_name(ConfigParser::parse<vespalib::string>("name", lines)),
_fields()
{
- std::vector<FieldName> fn = ConfigParser::parseArray<std::vector<FieldName>>("field", lines);
- for (size_t i = 0; i < fn.size(); ++i) {
- _fields.push_back(fn[i].name);
+ auto fn = ConfigParser::parseArray<std::vector<FieldName>>("field", lines);
+ for (const auto & fname : fn) {
+ _fields.push_back(fname.name);
}
}
@@ -224,8 +225,8 @@ Schema::Schema() = default;
Schema::Schema(const Schema & rhs) = default;
Schema & Schema::operator=(const Schema & rhs) = default;
-Schema::Schema(Schema && rhs) = default;
-Schema & Schema::operator=(Schema && rhs) = default;
+Schema::Schema(Schema && rhs) noexcept = default;
+Schema & Schema::operator=(Schema && rhs) noexcept = default;
Schema::~Schema() = default;
bool
diff --git a/searchlib/src/vespa/searchcommon/common/schema.h b/searchlib/src/vespa/searchcommon/common/schema.h
index 42291e04634..2e9edaa702e 100644
--- a/searchlib/src/vespa/searchcommon/common/schema.h
+++ b/searchlib/src/vespa/searchcommon/common/schema.h
@@ -5,7 +5,6 @@
#include "datatype.h"
#include <vespa/config/common/types.h>
#include <vespa/vespalib/stllike/hash_map.h>
-#include <vespa/vespalib/util/ptrholder.h>
namespace vespalib { class asciistream; }
namespace search::index {
@@ -90,7 +89,7 @@ public:
/**
* Create this index field based on the given config lines.
**/
- IndexField(const config::StringVector &lines);
+ explicit IndexField(const config::StringVector &lines);
IndexField &setAvgElemLen(uint32_t avgElemLen) { _avgElemLen = avgElemLen; return *this; }
IndexField &set_interleaved_features(bool value) {
@@ -121,7 +120,7 @@ public:
std::vector<vespalib::string> _fields;
public:
- FieldSet(vespalib::stringref n) : _name(n), _fields() {}
+ explicit FieldSet(vespalib::stringref n) : _name(n), _fields() {}
FieldSet(const FieldSet &);
FieldSet & operator =(const FieldSet &);
FieldSet(FieldSet &&) noexcept = default;
@@ -130,12 +129,12 @@ public:
/**
* Create this field collection based on the given config lines.
**/
- FieldSet(const config::StringVector & lines);
+ explicit FieldSet(const config::StringVector & lines);
~FieldSet();
FieldSet &addField(vespalib::stringref fieldName) {
- _fields.push_back(fieldName);
+ _fields.emplace_back(fieldName);
return *this;
}
@@ -170,8 +169,8 @@ public:
Schema();
Schema(const Schema & rhs);
Schema & operator=(const Schema & rhs);
- Schema(Schema && rhs);
- Schema & operator=(Schema && rhs);
+ Schema(Schema && rhs) noexcept;
+ Schema & operator=(Schema && rhs) noexcept;
~Schema();
/**
diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.h b/searchlib/src/vespa/searchlib/docstore/filechunk.h
index 2a2cbb45c53..af5690e8569 100644
--- a/searchlib/src/vespa/searchlib/docstore/filechunk.h
+++ b/searchlib/src/vespa/searchlib/docstore/filechunk.h
@@ -12,7 +12,6 @@
#include <vespa/vespalib/util/cpu_usage.h>
#include <vespa/vespalib/util/generationhandler.h>
#include <vespa/vespalib/util/memoryusage.h>
-#include <vespa/vespalib/util/ptrholder.h>
#include <vespa/vespalib/util/time.h>
class FastOS_FileInterface;
diff --git a/slobrok/src/vespa/slobrok/cfg.h b/slobrok/src/vespa/slobrok/cfg.h
index bd7bffe1d15..9514081ca38 100644
--- a/slobrok/src/vespa/slobrok/cfg.h
+++ b/slobrok/src/vespa/slobrok/cfg.h
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/vespalib/util/ptrholder.h>
#include <vespa/config-slobroks.h>
#include <vespa/config/subscription/configuri.h>
#include <vespa/config/subscription/confighandle.h>
@@ -14,7 +13,7 @@ namespace slobrok {
class Configurable {
public:
virtual void setup(const std::vector<std::string> &slobrokSpecs) = 0;
- virtual ~Configurable() { }
+ virtual ~Configurable() = default;
};
diff --git a/storage/src/vespa/storage/distributor/operations/external/getoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/getoperation.cpp
index 06872cadde6..df7bfe52904 100644
--- a/storage/src/vespa/storage/distributor/operations/external/getoperation.cpp
+++ b/storage/src/vespa/storage/distributor/operations/external/getoperation.cpp
@@ -6,6 +6,7 @@
#include <vespa/vdslib/state/nodestate.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/storage/distributor/distributor_bucket_space.h>
+#include <vespa/document/bucket/bucketidfactory.h>
#include <cassert>
#include <vespa/log/log.h>
@@ -47,7 +48,7 @@ GetOperation::GroupId::operator==(const GroupId& other) const
GetOperation::GetOperation(const DistributorNodeContext& node_ctx,
const DistributorBucketSpace &bucketSpace,
- std::shared_ptr<BucketDatabase::ReadGuard> read_guard,
+ const std::shared_ptr<BucketDatabase::ReadGuard> & read_guard,
std::shared_ptr<api::GetCommand> msg,
PersistenceOperationMetricSet& metric,
api::InternalReadConsistency desired_read_consistency)
@@ -135,7 +136,7 @@ GetOperation::onStart(DistributorStripeMessageSender& sender)
LOG(debug, "No useful bucket copies for get on document %s. Returning without document", _msg->getDocumentId().toString().c_str());
sendReply(sender);
}
-};
+}
void
GetOperation::onReceive(DistributorStripeMessageSender& sender, const std::shared_ptr<api::StorageReply>& msg)
@@ -251,9 +252,7 @@ GetOperation::assignTargetNodeGroups(const BucketDatabase::ReadGuard& read_guard
auto entries = read_guard.find_parents_and_self(bid);
- for (uint32_t j = 0; j < entries.size(); ++j) {
- const BucketDatabase::Entry& e = entries[j];
-
+ for (const auto & e : entries) {
LOG(spam, "Entry for %s: %s", e.getBucketId().toString().c_str(),
e->toString().c_str());
diff --git a/storage/src/vespa/storage/distributor/operations/external/getoperation.h b/storage/src/vespa/storage/distributor/operations/external/getoperation.h
index 943a92f4b36..61443100695 100644
--- a/storage/src/vespa/storage/distributor/operations/external/getoperation.h
+++ b/storage/src/vespa/storage/distributor/operations/external/getoperation.h
@@ -28,7 +28,7 @@ class GetOperation : public Operation
public:
GetOperation(const DistributorNodeContext& node_ctx,
const DistributorBucketSpace &bucketSpace,
- std::shared_ptr<BucketDatabase::ReadGuard> read_guard,
+ const std::shared_ptr<BucketDatabase::ReadGuard> & read_guard,
std::shared_ptr<api::GetCommand> msg,
PersistenceOperationMetricSet& metric,
api::InternalReadConsistency desired_read_consistency = api::InternalReadConsistency::Strong);
diff --git a/vdslib/src/vespa/vdslib/state/nodestate.h b/vdslib/src/vespa/vdslib/state/nodestate.h
index f65a0275d4b..913d4d93be8 100644
--- a/vdslib/src/vespa/vdslib/state/nodestate.h
+++ b/vdslib/src/vespa/vdslib/state/nodestate.h
@@ -11,7 +11,7 @@
#pragma once
#include "state.h"
-#include <vespa/document/bucket/bucketidfactory.h>
+#include <vespa/document/util/printable.h>
#include <vespa/vespalib/objects/floatingpointtype.h>
#include <memory>
diff --git a/vespalib/src/vespa/vespalib/util/ptrholder.h b/vespalib/src/vespa/vespalib/util/ptrholder.h
index de2c4b6941e..eed0a4d2052 100644
--- a/vespalib/src/vespa/vespalib/util/ptrholder.h
+++ b/vespalib/src/vespa/vespalib/util/ptrholder.h
@@ -46,7 +46,7 @@ public:
* std::shared_ptr instances are used internally to track shared
* resources
**/
- virtual ~PtrHolder() {}
+ virtual ~PtrHolder();
/**
* @brief Check if the current value is set (not 0)
@@ -124,4 +124,7 @@ public:
}
};
+template<typename T>
+PtrHolder<T>::~PtrHolder() = default;
+
} // namespace vespalib