Salome HOME
New method: getHiddenCppPointerAsLongLong() abn/cpp_ptr
authorabn <adrien.bruneton@cea.fr>
Mon, 23 Oct 2023 14:38:34 +0000 (16:38 +0200)
committerabn <adrien.bruneton@cea.fr>
Mon, 23 Oct 2023 14:38:34 +0000 (16:38 +0200)
+ useful for mixed wrapping tools, for example mixing MEDCoupling's SWIG
  and PyBind11/Nanobind

src/MEDCoupling_Swig/MEDCouplingCommon.i

index 448d3e769b7683849c03515e4658d1780d53996d..1fca14d4b4fcfadffd5abb6d42fa0d2abee28fef 100644 (file)
@@ -680,6 +680,14 @@ namespace MEDCoupling
       std::ostringstream oss; oss << "C++ Pointer address is : " << self;
       return oss.str();
     }
+
+    // Hack to allow retrieving of underlying C++ pointer whatever the situation
+    // This allows for example to mix different types of Python binding (SWIG and PyBind for example)
+    long long getHiddenCppPointerAsLongLong() const
+    {
+      return (long long) self;
+    }
+
   }
 
   %extend MEDCouplingGaussLocalization