IVGCVSW-6989 "Merged experimental/armnn_shim_sl"

* Updated Serializer CMakeLists.txt to build armnnSerializerObj
* Added constant tensors as input support to SL

Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: I22f6cf50147d99a01f7fe70d7446b114a4c57af3
diff --git a/shim/sl/canonical/CacheDataHandler.cpp b/shim/sl/canonical/CacheDataHandler.cpp
new file mode 100644
index 0000000..930a8e4
--- /dev/null
+++ b/shim/sl/canonical/CacheDataHandler.cpp
@@ -0,0 +1,69 @@
+//
+// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "CacheDataHandler.hpp"
+
+#include <log/log.h>
+
+namespace armnn_driver
+{
+
+CacheDataHandler& CacheDataHandlerInstance()
+{
+    static CacheDataHandler instance;
+    return instance;
+}
+
+void CacheDataHandler::Register(const android::nn::CacheToken token, const size_t hashValue, const size_t cacheSize)
+{
+    if (!m_CacheDataMap.empty()
+            && m_CacheDataMap.find(hashValue) != m_CacheDataMap.end()
+            && m_CacheDataMap.at(hashValue).GetToken() == token
+            && m_CacheDataMap.at(hashValue).GetCacheSize() == cacheSize)
+    {
+        return;
+    }
+    CacheHandle cacheHandle(token, cacheSize);
+    m_CacheDataMap.insert({hashValue, cacheHandle});
+}
+
+bool CacheDataHandler::Validate(const android::nn::CacheToken token,
+                                const size_t hashValue,
+                                const size_t cacheSize) const
+{
+    return (!m_CacheDataMap.empty()
+            && m_CacheDataMap.find(hashValue) != m_CacheDataMap.end()
+            && m_CacheDataMap.at(hashValue).GetToken() == token
+            && m_CacheDataMap.at(hashValue).GetCacheSize() == cacheSize);
+}
+
+size_t CacheDataHandler::Hash(std::vector<uint8_t>& cacheData)
+{
+    std::size_t hash = cacheData.size();
+    for (auto& i : cacheData)
+    {
+        hash = ((hash << 5) - hash) + i;
+    }
+    return hash;
+}
+
+size_t CacheDataHandler::GetCacheSize(android::nn::CacheToken token)
+{
+    for (auto i = m_CacheDataMap.begin(); i != m_CacheDataMap.end(); ++i)
+    {
+        if (i->second.GetToken() == token)
+        {
+            return i->second.GetCacheSize();
+        }
+    }
+    return 0;
+}
+
+void CacheDataHandler::Clear()
+{
+    m_CacheDataMap.clear();
+}
+
+} // armnn_driver