Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#23 Feature request: $self in typemaps

closed
nobody
None
5
2006-12-14
2004-02-24
Jakob Schiøtz
No

May I request a new $keyword in typemaps relating to
methods of obejcts. It would be nice to be able to
call other methods on the object, for example to ask
for the size of arrays. A $self or $this keyword would
allow that.

Example:

class MyObj {
public:
const int *GetData();
const int GetSize();
}

The output typemap for MyObj::GetData() should convert
the int pointer to a Numeric array. To do this, the
typemap needs to know the size of the array, i.e. to
call MyObj::GetSize().

Currently, I am assuming that arg1 holds the object, it
looks like that works, at least when wrapping for
Python, but something more readable / more portable
would be nice.

Best regards

Jakob

Discussion

  • Marcelo Matus
    Marcelo Matus
    2004-11-17

    • labels: 102863 -->
     
  • Olly Betts
    Olly Betts
    2006-12-14

    • status: open --> closed
     
  • Olly Betts
    Olly Betts
    2006-12-14

    Logged In: YES
    user_id=14972
    Originator: NO

    SWIG 1.3.30 supports $self for %extend. You can use this to define a %extend method which calls both GetData() and GetSize(), and use %ignore to avoid wrapping GetData() and GetSize() themselves.then