From 38454c9450eba691feb6a33e08224db23753b92e Mon Sep 17 00:00:00 2001
From: NAUD Maxence <maxence.naud@cea.fr>
Date: Thu, 21 Mar 2024 13:16:51 +0000
Subject: [PATCH] [Add] Backend member variable to Operator implementations

---
 include/aidge/backend/OperatorImpl.hpp | 7 ++++++-
 src/backend/OperatorImpl.cpp           | 4 +++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/aidge/backend/OperatorImpl.hpp b/include/aidge/backend/OperatorImpl.hpp
index 8b5aba10d..944183d0b 100644
--- a/include/aidge/backend/OperatorImpl.hpp
+++ b/include/aidge/backend/OperatorImpl.hpp
@@ -15,6 +15,7 @@
 #include <cstddef>
 #include <vector>
 #include <memory>
+
 #include "aidge/utils/Types.h"
 
 namespace Aidge {
@@ -22,10 +23,13 @@ class Operator;
 
 class OperatorImpl {
 public:
-    OperatorImpl(const Operator& op);
+    OperatorImpl(const Operator& op, const std::string& backend);
     virtual void forward();
     virtual void backward();
 
+    const std::string& backend() const noexcept {
+        return mBackend;
+    }
     /**
      * @brief Minimum amount of data from a specific input required by the
      * implementation to be run.
@@ -73,6 +77,7 @@ public:
 
 protected:
     const Operator &mOp;
+    const std::string mBackend;
     std::vector<NbElts_t> mNbConsumedData;
     std::vector<NbElts_t> mNbProducedData;
 };
diff --git a/src/backend/OperatorImpl.cpp b/src/backend/OperatorImpl.cpp
index 1911da228..0492c0505 100644
--- a/src/backend/OperatorImpl.cpp
+++ b/src/backend/OperatorImpl.cpp
@@ -10,14 +10,16 @@
  ********************************************************************************/
 
 #include <cassert>
+#include <string>
 
 #include "aidge/backend/OperatorImpl.hpp"
 #include "aidge/operator/Operator.hpp"
 #include "aidge/data/Tensor.hpp"
 #include "aidge/utils/ErrorHandling.hpp"
 
-Aidge::OperatorImpl::OperatorImpl(const Operator& op):
+Aidge::OperatorImpl::OperatorImpl(const Operator& op, const std::string& backend):
     mOp(op),
+    mBackend(backend),
     mNbConsumedData(mOp.nbInputs(), 0),
     mNbProducedData(mOp.nbOutputs(), 0)
 {
-- 
GitLab