blob: b5ed80eecb938e1009b8c275203fb8fc3f058b08 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* Copyright 2021 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_add_system_time(py::module&);
void bind_pdu_filter(py::module&);
void bind_pdu_remove(py::module&);
void bind_pdu_set(py::module&);
void bind_pdu_split(py::module&);
void bind_pdu_to_stream(py::module&);
void bind_pdu_to_tagged_stream(py::module&);
void bind_random_pdu(py::module&);
void bind_tags_to_pdu(py::module&);
void bind_tagged_stream_to_pdu(py::module&);
void bind_take_skip_to_pdu(py::module&);
void bind_time_delta(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(pdu_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_add_system_time(m);
bind_pdu_filter(m);
bind_pdu_remove(m);
bind_pdu_set(m);
bind_pdu_split(m);
bind_pdu_to_stream(m);
bind_pdu_to_tagged_stream(m);
bind_random_pdu(m);
bind_tags_to_pdu(m);
bind_tagged_stream_to_pdu(m);
bind_take_skip_to_pdu(m);
bind_time_delta(m);
}
|