diff options
Diffstat (limited to 'gr-zeromq/python')
28 files changed, 1096 insertions, 6 deletions
diff --git a/gr-zeromq/python/zeromq/CMakeLists.txt b/gr-zeromq/python/zeromq/CMakeLists.txt index bf7a02875a..87ea10f832 100644 --- a/gr-zeromq/python/zeromq/CMakeLists.txt +++ b/gr-zeromq/python/zeromq/CMakeLists.txt @@ -33,9 +33,6 @@ if(ENABLE_TESTING) set(GR_TEST_LIBRARY_DIRS "") set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/gnuradio-runtime/python - ${CMAKE_BINARY_DIR}/gnuradio-runtime/swig - ${CMAKE_BINARY_DIR}/gr-blocks/swig - ${CMAKE_BINARY_DIR}/gr-zeromq/swig ) include(GrTest) @@ -45,3 +42,5 @@ if(ENABLE_TESTING) GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) + +add_subdirectory(bindings) diff --git a/gr-zeromq/python/zeromq/__init__.py b/gr-zeromq/python/zeromq/__init__.py index a696368cfc..0d5c7ca03b 100644 --- a/gr-zeromq/python/zeromq/__init__.py +++ b/gr-zeromq/python/zeromq/__init__.py @@ -16,11 +16,11 @@ from __future__ import unicode_literals import os try: - from .zeromq_swig import * + from .zeromq_python import * except ImportError: dirname, filename = os.path.split(os.path.abspath(__file__)) - __path__.append(os.path.join(dirname, "..", "..", "swig")) - from .zeromq_swig import * + __path__.append(os.path.join(dirname, "bindings")) + from .zeromq_python import * from .probe_manager import probe_manager from .rpc_manager import rpc_manager diff --git a/gr-zeromq/python/zeromq/bindings/CMakeLists.txt b/gr-zeromq/python/zeromq/bindings/CMakeLists.txt new file mode 100644 index 0000000000..a70459b95d --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/CMakeLists.txt @@ -0,0 +1,27 @@ +include(GrPybind) + +######################################################################## +# Python Bindings +######################################################################## + +list(APPEND zeromq_python_files + pub_msg_sink_python.cc + pub_sink_python.cc + pull_msg_source_python.cc + pull_source_python.cc + push_msg_sink_python.cc + push_sink_python.cc + rep_msg_sink_python.cc + rep_sink_python.cc + req_msg_source_python.cc + req_source_python.cc + sub_msg_source_python.cc + sub_source_python.cc + python_bindings.cc) + +GR_PYBIND_MAKE_CHECK_HASH(zeromq + ../../.. + gr::zeromq + "${zeromq_python_files}") + +install(TARGETS zeromq_python DESTINATION ${GR_PYTHON_DIR}/gnuradio/zeromq COMPONENT pythonapi) diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/pub_msg_sink_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/pub_msg_sink_pydoc_template.h new file mode 100644 index 0000000000..34769ea4c6 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/pub_msg_sink_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_pub_msg_sink = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pub_msg_sink_pub_msg_sink_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pub_msg_sink_pub_msg_sink_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pub_msg_sink_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pub_msg_sink_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/pub_sink_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/pub_sink_pydoc_template.h new file mode 100644 index 0000000000..887122ae46 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/pub_sink_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_pub_sink = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pub_sink_pub_sink_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pub_sink_pub_sink_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pub_sink_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pub_sink_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/pull_msg_source_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/pull_msg_source_pydoc_template.h new file mode 100644 index 0000000000..b90da7aa45 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/pull_msg_source_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_pull_msg_source = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pull_msg_source_pull_msg_source_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pull_msg_source_pull_msg_source_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pull_msg_source_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pull_msg_source_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/pull_source_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/pull_source_pydoc_template.h new file mode 100644 index 0000000000..030e6bf5c3 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/pull_source_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_pull_source = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pull_source_pull_source_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pull_source_pull_source_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pull_source_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_pull_source_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/push_msg_sink_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/push_msg_sink_pydoc_template.h new file mode 100644 index 0000000000..b62bacafc4 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/push_msg_sink_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_push_msg_sink = R"doc()doc"; + + +static const char* __doc_gr_zeromq_push_msg_sink_push_msg_sink_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_push_msg_sink_push_msg_sink_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_push_msg_sink_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_push_msg_sink_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/push_sink_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/push_sink_pydoc_template.h new file mode 100644 index 0000000000..0c49957581 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/push_sink_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_push_sink = R"doc()doc"; + + +static const char* __doc_gr_zeromq_push_sink_push_sink_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_push_sink_push_sink_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_push_sink_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_push_sink_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/rep_msg_sink_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/rep_msg_sink_pydoc_template.h new file mode 100644 index 0000000000..6bb74864e6 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/rep_msg_sink_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_rep_msg_sink = R"doc()doc"; + + +static const char* __doc_gr_zeromq_rep_msg_sink_rep_msg_sink_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_rep_msg_sink_rep_msg_sink_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_rep_msg_sink_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_rep_msg_sink_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/rep_sink_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/rep_sink_pydoc_template.h new file mode 100644 index 0000000000..172dcea509 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/rep_sink_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_rep_sink = R"doc()doc"; + + +static const char* __doc_gr_zeromq_rep_sink_rep_sink_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_rep_sink_rep_sink_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_rep_sink_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_rep_sink_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/req_msg_source_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/req_msg_source_pydoc_template.h new file mode 100644 index 0000000000..f02a9a9a4f --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/req_msg_source_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_req_msg_source = R"doc()doc"; + + +static const char* __doc_gr_zeromq_req_msg_source_req_msg_source_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_req_msg_source_req_msg_source_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_req_msg_source_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_req_msg_source_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/req_source_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/req_source_pydoc_template.h new file mode 100644 index 0000000000..2253dc96c0 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/req_source_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_req_source = R"doc()doc"; + + +static const char* __doc_gr_zeromq_req_source_req_source_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_req_source_req_source_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_req_source_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_req_source_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/sub_msg_source_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/sub_msg_source_pydoc_template.h new file mode 100644 index 0000000000..6a25d0d9f2 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/sub_msg_source_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_sub_msg_source = R"doc()doc"; + + +static const char* __doc_gr_zeromq_sub_msg_source_sub_msg_source_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_sub_msg_source_sub_msg_source_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_sub_msg_source_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_sub_msg_source_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/docstrings/sub_source_pydoc_template.h b/gr-zeromq/python/zeromq/bindings/docstrings/sub_source_pydoc_template.h new file mode 100644 index 0000000000..efadaa8e93 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/docstrings/sub_source_pydoc_template.h @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, zeromq, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_zeromq_sub_source = R"doc()doc"; + + +static const char* __doc_gr_zeromq_sub_source_sub_source_0 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_sub_source_sub_source_1 = R"doc()doc"; + + +static const char* __doc_gr_zeromq_sub_source_make = R"doc()doc"; + + +static const char* __doc_gr_zeromq_sub_source_last_endpoint = R"doc()doc"; diff --git a/gr-zeromq/python/zeromq/bindings/pub_msg_sink_python.cc b/gr-zeromq/python/zeromq/bindings/pub_msg_sink_python.cc new file mode 100644 index 0000000000..42300962bf --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/pub_msg_sink_python.cc @@ -0,0 +1,50 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(pub_msg_sink.h) */ +/* BINDTOOL_HEADER_FILE_HASH(4a82a90bb9c51ead63cf0d0ad4196287) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/pub_msg_sink.h> +// pydoc.h is automatically generated in the build directory +#include <pub_msg_sink_pydoc.h> + +void bind_pub_msg_sink(py::module& m) +{ + + using pub_msg_sink = ::gr::zeromq::pub_msg_sink; + + + py::class_<pub_msg_sink, gr::block, gr::basic_block, std::shared_ptr<pub_msg_sink>>( + m, "pub_msg_sink", D(pub_msg_sink)) + + .def(py::init(&pub_msg_sink::make), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("bind") = true, + D(pub_msg_sink, make)) + + + .def( + "last_endpoint", &pub_msg_sink::last_endpoint, D(pub_msg_sink, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/pub_sink_python.cc b/gr-zeromq/python/zeromq/bindings/pub_sink_python.cc new file mode 100644 index 0000000000..ddb3af5b3e --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/pub_sink_python.cc @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(pub_sink.h) */ +/* BINDTOOL_HEADER_FILE_HASH(f18c40db0abeb2a88831e0f804180feb) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/pub_sink.h> +// pydoc.h is automatically generated in the build directory +#include <pub_sink_pydoc.h> + +void bind_pub_sink(py::module& m) +{ + + using pub_sink = ::gr::zeromq::pub_sink; + + + py::class_<pub_sink, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<pub_sink>>(m, "pub_sink", D(pub_sink)) + + .def(py::init(&pub_sink::make), + py::arg("itemsize"), + py::arg("vlen"), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("pass_tags") = false, + py::arg("hwm") = -1, + py::arg("key") = "", + D(pub_sink, make)) + + + .def("last_endpoint", &pub_sink::last_endpoint, D(pub_sink, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/pull_msg_source_python.cc b/gr-zeromq/python/zeromq/bindings/pull_msg_source_python.cc new file mode 100644 index 0000000000..f72ca8a6c2 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/pull_msg_source_python.cc @@ -0,0 +1,53 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(pull_msg_source.h) */ +/* BINDTOOL_HEADER_FILE_HASH(e0c802fdfcde5a5fb45b4b2c42c894a8) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/pull_msg_source.h> +// pydoc.h is automatically generated in the build directory +#include <pull_msg_source_pydoc.h> + +void bind_pull_msg_source(py::module& m) +{ + + using pull_msg_source = ::gr::zeromq::pull_msg_source; + + + py::class_<pull_msg_source, + gr::block, + gr::basic_block, + std::shared_ptr<pull_msg_source>>(m, "pull_msg_source", D(pull_msg_source)) + + .def(py::init(&pull_msg_source::make), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("bind") = false, + D(pull_msg_source, make)) + + + .def("last_endpoint", + &pull_msg_source::last_endpoint, + D(pull_msg_source, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/pull_source_python.cc b/gr-zeromq/python/zeromq/bindings/pull_source_python.cc new file mode 100644 index 0000000000..b420a1cb8b --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/pull_source_python.cc @@ -0,0 +1,55 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(pull_source.h) */ +/* BINDTOOL_HEADER_FILE_HASH(850f9a7d270eae47a20211408bf43d5e) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/pull_source.h> +// pydoc.h is automatically generated in the build directory +#include <pull_source_pydoc.h> + +void bind_pull_source(py::module& m) +{ + + using pull_source = ::gr::zeromq::pull_source; + + + py::class_<pull_source, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<pull_source>>(m, "pull_source", D(pull_source)) + + .def(py::init(&pull_source::make), + py::arg("itemsize"), + py::arg("vlen"), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("pass_tags") = false, + py::arg("hwm") = -1, + D(pull_source, make)) + + + .def("last_endpoint", &pull_source::last_endpoint, D(pull_source, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/push_msg_sink_python.cc b/gr-zeromq/python/zeromq/bindings/push_msg_sink_python.cc new file mode 100644 index 0000000000..85b66bd7ef --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/push_msg_sink_python.cc @@ -0,0 +1,51 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(push_msg_sink.h) */ +/* BINDTOOL_HEADER_FILE_HASH(c345fd7ab7dc406eef7af4575c0764eb) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/push_msg_sink.h> +// pydoc.h is automatically generated in the build directory +#include <push_msg_sink_pydoc.h> + +void bind_push_msg_sink(py::module& m) +{ + + using push_msg_sink = ::gr::zeromq::push_msg_sink; + + + py::class_<push_msg_sink, gr::block, gr::basic_block, std::shared_ptr<push_msg_sink>>( + m, "push_msg_sink", D(push_msg_sink)) + + .def(py::init(&push_msg_sink::make), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("bind") = true, + D(push_msg_sink, make)) + + + .def("last_endpoint", + &push_msg_sink::last_endpoint, + D(push_msg_sink, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/push_sink_python.cc b/gr-zeromq/python/zeromq/bindings/push_sink_python.cc new file mode 100644 index 0000000000..549ff95dc3 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/push_sink_python.cc @@ -0,0 +1,55 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(push_sink.h) */ +/* BINDTOOL_HEADER_FILE_HASH(4a194d42c300ebf21fc06f2fe1d31c92) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/push_sink.h> +// pydoc.h is automatically generated in the build directory +#include <push_sink_pydoc.h> + +void bind_push_sink(py::module& m) +{ + + using push_sink = ::gr::zeromq::push_sink; + + + py::class_<push_sink, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<push_sink>>(m, "push_sink", D(push_sink)) + + .def(py::init(&push_sink::make), + py::arg("itemsize"), + py::arg("vlen"), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("pass_tags") = false, + py::arg("hwm") = -1, + D(push_sink, make)) + + + .def("last_endpoint", &push_sink::last_endpoint, D(push_sink, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/python_bindings.cc b/gr-zeromq/python/zeromq/bindings/python_bindings.cc new file mode 100644 index 0000000000..89c245baae --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/python_bindings.cc @@ -0,0 +1,62 @@ + +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +#include <pybind11/pybind11.h> + +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include <numpy/arrayobject.h> + +namespace py = pybind11; + +void bind_pub_msg_sink(py::module&); +void bind_pub_sink(py::module&); +void bind_pull_msg_source(py::module&); +void bind_pull_source(py::module&); +void bind_push_msg_sink(py::module&); +void bind_push_sink(py::module&); +void bind_rep_msg_sink(py::module&); +void bind_rep_sink(py::module&); +void bind_req_msg_source(py::module&); +void bind_req_source(py::module&); +void bind_sub_msg_source(py::module&); +void bind_sub_source(py::module&); + +// We need this hack because import_array() returns NULL +// for newer Python versions. +// This function is also necessary because it ensures access to the C API +// and removes a warning. +void* init_numpy() +{ + import_array(); + return NULL; +} + +PYBIND11_MODULE(zeromq_python, m) +{ + // Initialize the numpy C API + // (otherwise we will see segmentation faults) + init_numpy(); + + // Allow access to base block methods + py::module::import("gnuradio.gr"); + + bind_pub_msg_sink(m); + bind_pub_sink(m); + bind_pull_msg_source(m); + bind_pull_source(m); + bind_push_msg_sink(m); + bind_push_sink(m); + bind_rep_msg_sink(m); + bind_rep_sink(m); + bind_req_msg_source(m); + bind_req_source(m); + bind_sub_msg_source(m); + bind_sub_source(m); +} diff --git a/gr-zeromq/python/zeromq/bindings/rep_msg_sink_python.cc b/gr-zeromq/python/zeromq/bindings/rep_msg_sink_python.cc new file mode 100644 index 0000000000..25d00c8f96 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/rep_msg_sink_python.cc @@ -0,0 +1,50 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(rep_msg_sink.h) */ +/* BINDTOOL_HEADER_FILE_HASH(fa5387606b1c51516404877dfbd11038) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/rep_msg_sink.h> +// pydoc.h is automatically generated in the build directory +#include <rep_msg_sink_pydoc.h> + +void bind_rep_msg_sink(py::module& m) +{ + + using rep_msg_sink = ::gr::zeromq::rep_msg_sink; + + + py::class_<rep_msg_sink, gr::block, gr::basic_block, std::shared_ptr<rep_msg_sink>>( + m, "rep_msg_sink", D(rep_msg_sink)) + + .def(py::init(&rep_msg_sink::make), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("bind") = true, + D(rep_msg_sink, make)) + + + .def( + "last_endpoint", &rep_msg_sink::last_endpoint, D(rep_msg_sink, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/rep_sink_python.cc b/gr-zeromq/python/zeromq/bindings/rep_sink_python.cc new file mode 100644 index 0000000000..ac32c1dcc0 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/rep_sink_python.cc @@ -0,0 +1,55 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(rep_sink.h) */ +/* BINDTOOL_HEADER_FILE_HASH(057f1522bfb66253664d7853c859a43c) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/rep_sink.h> +// pydoc.h is automatically generated in the build directory +#include <rep_sink_pydoc.h> + +void bind_rep_sink(py::module& m) +{ + + using rep_sink = ::gr::zeromq::rep_sink; + + + py::class_<rep_sink, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<rep_sink>>(m, "rep_sink", D(rep_sink)) + + .def(py::init(&rep_sink::make), + py::arg("itemsize"), + py::arg("vlen"), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("pass_tags") = false, + py::arg("hwm") = -1, + D(rep_sink, make)) + + + .def("last_endpoint", &rep_sink::last_endpoint, D(rep_sink, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/req_msg_source_python.cc b/gr-zeromq/python/zeromq/bindings/req_msg_source_python.cc new file mode 100644 index 0000000000..6d1511a825 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/req_msg_source_python.cc @@ -0,0 +1,53 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(req_msg_source.h) */ +/* BINDTOOL_HEADER_FILE_HASH(8d8cffdbec440ac6c84b50712ce717ee) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/req_msg_source.h> +// pydoc.h is automatically generated in the build directory +#include <req_msg_source_pydoc.h> + +void bind_req_msg_source(py::module& m) +{ + + using req_msg_source = ::gr::zeromq::req_msg_source; + + + py::class_<req_msg_source, + gr::block, + gr::basic_block, + std::shared_ptr<req_msg_source>>(m, "req_msg_source", D(req_msg_source)) + + .def(py::init(&req_msg_source::make), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("bind") = false, + D(req_msg_source, make)) + + + .def("last_endpoint", + &req_msg_source::last_endpoint, + D(req_msg_source, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/req_source_python.cc b/gr-zeromq/python/zeromq/bindings/req_source_python.cc new file mode 100644 index 0000000000..30a94720e5 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/req_source_python.cc @@ -0,0 +1,55 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(req_source.h) */ +/* BINDTOOL_HEADER_FILE_HASH(588f6c72006327392f5bb7d064f3a56f) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/req_source.h> +// pydoc.h is automatically generated in the build directory +#include <req_source_pydoc.h> + +void bind_req_source(py::module& m) +{ + + using req_source = ::gr::zeromq::req_source; + + + py::class_<req_source, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<req_source>>(m, "req_source", D(req_source)) + + .def(py::init(&req_source::make), + py::arg("itemsize"), + py::arg("vlen"), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("pass_tags") = false, + py::arg("hwm") = -1, + D(req_source, make)) + + + .def("last_endpoint", &req_source::last_endpoint, D(req_source, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/sub_msg_source_python.cc b/gr-zeromq/python/zeromq/bindings/sub_msg_source_python.cc new file mode 100644 index 0000000000..e01e427bc7 --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/sub_msg_source_python.cc @@ -0,0 +1,53 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(sub_msg_source.h) */ +/* BINDTOOL_HEADER_FILE_HASH(35c48e1b4d8719899d4142620ff7735d) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/sub_msg_source.h> +// pydoc.h is automatically generated in the build directory +#include <sub_msg_source_pydoc.h> + +void bind_sub_msg_source(py::module& m) +{ + + using sub_msg_source = ::gr::zeromq::sub_msg_source; + + + py::class_<sub_msg_source, + gr::block, + gr::basic_block, + std::shared_ptr<sub_msg_source>>(m, "sub_msg_source", D(sub_msg_source)) + + .def(py::init(&sub_msg_source::make), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("bind") = false, + D(sub_msg_source, make)) + + + .def("last_endpoint", + &sub_msg_source::last_endpoint, + D(sub_msg_source, last_endpoint)) + + ; +} diff --git a/gr-zeromq/python/zeromq/bindings/sub_source_python.cc b/gr-zeromq/python/zeromq/bindings/sub_source_python.cc new file mode 100644 index 0000000000..389a0f95ff --- /dev/null +++ b/gr-zeromq/python/zeromq/bindings/sub_source_python.cc @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* 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(sub_source.h) */ +/* BINDTOOL_HEADER_FILE_HASH(8b138ada41a770bf3626b77f711e3833) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/zeromq/sub_source.h> +// pydoc.h is automatically generated in the build directory +#include <sub_source_pydoc.h> + +void bind_sub_source(py::module& m) +{ + + using sub_source = ::gr::zeromq::sub_source; + + + py::class_<sub_source, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<sub_source>>(m, "sub_source", D(sub_source)) + + .def(py::init(&sub_source::make), + py::arg("itemsize"), + py::arg("vlen"), + py::arg("address"), + py::arg("timeout") = 100, + py::arg("pass_tags") = false, + py::arg("hwm") = -1, + py::arg("key") = "", + D(sub_source, make)) + + + .def("last_endpoint", &sub_source::last_endpoint, D(sub_source, last_endpoint)) + + ; +} |