[cig-commits] r14931 - short/3D/PyLith/trunk/modulesrc/topology
brad at geodynamics.org
brad at geodynamics.org
Fri May 8 15:08:51 PDT 2009
Author: brad
Date: 2009-05-08 15:08:51 -0700 (Fri, 08 May 2009)
New Revision: 14931
Modified:
short/3D/PyLith/trunk/modulesrc/topology/Field.i
Log:
Fixed handling of reference as return value.
Modified: short/3D/PyLith/trunk/modulesrc/topology/Field.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/Field.i 2009-05-08 22:06:27 UTC (rev 14930)
+++ short/3D/PyLith/trunk/modulesrc/topology/Field.i 2009-05-08 22:08:51 UTC (rev 14931)
@@ -16,6 +16,20 @@
* @brief Python interface to C++ Field object.
*/
+// Typemaps for returning reference in operator+=. The default
+// behavior is that the Python object will gain ownership. We want the
+// C++ object to retain ownership. This could be alleviated by using a
+// shared pointer.
+%typemap(out) pylith::topology::Field<pylith::topology::Mesh>& {
+ $result = SWIG_NewPointerObj(SWIG_as_voidptr($1), $descriptor(pylith::topology::Field<pylith::topology::Mesh>*), 0 | 0);
+ return $result;
+ }
+%typemap(out) pylith::topology::Field<pylith::topology::SubMesh>& {
+ $result = SWIG_NewPointerObj(SWIG_as_voidptr($1), $descriptor(pylith::topology::Field<pylith::topology::SubMesh>*), 0 | 0);
+ return $result;
+ }
+
+
namespace pylith {
namespace topology {
More information about the CIG-COMMITS
mailing list