IVGCVSW-7423 Add ArmnnDelegatePlugin

Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com>
Signed-off-by: Ryan OShea <ryan.oshea3@arm.com>
Change-Id: Ie02021ac56a512598760e4c6d05ef1a80f4aec8d
diff --git a/delegate/opaque/include/armnn_delegate.hpp b/delegate/opaque/include/armnn_delegate.hpp
index 653015a..bb6451f 100644
--- a/delegate/opaque/include/armnn_delegate.hpp
+++ b/delegate/opaque/include/armnn_delegate.hpp
@@ -10,6 +10,7 @@
 #include <tensorflow/core/public/version.h>
 #include <tensorflow/lite/c/c_api_opaque.h>
 #include <tensorflow/lite/core/experimental/acceleration/configuration/c/stable_delegate.h>
+#include <tensorflow/lite/experimental/acceleration/configuration/delegate_registry.h>
 
 #if TF_MAJOR_VERSION > 2 || (TF_MAJOR_VERSION == 2 && TF_MINOR_VERSION > 5)
 #define ARMNN_POST_TFLITE_2_5
@@ -87,6 +88,35 @@
 
 extern const TfLiteStableDelegate TFL_TheStableDelegate;
 
+using tflite::delegates::DelegatePluginInterface;
+using TfLiteOpaqueDelegatePtr = tflite::delegates::TfLiteDelegatePtr;
+
+class ArmnnDelegatePlugin : public DelegatePluginInterface
+{
+public:
+    static std::unique_ptr<ArmnnDelegatePlugin> New(const tflite::TFLiteSettings& tflite_settings)
+    {
+        return std::make_unique<ArmnnDelegatePlugin>(tflite_settings);
+    }
+
+    tflite::delegates::TfLiteDelegatePtr Create() override
+    {
+        // Use default settings until options have been enabled.
+        return tflite::delegates::TfLiteDelegatePtr(
+            TfLiteArmnnOpaqueDelegateCreate(nullptr), TfLiteArmnnOpaqueDelegateDelete);
+    }
+
+    int GetDelegateErrno(TfLiteOpaqueDelegate* from_delegate) override
+    {
+        return 0;
+    }
+
+    explicit ArmnnDelegatePlugin(const tflite::TFLiteSettings& tfliteSettings)
+    {
+        // Use default settings until options have been enabled.
+    }
+};
+
 /// ArmnnSubgraph class where parsing the nodes to ArmNN format and creating the ArmNN Graph
 class ArmnnSubgraph
 {