diff options
author | David Beck <david.beck@arm.com> | 2018-10-17 14:17:50 +0100 |
---|---|---|
committer | Matthew Bentham <matthew.bentham@arm.com> | 2018-10-22 16:57:54 +0100 |
commit | 3e9e11541c177abd7101962ef1e703d70d718c56 (patch) | |
tree | f2076ddb343d51450e41465826db2a4096d1f8b3 /src/backends/BackendRegistry.cpp | |
parent | 8e6f92d2d6b2bb94e6ba9b794c08e465039ea98b (diff) | |
download | armnn-3e9e11541c177abd7101962ef1e703d70d718c56.tar.gz |
IVGCVSW-2037 : separate registry for layer support intrefaces
* because their lifetime is different from backends
Change-Id: I9ba525e7e503b148cde1294933f3954b8bad3d68
Diffstat (limited to 'src/backends/BackendRegistry.cpp')
-rw-r--r-- | src/backends/BackendRegistry.cpp | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/src/backends/BackendRegistry.cpp b/src/backends/BackendRegistry.cpp index 1360168b9f..e9361210f2 100644 --- a/src/backends/BackendRegistry.cpp +++ b/src/backends/BackendRegistry.cpp @@ -4,54 +4,14 @@ // #include "BackendRegistry.hpp" -#include <armnn/Exceptions.hpp> namespace armnn { -BackendRegistry& BackendRegistry::Instance() +BackendRegistry& BackendRegistryInstance() { static BackendRegistry instance; return instance; } -void BackendRegistry::Register(const BackendId& id, FactoryFunction factory) -{ - if (m_BackendFactories.count(id) > 0) - { - throw InvalidArgumentException(std::string(id) + " already registered as backend", - CHECK_LOCATION()); - } - - m_BackendFactories[id] = factory; -} - -BackendRegistry::FactoryFunction BackendRegistry::GetFactory(const BackendId& id) const -{ - auto it = m_BackendFactories.find(id); - if (it == m_BackendFactories.end()) - { - throw InvalidArgumentException(std::string(id) + " has no backend factory registered", - CHECK_LOCATION()); - } - - return it->second; -} - -void BackendRegistry::Swap(BackendRegistry::FactoryStorage& other) -{ - BackendRegistry& instance = Instance(); - std::swap(instance.m_BackendFactories, other); -} - -BackendIdSet BackendRegistry::GetBackendIds() const -{ - BackendIdSet result; - for (const auto& it : m_BackendFactories) - { - result.insert(it.first); - } - return result; -} - } // namespace armnn |