I'm trying to wrap a few classes for Python. A simplified version of
them would be the following:
void sendMessage(const Message &msg) = 0;
void sendMessage(const Message &msg)
// For each contained child
// call child.sendMessage(msg)
// End for
I want to extend the Message and Child classes in Python and have them
converted to correct Python classes when back in Python. I.e. I want
PyChild.sendMessage to be able to call msg.pyMethod if the msg parameter
is of type PyMessage and PyMessage has a method called pyMethod.
I have tried to use just directors but that doesn't result in the
correct casting when in Python (they come as plain Message classes, not
PyMessage), I'm guessing it's because the parameter to
Parent.sendMessage has a different memory address than the ultimate
parameter that is passed to PyChild.sendMessage, because I have seen
SWIG correctly cast to a Python extended type but then each Python
object was pointing to the same address.
Could someone please help me find the correct way to do this or suggest
an alternative interface.