Realtime processing and callbacks with Python and C++
- by Doughy
I need to write code to do some realtime processing that is fairly computationally complex. I would like to create some Python classes to manage all my scripting, and leave the intensive parts of the algorithm coded in C++ so that they can run as fast as possible. I would like to instantiate the objects in Python, and have the C++ algorithms chime back into the script with callbacks in python. Something like:
myObject = MyObject()
myObject.setCallback(myCallback)
myObject.run()
def myCallback(val):
"""Do something with the value passed back to the python script."""
pass
Will this be possible? How can I run a callback in python from a loop that is running in a C++ module? Anyone have a link or a tutorial to help me do this correctly?