From d4dfa684941a21314b70593d01b0fc2167eebad4 Mon Sep 17 00:00:00 2001 From: David Beck Date: Wed, 24 Oct 2018 17:09:46 +0100 Subject: IVGCVSW-2056 + IVGCVSW-2064 : move ClContextControl to the ClBackend Change-Id: Ice19d3f763298bc14585267df389e99df846320d --- src/backends/RegistryCommon.hpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/backends/RegistryCommon.hpp') diff --git a/src/backends/RegistryCommon.hpp b/src/backends/RegistryCommon.hpp index 616a63bd53..044a9e4250 100644 --- a/src/backends/RegistryCommon.hpp +++ b/src/backends/RegistryCommon.hpp @@ -21,11 +21,11 @@ struct RegisteredTypeName static const char * Name() { return "UNKNOWN"; } }; -template +template class RegistryCommon { public: - using FactoryFunction = std::function; + using FactoryFunction = std::function; void Register(const BackendId& id, FactoryFunction factory) { @@ -52,6 +52,20 @@ public: return it->second; } + FactoryFunction GetFactory(const BackendId& id, + FactoryFunction defaultFactory) const + { + auto it = m_Factories.find(id); + if (it == m_Factories.end()) + { + return defaultFactory; + } + else + { + return it->second; + } + } + size_t Size() const { return m_Factories.size(); @@ -116,4 +130,4 @@ struct StaticRegistryInitializer } }; -} // namespace armnn +} // namespace armnn \ No newline at end of file -- cgit v1.2.1