Python Wrapper for C++ solving the recent YandexQ problem

Posted by dba477 on Aug 6, 2021 3:04 PM EDT
https://dbaxps.blogspot.com/; By Boris Derzhavets
Mail this story
Print this story

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

  Nav
» Read more about: Story Type: Reviews; Groups: Developer, Fedora, Python

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.