aboutsummaryrefslogtreecommitdiff
path: root/src/backends/BackendRegistry.hpp
diff options
context:
space:
mode:
authorDavid Beck <david.beck@arm.com>2018-10-17 14:17:50 +0100
committerMatthew Bentham <matthew.bentham@arm.com>2018-10-22 16:57:54 +0100
commit3e9e11541c177abd7101962ef1e703d70d718c56 (patch)
treef2076ddb343d51450e41465826db2a4096d1f8b3 /src/backends/BackendRegistry.hpp
parent8e6f92d2d6b2bb94e6ba9b794c08e465039ea98b (diff)
downloadarmnn-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.hpp')
-rw-r--r--src/backends/BackendRegistry.hpp44
1 files changed, 7 insertions, 37 deletions
diff --git a/src/backends/BackendRegistry.hpp b/src/backends/BackendRegistry.hpp
index e2c526d293..23cb37da99 100644
--- a/src/backends/BackendRegistry.hpp
+++ b/src/backends/BackendRegistry.hpp
@@ -5,49 +5,19 @@
#pragma once
#include <armnn/Types.hpp>
-#include <functional>
-#include <memory>
-#include <unordered_map>
+#include "RegistryCommon.hpp"
namespace armnn
{
-class IBackend;
+using BackendRegistry = RegistryCommon<IBackend, IBackendUniquePtr>;
-class BackendRegistry
-{
-public:
- using FactoryFunction = std::function<IBackendUniquePtr()>;
-
- static BackendRegistry& Instance();
-
- void Register(const BackendId& id, FactoryFunction factory);
- FactoryFunction GetFactory(const BackendId& id) const;
-
- struct Helper
- {
- Helper(const BackendId& id, FactoryFunction factory)
- {
- BackendRegistry::Instance().Register(id, factory);
- }
- };
-
- size_t Size() const { return m_BackendFactories.size(); }
- BackendIdSet GetBackendIds() const;
+BackendRegistry& BackendRegistryInstance();
-protected:
- using FactoryStorage = std::unordered_map<BackendId, FactoryFunction>;
-
- // For testing only
- static void Swap(FactoryStorage& other);
- BackendRegistry() {}
- ~BackendRegistry() {}
-
-private:
- BackendRegistry(const BackendRegistry&) = delete;
- BackendRegistry& operator=(const BackendRegistry&) = delete;
-
- FactoryStorage m_BackendFactories;
+template <>
+struct RegisteredTypeName<IBackend>
+{
+ static const char * Name() { return "IBackend"; }
};
} // namespace armnn