aboutsummaryrefslogtreecommitdiffstats
path: root/searchcorespi
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-08-10 23:35:50 +0200
committerHenning Baldersheim <balder@oath.com>2018-08-10 23:35:50 +0200
commit822e3e3d0630b3af1d76079da8c3e1d161c3ca1a (patch)
treeb6a4ff21d628a2e0214cabe6917d9dc0b0b620f2 /searchcorespi
parent4be58f582e0cb3313eedc0abedc86170ab41580c (diff)
Pass stringref by value
Diffstat (limited to 'searchcorespi')
-rw-r--r--searchcorespi/src/vespa/searchcorespi/plugin/factoryloader.cpp10
-rw-r--r--searchcorespi/src/vespa/searchcorespi/plugin/factoryloader.h2
-rw-r--r--searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.cpp16
-rw-r--r--searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.h8
4 files changed, 15 insertions, 21 deletions
diff --git a/searchcorespi/src/vespa/searchcorespi/plugin/factoryloader.cpp b/searchcorespi/src/vespa/searchcorespi/plugin/factoryloader.cpp
index 3180f7ed29d..ba2b0b962f6 100644
--- a/searchcorespi/src/vespa/searchcorespi/plugin/factoryloader.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/plugin/factoryloader.cpp
@@ -1,5 +1,5 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/searchcorespi/plugin/factoryloader.h>
+#include "factoryloader.h"
#include <vespa/vespalib/util/exceptions.h>
using vespalib::stringref;
@@ -13,18 +13,16 @@ FactoryLoader::FactoryLoader() :
{
}
-FactoryLoader::~FactoryLoader()
-{
-}
+FactoryLoader::~FactoryLoader() = default;
IIndexManagerFactory::UP
-FactoryLoader::create(const stringref & factory)
+FactoryLoader::create(stringref factory)
{
typedef IIndexManagerFactory* (*FuncT)();
_libraries.loadLibrary(factory);
const FastOS_DynamicLibrary & lib = *_libraries.get(factory);
FuncT registrationMethod = reinterpret_cast<FuncT>(lib.GetSymbol("createIndexManagerFactory"));
- if (registrationMethod == NULL) {
+ if (registrationMethod == nullptr) {
throw IllegalArgumentException(make_string("Failed locating symbol 'createIndexManagerFactory' in library '%s' for factory '%s'.",
lib.GetLibName(), vespalib::string(factory).c_str()));
}
diff --git a/searchcorespi/src/vespa/searchcorespi/plugin/factoryloader.h b/searchcorespi/src/vespa/searchcorespi/plugin/factoryloader.h
index e581b540dff..0e464156f73 100644
--- a/searchcorespi/src/vespa/searchcorespi/plugin/factoryloader.h
+++ b/searchcorespi/src/vespa/searchcorespi/plugin/factoryloader.h
@@ -17,7 +17,7 @@ public:
* @param the name of the library. Like 'vesparise'.
* @return the factory that is created.
*/
- IIndexManagerFactory::UP create(const vespalib::stringref & factory);
+ IIndexManagerFactory::UP create(vespalib::stringref factory);
private:
vespalib::LibraryPool _libraries;
};
diff --git a/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.cpp b/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.cpp
index 683b1e420b5..3e4a5c2bcfa 100644
--- a/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.cpp
@@ -9,15 +9,11 @@ using vespalib::string;
namespace searchcorespi {
-FactoryRegistry::FactoryRegistry()
-{
-}
+FactoryRegistry::FactoryRegistry() = default;
-FactoryRegistry::~FactoryRegistry()
-{
-}
+FactoryRegistry::~FactoryRegistry() = default;
-void FactoryRegistry::add(const stringref & uniqueName, const IIndexManagerFactory::SP & factory)
+void FactoryRegistry::add(stringref uniqueName, const IIndexManagerFactory::SP & factory)
{
LockGuard guard(_lock);
if (_registry.find(uniqueName) == _registry.end()) {
@@ -27,7 +23,7 @@ void FactoryRegistry::add(const stringref & uniqueName, const IIndexManagerFacto
}
}
-void FactoryRegistry::remove(const stringref & uniqueName)
+void FactoryRegistry::remove(stringref uniqueName)
{
LockGuard guard(_lock);
if (_registry.find(uniqueName) == _registry.end()) {
@@ -37,7 +33,7 @@ void FactoryRegistry::remove(const stringref & uniqueName)
}
const IIndexManagerFactory::SP &
-FactoryRegistry::get(const stringref & uniqueName) const
+FactoryRegistry::get(stringref uniqueName) const
{
LockGuard guard(_lock);
Registry::const_iterator found = _registry.find(uniqueName);
@@ -48,7 +44,7 @@ FactoryRegistry::get(const stringref & uniqueName) const
}
bool
-FactoryRegistry::isRegistered(const vespalib::stringref & uniqueName) const
+FactoryRegistry::isRegistered(vespalib::stringref uniqueName) const
{
LockGuard guard(_lock);
Registry::const_iterator found = _registry.find(uniqueName);
diff --git a/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.h b/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.h
index 64cc75721d8..ce9f4d1813d 100644
--- a/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.h
+++ b/searchcorespi/src/vespa/searchcorespi/plugin/factoryregistry.h
@@ -22,23 +22,23 @@ public:
* @param factory The factory instance for producing IndexManagers.
* @throws vespalib::IllegalArgument if factory is already registered.
*/
- void add(const vespalib::stringref & uniqueName, const IIndexManagerFactory::SP & factory);
+ void add(vespalib::stringref uniqueName, const IIndexManagerFactory::SP & factory);
/**
* Will unregister a factory. Should be called when a sharedlibrary is being unloaded.
* @param uniqueName Unique name of factory to remove from registry.
* @throws vespalib::IllegalArgument if factory is already registered.
*/
- void remove(const vespalib::stringref & uniqueName);
+ void remove(vespalib::stringref uniqueName);
/**
* This method will fetch a factory given its unique name.
* @param name The name of the factory to return.
* @return The factory.
*/
- const IIndexManagerFactory::SP & get(const vespalib::stringref & uniqueName) const;
+ const IIndexManagerFactory::SP & get(vespalib::stringref uniqueName) const;
/**
* Returns true if a factory with the given name has been registered.
*/
- bool isRegistered(const vespalib::stringref & uniqueName) const;
+ bool isRegistered(vespalib::stringref uniqueName) const;
private:
typedef std::map<vespalib::string, IIndexManagerFactory::SP> Registry;