[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Overloaded make() with pybind11
From: |
Daniel Estévez |
Subject: |
Re: Overloaded make() with pybind11 |
Date: |
Sat, 23 Jan 2021 13:47:57 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 |
El 22/1/21 a las 19:09, Daniel Estévez escribió:
I'm porting gr-satellites to GNU Radio 3.9. I have some blocks that have
an overloaded make() method, for example:
https://github.com/daniestevez/gr-satellites/blob/master/include/satellites/decode_rs.h
Now I'm wondering if it's possible to use this with pybind11, and if so
how to do it.
> [...]
Hi,
Thanks for all your replies. It has been quite useful to see examples of
this done in gr-uhd and gr-sdrplay3.
I also took a look at the pybind11 docs:
https://pybind11.readthedocs.io/en/stable/classes.html#overloaded-methods
and finally settled on using py::overload_cast<>. The final result is in
https://github.com/daniestevez/gr-satellites/blob/gr39/python/bindings/decode_rs_python.cc
I also needed to hand-modify the docstrings templates, since the
autogenerated templates had
__doc_gr_satellites_decode_rs_make_0
and
__doc_gr_satellites_decode_rs_make_1
instead of
__doc_gr_satellites_decode_rs_make
Best,
Dani.
OpenPGP_signature
Description: OpenPGP digital signature