Advanced

Python Wrapper for C++ solving the recent YandexQ problem

Posted by dba477 on · Post a comment
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

» Get new stories by e-mail: nightly or as they are published

« Return to the newswire homepage

  Related stories
» More like this

Comments

No comments yet. Be the first.

Post a comment

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post