aboutsummaryrefslogtreecommitdiff
path: root/src/backends/RegistryCommon.hpp
diff options
context:
space:
mode:
authorDavid Beck <david.beck@arm.com>2018-10-24 17:09:46 +0100
committerDavid Beck <david.beck@arm.com>2018-10-26 10:25:09 +0100
commitd4dfa684941a21314b70593d01b0fc2167eebad4 (patch)
treeeaf561f9bdf5f5643702a5a6f24ed822dea9c4c2 /src/backends/RegistryCommon.hpp
parent0a088a61d016bf7af77e2d73d0988223a5f98ef1 (diff)
downloadarmnn-d4dfa684941a21314b70593d01b0fc2167eebad4.tar.gz
IVGCVSW-2056 + IVGCVSW-2064 : move ClContextControl to the ClBackend
Change-Id: Ice19d3f763298bc14585267df389e99df846320d
Diffstat (limited to 'src/backends/RegistryCommon.hpp')
-rw-r--r--src/backends/RegistryCommon.hpp20
1 files changed, 17 insertions, 3 deletions
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 <typename RegisteredType, typename PointerType>
+template <typename RegisteredType, typename PointerType, typename ParamType>
class RegistryCommon
{
public:
- using FactoryFunction = std::function<PointerType()>;
+ using FactoryFunction = std::function<PointerType(const ParamType&)>;
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