Python Wrapper for C++ solving the recent YandexQ problem
In this post I follow approach suggested in How to wrap a C++ object using pure Python Extension API which differs from C++ coding technique been presented earlier. Public Class Strike containing method "filter" is supposed to be declared. Later on in PyStrike_init( ) new instance of this class is been created.
|
|
Structure PyStrike been declared right after "using abc::Strike" has a field PtrObject which is a pointer to Strike in PyStrike_init( ) following assigment is taken place self->ptrObj=new Strike(fftSize). This assigment allows in PyStrike_filter( ) to invoke "filter" method and obtain the resulting number via call "retval = (self->ptrObj)->filter(freq,sqnc)" to return retval to Python as follows "return Py_BuildValue("l",retval)" Full Story |
This topic does not have any threads posted yet!
You cannot post until you login.