correct callback functions references for Python binding: use gr_modtool bind from gr-m17 to regenerate bindings when updating callbacks or header files in include

main
Jean-Michel Friedt 2023-03-04 12:46:05 +01:00
parent 32132356f9
commit 452f5b2099
7 changed files with 72 additions and 76 deletions

View File

@ -83,6 +83,13 @@ md5sum include/gnuradio/m17/m17_decoder.h
```
match the information in ``python/m17/bindings/*cc``.
Rather than manually changing the md5sum, the proper way of handling bindings in the Python directory is to execute
```
gr_modtool bind m17_decoder
gr_modtool bind m17_coder
``` from the gr-m17 directory, assuming ``gr_modtool bind`` works, otherwise check https://github.com/gnuradio/gnuradio/issues/6477
## Developer note2
The coder block is an interpolating block outputing 24 more times samples than input symbols. The (well named) ``noutput_items``

View File

@ -33,20 +33,12 @@ public:
* creating new instances.
*/
static sptr make(std::string src_id,std::string dst_id,short type,std::string meta,float samp_rate,bool debug);
/*
virtual void set_meta(std::string meta)=0;
virtual void set_src_id(std::string src_id)=0;
virtual void set_dst_id(std::string dst_id)=0;
virtual void set_samp_rate(float samp_rate)=0;
virtual void set_debug(bool debug)=0;
virtual void set_type(short type)=0;
*/
void set_meta(std::string meta);
void set_src_id(std::string src_id);
void set_dst_id(std::string dst_id);
void set_samp_rate(float samp_rate);
void set_debug(bool debug);
void set_type(short type);
};
} // namespace m17

View File

@ -33,12 +33,8 @@ public:
* creating new instances.
*/
static sptr make(bool debug_data,bool debug_ctrl);
/*
virtual void set_debug_data(bool debug)=0;
virtual void set_debug_ctrl(bool debug)=0;
*/
void set_debug_data(bool debug);
void set_debug_ctrl(bool debug);
};
} // namespace m17

View File

@ -14,14 +14,22 @@
and will be overwritten during the build process
*/
static const char *__doc_gr_m17_m17_coder = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_m17_coder_0 = R"doc()doc";
static const char *__doc_gr_m17_m17_coder = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_m17_coder_1 = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_make = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_m17_coder = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_set_meta = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_set_src_id = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_make = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_set_dst_id = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_set_samp_rate = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_set_debug = R"doc()doc";
static const char *__doc_gr_m17_m17_coder_set_type = R"doc()doc";

View File

@ -14,14 +14,14 @@
and will be overwritten during the build process
*/
static const char *__doc_gr_m17_m17_decoder = R"doc()doc";
static const char *__doc_gr_m17_m17_decoder_m17_decoder_0 = R"doc()doc";
static const char *__doc_gr_m17_m17_decoder = R"doc()doc";
static const char *__doc_gr_m17_m17_decoder_m17_decoder_1 = R"doc()doc";
static const char *__doc_gr_m17_m17_decoder_make = R"doc()doc";
static const char *__doc_gr_m17_m17_decoder_m17_decoder = R"doc()doc";
static const char *__doc_gr_m17_m17_decoder_set_debug_data = R"doc()doc";
static const char *__doc_gr_m17_m17_decoder_make = R"doc()doc";
static const char *__doc_gr_m17_m17_decoder_set_debug_ctrl = R"doc()doc";

View File

@ -8,13 +8,15 @@
*/
/***********************************************************************************/
/* This file is automatically generated using bindtool and can be manually edited */
/* The following lines can be configured to regenerate this file during cmake */
/* If manual edits are made, the following tags should be modified accordingly. */
/* BINDTOOL_GEN_AUTOMATIC(1) */
/* BINDTOOL_USE_PYGCCXML(1) */
/* This file is automatically generated using bindtool and can be manually
* edited */
/* The following lines can be configured to regenerate this file during cmake */
/* If manual edits are made, the following tags should be modified accordingly.
*/
/* BINDTOOL_GEN_AUTOMATIC(0) */
/* BINDTOOL_USE_PYGCCXML(0) */
/* BINDTOOL_HEADER_FILE(m17_coder.h) */
/* BINDTOOL_HEADER_FILE_HASH(7c3c43fefced882d5d1e91dd86246916) */
/* BINDTOOL_HEADER_FILE_HASH(c37cf1a142598d1cf96b7a93c85559f2) */
/***********************************************************************************/
#include <pybind11/complex.h>
@ -27,33 +29,34 @@ namespace py = pybind11;
// pydoc.h is automatically generated in the build directory
#include <m17_coder_pydoc.h>
void bind_m17_coder(py::module& m)
{
void bind_m17_coder(py::module &m) {
using m17_coder = gr::m17::m17_coder;
using m17_coder = ::gr::m17::m17_coder;
py::class_<m17_coder, gr::block, gr::basic_block, std::shared_ptr<m17_coder>>(
m, "m17_coder", D(m17_coder))
py::class_<m17_coder, gr::block, gr::basic_block,
std::shared_ptr<m17_coder>>(m, "m17_coder", D(m17_coder))
.def(py::init(&m17_coder::make), py::arg("src_id"), py::arg("dst_id"),
py::arg("type"), py::arg("meta"), py::arg("samp_rate"),
py::arg("debug"), D(m17_coder, make))
.def(py::init(&m17_coder::make),
D(m17_coder,make)
)
.def("set_meta", &m17_coder::set_meta, py::arg("meta"),
D(m17_coder, set_meta))
.def("set_src_id", &m17_coder::set_src_id, py::arg("src_id"),
D(m17_coder, set_src_id))
.def("set_dst_id", &m17_coder::set_dst_id, py::arg("dst_id"),
D(m17_coder, set_dst_id))
;
.def("set_samp_rate", &m17_coder::set_samp_rate, py::arg("samp_rate"),
D(m17_coder, set_samp_rate))
.def("set_debug", &m17_coder::set_debug, py::arg("debug"),
D(m17_coder, set_debug))
.def("set_type", &m17_coder::set_type, py::arg("type"),
D(m17_coder, set_type))
;
}

View File

@ -8,13 +8,15 @@
*/
/***********************************************************************************/
/* This file is automatically generated using bindtool and can be manually edited */
/* The following lines can be configured to regenerate this file during cmake */
/* If manual edits are made, the following tags should be modified accordingly. */
/* BINDTOOL_GEN_AUTOMATIC(0) */
/* BINDTOOL_USE_PYGCCXML(0) */
/* This file is automatically generated using bindtool and can be manually
* edited */
/* The following lines can be configured to regenerate this file during cmake */
/* If manual edits are made, the following tags should be modified accordingly.
*/
/* BINDTOOL_GEN_AUTOMATIC(0) */
/* BINDTOOL_USE_PYGCCXML(0) */
/* BINDTOOL_HEADER_FILE(m17_decoder.h) */
/* BINDTOOL_HEADER_FILE_HASH(1272f56a1d826511e7890e4080bcd62c) */
/* BINDTOOL_HEADER_FILE_HASH(6d1584568dd4bd471f76c6e03b799efb) */
/***********************************************************************************/
#include <pybind11/complex.h>
@ -27,33 +29,21 @@ namespace py = pybind11;
// pydoc.h is automatically generated in the build directory
#include <m17_decoder_pydoc.h>
void bind_m17_decoder(py::module& m)
{
void bind_m17_decoder(py::module &m) {
using m17_decoder = gr::m17::m17_decoder;
using m17_decoder = ::gr::m17::m17_decoder;
py::class_<m17_decoder, gr::block, gr::basic_block,
std::shared_ptr<m17_decoder>>(m, "m17_decoder", D(m17_decoder))
py::class_<m17_decoder, gr::block, gr::basic_block,
std::shared_ptr<m17_decoder>>(m, "m17_decoder", D(m17_decoder))
.def(py::init(&m17_decoder::make),
D(m17_decoder,make)
)
;
.def(py::init(&m17_decoder::make), py::arg("debug_data"),
py::arg("debug_ctrl"), D(m17_decoder, make))
.def("set_debug_data", &m17_decoder::set_debug_data, py::arg("debug"),
D(m17_decoder, set_debug_data))
.def("set_debug_ctrl", &m17_decoder::set_debug_ctrl, py::arg("debug"),
D(m17_decoder, set_debug_ctrl))
;
}