From: mattdavis <som...@gm...> - 2007-12-13 00:33:53
|
Hi everyone, I am new to swig and have some questions about callbacks. I would love any help, hints, or links to pages that might contain more information for me. So here is my current situation. I have 5 function that I am trying to wrap in swig. There are 2 RegisterForNotification function which accept an EventID and an either an EventResponder or an EventListner. The EventListener and EventResponder are functions which get called when an event is raised RaiseEvent notifies all the listeners first and then calls the event responder. There may be multiple listeners, but only one responder. The listeners may do some processing, but do not provide a result. The responder handles the event and returns a result. the other 2 are UnregisterForNotification which takes an EventID and either an EventListener or EventResponder. The other question I have is do I need to wrap the EventListner and EventResponder? The following code is in the .h file typedef CBFunctor3wRet<EventId, const String&, const Argument&, Result> EventListener; typedef CBFunctor3wRet<EventId, const String&, Argument&, Result> EventResponder; does that mean that it will be wrapped or do I have to specifically include it? I have also already wrapped my String and Result classes but haven't yet wrapped the Argument class. I am assuming that I will need to wrap the Argument class as well. What I want to be able to do is call these functions from a python script. So for example if a REQUIREPASSWORD event pops up then I can send it a password from the script and I get a result back. I have done a little digging around and from what I can understand to do call backs I have to have the callback functions defined in C and I wrap them with swig. Please correct me if I am wrong. For what I am trying to do that doesn't fit very well. I want to be able to write function in python and be able to pass them in. Is this possible? I have also seen some posts and links to TypeMaps. This was a little deeper into swig then I thought I would have to go. I am not opposed to doing this, I was just hoping to know if that is the right approach to this problem or if there is a more simple approach to this. Any help is greatly appreciated. -- View this message in context: http://www.nabble.com/new-to-swig-and-callbacks-wondering-if-swig-can-do-this-and-any-pointers.-tp14306927p14306927.html Sent from the swig-user mailing list archive at Nabble.com. |