aboutsummaryrefslogtreecommitdiff
path: root/src/backends/backendsCommon/BackendRegistry.cpp
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-10-29 15:03:22 +0000
committerÁron Virginás-Tar <aron.virginas-tar@arm.com>2019-10-31 12:52:00 +0000
commitc601aa626dac78e1482a258e493a6c186e6bf514 (patch)
treedac6879d548571527fdd6dee9a7400f331583fdf /src/backends/backendsCommon/BackendRegistry.cpp
parentd90530719f6ab16417eb95d885317f50c662725f (diff)
downloadarmnn-c601aa626dac78e1482a258e493a6c186e6bf514.tar.gz
GitHub #292 Move BackendRegistry.hpp to the public API
* Moved to BackendRegistry.hpp include/armnn * Updated makefiles and sources accordingly Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com> Change-Id: I4d83abb581d523218a880c879fcf30c9611f7fd7
Diffstat (limited to 'src/backends/backendsCommon/BackendRegistry.cpp')
-rw-r--r--src/backends/backendsCommon/BackendRegistry.cpp86
1 files changed, 0 insertions, 86 deletions
diff --git a/src/backends/backendsCommon/BackendRegistry.cpp b/src/backends/backendsCommon/BackendRegistry.cpp
deleted file mode 100644
index 7078304599..0000000000
--- a/src/backends/backendsCommon/BackendRegistry.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "BackendRegistry.hpp"
-#include <armnn/Exceptions.hpp>
-
-namespace armnn
-{
-
-BackendRegistry& BackendRegistryInstance()
-{
- static BackendRegistry instance;
- return instance;
-}
-
-void BackendRegistry::Register(const BackendId& id, BackendRegistry::FactoryFunction factory)
-{
- if (m_Factories.find(id) != m_Factories.end())
- {
- throw InvalidArgumentException(
- std::string(id) + " already registered as IBackend factory",
- CHECK_LOCATION());
- }
-
- m_Factories[id] = factory;
-}
-
-bool BackendRegistry::IsBackendRegistered(const BackendId& id) const
-{
- return (m_Factories.find(id) != m_Factories.end());
-}
-
-BackendRegistry::FactoryFunction BackendRegistry::GetFactory(const BackendId& id) const
-{
- auto it = m_Factories.find(id);
- if (it == m_Factories.end())
- {
- throw InvalidArgumentException(
- std::string(id) + " has no IBackend factory registered",
- CHECK_LOCATION());
- }
-
- return it->second;
-}
-
-size_t BackendRegistry::Size() const
-{
- return m_Factories.size();
-}
-
-BackendIdSet BackendRegistry::GetBackendIds() const
-{
- BackendIdSet result;
- for (const auto& it : m_Factories)
- {
- result.insert(it.first);
- }
- return result;
-}
-
-std::string BackendRegistry::GetBackendIdsAsString() const
-{
- static const std::string delimitator = ", ";
-
- std::stringstream output;
- for (auto& backendId : GetBackendIds())
- {
- if (output.tellp() != std::streampos(0))
- {
- output << delimitator;
- }
- output << backendId;
- }
-
- return output.str();
-}
-
-void BackendRegistry::Swap(BackendRegistry& instance, BackendRegistry::FactoryStorage& other)
-{
- std::swap(instance.m_Factories, other);
-}
-
-
-} // namespace armnn