Commit | Line | Data |
---|---|---|
6945df9a | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
6945df9a SM |
3 | * |
4 | * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> | |
6945df9a SM |
5 | */ |
6 | ||
7 | /* Output argument typemap for connection output (always appends) */ | |
8 | %typemap(in, numinputs=0) | |
d6bb425c | 9 | (const bt_connection **) |
6945df9a SM |
10 | (bt_connection *temp_conn = NULL) { |
11 | $1 = &temp_conn; | |
12 | } | |
13 | ||
14 | %typemap(argout) | |
d6bb425c | 15 | (const bt_connection **) { |
6945df9a SM |
16 | if (*$1) { |
17 | /* SWIG_Python_AppendOutput() steals the created object */ | |
18 | $result = SWIG_Python_AppendOutput($result, | |
19 | SWIG_NewPointerObj(SWIG_as_voidptr(*$1), | |
20 | SWIGTYPE_p_bt_connection, 0)); | |
21 | } else { | |
22 | /* SWIG_Python_AppendOutput() steals Py_None */ | |
23 | Py_INCREF(Py_None); | |
24 | $result = SWIG_Python_AppendOutput($result, Py_None); | |
25 | } | |
26 | } | |
27 | ||
28 | /* Output argument typemap for component output (always appends) */ | |
29 | %typemap(in, numinputs=0) | |
d6bb425c | 30 | (const bt_component_source **) |
6945df9a SM |
31 | (bt_component_source *temp_comp = NULL) { |
32 | $1 = &temp_comp; | |
33 | } | |
34 | ||
35 | %typemap(in, numinputs=0) | |
d6bb425c | 36 | (const bt_component_filter **) |
6945df9a SM |
37 | (bt_component_filter *temp_comp = NULL) { |
38 | $1 = &temp_comp; | |
39 | } | |
40 | ||
41 | %typemap(in, numinputs=0) | |
d6bb425c | 42 | (const bt_component_sink **) |
6945df9a SM |
43 | (bt_component_sink *temp_comp = NULL) { |
44 | $1 = &temp_comp; | |
45 | } | |
46 | ||
d6bb425c | 47 | %typemap(argout) (const bt_component_source **) { |
6945df9a SM |
48 | if (*$1) { |
49 | /* SWIG_Python_AppendOutput() steals the created object */ | |
50 | $result = SWIG_Python_AppendOutput($result, | |
51 | SWIG_NewPointerObj(SWIG_as_voidptr(*$1), | |
52 | SWIGTYPE_p_bt_component_source, 0)); | |
53 | } else { | |
54 | /* SWIG_Python_AppendOutput() steals Py_None */ | |
55 | Py_INCREF(Py_None); | |
56 | $result = SWIG_Python_AppendOutput($result, Py_None); | |
57 | } | |
58 | } | |
59 | ||
d6bb425c | 60 | %typemap(argout) (const bt_component_filter **) { |
6945df9a SM |
61 | if (*$1) { |
62 | /* SWIG_Python_AppendOutput() steals the created object */ | |
63 | $result = SWIG_Python_AppendOutput($result, | |
64 | SWIG_NewPointerObj(SWIG_as_voidptr(*$1), | |
65 | SWIGTYPE_p_bt_component_filter, 0)); | |
66 | } else { | |
67 | /* SWIG_Python_AppendOutput() steals Py_None */ | |
68 | Py_INCREF(Py_None); | |
69 | $result = SWIG_Python_AppendOutput($result, Py_None); | |
70 | } | |
71 | } | |
72 | ||
d6bb425c | 73 | %typemap(argout) (const bt_component_sink **) { |
6945df9a SM |
74 | if (*$1) { |
75 | /* SWIG_Python_AppendOutput() steals the created object */ | |
76 | $result = SWIG_Python_AppendOutput($result, | |
77 | SWIG_NewPointerObj(SWIG_as_voidptr(*$1), | |
78 | SWIGTYPE_p_bt_component_sink, 0)); | |
79 | } else { | |
80 | /* SWIG_Python_AppendOutput() steals Py_None */ | |
81 | Py_INCREF(Py_None); | |
82 | $result = SWIG_Python_AppendOutput($result, Py_None); | |
83 | } | |
84 | } | |
85 | ||
d6bb425c | 86 | %include <babeltrace2/graph/graph.h> |
6945df9a SM |
87 | |
88 | /* Helper functions for Python */ | |
89 | ||
90 | %{ | |
4212232c | 91 | #include "native_bt_graph.i.h" |
6945df9a SM |
92 | %} |
93 | ||
d24d5663 | 94 | PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph, |
6945df9a | 95 | PyObject *py_callable); |
66964f3f | 96 | |
66964f3f PP |
97 | bt_graph_add_component_status |
98 | bt_bt2_graph_add_source_component( | |
99 | bt_graph *graph, | |
100 | const bt_component_class_source *component_class, | |
101 | const char *name, const bt_value *params, | |
102 | PyObject *obj, bt_logging_level log_level, | |
103 | const bt_component_source **component); | |
104 | ||
105 | bt_graph_add_component_status | |
106 | bt_bt2_graph_add_filter_component( | |
107 | bt_graph *graph, | |
108 | const bt_component_class_filter *component_class, | |
109 | const char *name, const bt_value *params, | |
110 | PyObject *obj, bt_logging_level log_level, | |
111 | const bt_component_filter **component); | |
112 | ||
113 | bt_graph_add_component_status | |
114 | bt_bt2_graph_add_sink_component( | |
115 | bt_graph *graph, | |
116 | const bt_component_class_sink *component_class, | |
117 | const char *name, const bt_value *params, | |
118 | PyObject *obj, bt_logging_level log_level, | |
119 | const bt_component_sink **component); |