summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-02-05 23:32:00 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-02-06 00:26:08 +0000
commit4c5a7cac411b30b9b4bd3ca067efcc9f3719b0ea (patch)
tree2e09c62b854357bbb1c8d433898d004e3f3995a5 /searchcommon
parentb84ef936b1cedce0b99f79e03b2fe25a8db5f7c3 (diff)
Reduce code visibility and include only what you need from config library.
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/vespa/searchcommon/config/subscriptionproxyng.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/searchcommon/src/vespa/searchcommon/config/subscriptionproxyng.h b/searchcommon/src/vespa/searchcommon/config/subscriptionproxyng.h
index 7683ca771b8..dd24480f689 100644
--- a/searchcommon/src/vespa/searchcommon/config/subscriptionproxyng.h
+++ b/searchcommon/src/vespa/searchcommon/config/subscriptionproxyng.h
@@ -1,8 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vespa/config/helper/legacysubscriber.h>
-#include <vespa/vespalib/stllike/string.h>
+#include <vespa/config/helper/legacysubscriber.hpp>
namespace search {
@@ -14,7 +13,7 @@ class SubscriptionProxyNg : public config::IFetcherCallback<CFG>
private:
ME &_target;
Method _method;
- config::LegacySubscriber *_subscriber;
+ std::unique_ptr<config::LegacySubscriber> _subscriber;
vespalib::string _cfgId;
SubscriptionProxyNg(const SubscriptionProxyNg&);
@@ -24,7 +23,7 @@ public:
SubscriptionProxyNg(ME &target, Method method)
: _target(target),
_method(method),
- _subscriber(NULL),
+ _subscriber(),
_cfgId("")
{
}
@@ -35,26 +34,25 @@ public:
return _cfgId.c_str();
}
void subscribe(const char *configId) {
- if (_subscriber != NULL) {
- if (configId != NULL && strcmp(configId, _subscriber->id().c_str()) == 0)
+ if (_subscriber) {
+ if (configId != nullptr && strcmp(configId, _subscriber->id().c_str()) == 0)
{
return; // same id; ignore
} else {
unsubscribe();
}
}
- if (configId != NULL && configId[0] != '\0') {
+ if (configId != nullptr && configId[0] != '\0') {
_cfgId = configId;
- _subscriber = new config::LegacySubscriber();
+ _subscriber = std::make_unique<config::LegacySubscriber>();
_subscriber->subscribe<CFG>(configId, this);
}
}
void unsubscribe() {
- delete _subscriber;
- _subscriber = NULL;
+ _subscriber.reset();
_cfgId = "";
}
- virtual void configure(std::unique_ptr<CFG> cfg) override {
+ void configure(std::unique_ptr<CFG> cfg) override {
(_target.*_method)(*cfg);
}
};