From: Daniel B. <Ble...@ma...> - 2011-01-20 16:04:15
|
Hi Josh, Thanks much, I just read through the pythonappend feature and it will do exactly what I want. Do you know if there is any way to make this match any method called set*? Here's what works: %feature("pythonappend") setName %{ return self %} Is there some way to change "setName" into a regular expression like "set(.*)"? I can't find any documentation on this. Thanks again, -dan On 1/20/11 9:07 AM, "Josh Cherry" <jc...@nc...> wrote: > > > On Thu, 20 Jan 2011, Daniel Blezek wrote: > >> What I would like is for a and the return from a.setName ( ³foo² ) to >> point to the same SWIG object. I believe there is a way to do this with >> Typemaps, but I¹m not sure. >> >> Could someone more familiar with SWIG typemaps give me some pointers? > > I think you could do this with an "out" typemap that returns the first > argument to the wrapper function instead of the result. Another way, > perhaps simpler, is to do it with inserted Python code (see > http://www.swig.org/Doc2.0/Python.html#Python_nn42). I think that making > the Python method return args[0] would do the trick. > > Josh -- Daniel Blezek, PhD Medical Imaging Informatics Innovation Center P 127 or (77) 8 8886 T 507 538 8886 E ble...@ma... Mayo Clinic 200 First St. S.W. Harwick SL-44 Rochester, MN 55905 mayoclinic.org "It is more complicated than you think." -- RFC 1925 |