Saturday, January 23, 2021

Re: Overloaded make() with pybind11

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.

No comments:

Post a Comment