tap-driver.sh: flush stdout after each test result
[babeltrace.git] / bindings / python / bt2 / bt2 / native_bt_component.i
1 /*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25 /* Output argument typemap for self port output (always appends) */
26 %typemap(in, numinputs=0)
27 (bt_self_component_port_input **OUT)
28 (bt_self_component_port_input *temp_self_port = NULL) {
29 $1 = &temp_self_port;
30 }
31
32 %typemap(argout) bt_self_component_port_input **OUT {
33 if (*$1) {
34 /* SWIG_Python_AppendOutput() steals the created object */
35 $result = SWIG_Python_AppendOutput($result,
36 SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
37 SWIGTYPE_p_bt_self_component_port_input, 0));
38 } else {
39 /* SWIG_Python_AppendOutput() steals Py_None */
40 Py_INCREF(Py_None);
41 $result = SWIG_Python_AppendOutput($result, Py_None);
42 }
43 }
44
45 /* Output argument typemap for self port output (always appends) */
46 %typemap(in, numinputs=0)
47 (bt_self_component_port_output **OUT)
48 (bt_self_component_port_output *temp_self_port = NULL) {
49 $1 = &temp_self_port;
50 }
51
52 %typemap(argout) (bt_self_component_port_output **OUT) {
53 if (*$1) {
54 /* SWIG_Python_AppendOutput() steals the created object */
55 $result = SWIG_Python_AppendOutput($result,
56 SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
57 SWIGTYPE_p_bt_self_component_port_output, 0));
58 } else {
59 /* SWIG_Python_AppendOutput() steals Py_None */
60 Py_INCREF(Py_None);
61 $result = SWIG_Python_AppendOutput($result, Py_None);
62 }
63 }
64
65 /* Typemaps used for user data attached to self component ports. */
66
67 /*
68 * The user data Python object is kept as the user data of the port, we pass
69 * the PyObject pointer directly to the port creation function.
70 */
71 %typemap(in) void *PY_SELF_PORT_USER_DATA {
72 $1 = $input;
73 }
74
75 /*
76 * The port, if created successfully, now owns a reference to the Python object,
77 * we reflect that here.
78 */
79 %typemap(argout) void *PY_SELF_PORT_USER_DATA {
80 if (PyLong_AsLong($result) == BT_SELF_COMPONENT_STATUS_OK) {
81 Py_INCREF($1);
82 }
83 }
84
85 /* From component-const.h */
86
87 extern const char *bt_component_get_name(const bt_component *component);
88
89 extern const bt_component_class *bt_component_borrow_class_const(
90 const bt_component *component);
91
92 extern bt_component_class_type bt_component_get_class_type(
93 const bt_component *component);
94
95 bt_bool bt_component_is_source(const bt_component *component);
96
97 bt_bool bt_component_is_filter(const bt_component *component);
98
99 bt_bool bt_component_is_sink(const bt_component *component);
100
101 extern bt_bool bt_component_graph_is_canceled(
102 const bt_component *component);
103
104 extern void bt_component_get_ref(const bt_component *component);
105
106 extern void bt_component_put_ref(const bt_component *component);
107
108 /* From component-source-const.h */
109
110 const bt_component *bt_component_source_as_component_const(
111 const bt_component_source *component);
112
113 extern const bt_component_class_source *
114 bt_component_source_borrow_class_const(
115 const bt_component_source *component);
116
117 extern uint64_t bt_component_source_get_output_port_count(
118 const bt_component_source *component);
119
120 extern const bt_port_output *
121 bt_component_source_borrow_output_port_by_name_const(
122 const bt_component_source *component, const char *name);
123
124 extern const bt_port_output *
125 bt_component_source_borrow_output_port_by_index_const(
126 const bt_component_source *component, uint64_t index);
127
128 extern void bt_component_source_get_ref(
129 const bt_component_source *component_source);
130
131 extern void bt_component_source_put_ref(
132 const bt_component_source *component_source);
133
134 /* From component-filter-const.h */
135
136 const bt_component *bt_component_filter_as_component_const(
137 const bt_component_filter *component);
138
139 extern const bt_component_class_filter *
140 bt_component_filter_borrow_class_const(
141 const bt_component_filter *component);
142
143 extern uint64_t bt_component_filter_get_input_port_count(
144 const bt_component_filter *component);
145
146 extern const bt_port_input *
147 bt_component_filter_borrow_input_port_by_name_const(
148 const bt_component_filter *component, const char *name);
149
150 extern const bt_port_input *
151 bt_component_filter_borrow_input_port_by_index_const(
152 const bt_component_filter *component, uint64_t index);
153
154 extern uint64_t bt_component_filter_get_output_port_count(
155 const bt_component_filter *component);
156
157 extern const bt_port_output *
158 bt_component_filter_borrow_output_port_by_name_const(
159 const bt_component_filter *component, const char *name);
160
161 extern const bt_port_output *
162 bt_component_filter_borrow_output_port_by_index_const(
163 const bt_component_filter *component, uint64_t index);
164
165 extern void bt_component_filter_get_ref(
166 const bt_component_filter *component_filter);
167
168 extern void bt_component_filter_put_ref(
169 const bt_component_filter *component_filter);
170
171 /* From component-sink-const.h */
172
173 const bt_component *bt_component_sink_as_component_const(
174 const bt_component_sink *component);
175
176 extern const bt_component_class_sink *
177 bt_component_sink_borrow_class_const(
178 const bt_component_sink *component);
179
180 extern uint64_t bt_component_sink_get_input_port_count(
181 const bt_component_sink *component);
182
183 extern const bt_port_input *
184 bt_component_sink_borrow_input_port_by_name_const(
185 const bt_component_sink *component, const char *name);
186
187 extern const bt_port_input *
188 bt_component_sink_borrow_input_port_by_index_const(
189 const bt_component_sink *component, uint64_t index);
190
191 extern void bt_component_sink_get_ref(
192 const bt_component_sink *component_sink);
193
194 extern void bt_component_sink_put_ref(
195 const bt_component_sink *component_sink);
196
197 /* From self-component.h */
198
199 typedef enum bt_self_component_status {
200 BT_SELF_COMPONENT_STATUS_OK = 0,
201 BT_SELF_COMPONENT_STATUS_END = 1,
202 BT_SELF_COMPONENT_STATUS_AGAIN = 11,
203 BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION = 111,
204 BT_SELF_COMPONENT_STATUS_ERROR = -1,
205 BT_SELF_COMPONENT_STATUS_NOMEM = -12,
206 } bt_self_component_status;
207
208 const bt_component *bt_self_component_as_component(
209 bt_self_component *self_component);
210
211 extern void *bt_self_component_get_data(
212 const bt_self_component *self_component);
213
214 extern void bt_self_component_set_data(
215 bt_self_component *self_component, void *data);
216
217 /* From self-component-source.h */
218
219 bt_self_component *bt_self_component_source_as_self_component(
220 bt_self_component_source *self_comp_source);
221
222 const bt_component_source *
223 bt_self_component_source_as_component_source(
224 bt_self_component_source *self_comp_source);
225
226 extern bt_self_component_port_output *
227 bt_self_component_source_borrow_output_port_by_name(
228 bt_self_component_source *self_component,
229 const char *name);
230
231 extern bt_self_component_port_output *
232 bt_self_component_source_borrow_output_port_by_index(
233 bt_self_component_source *self_component,
234 uint64_t index);
235
236 extern bt_self_component_status
237 bt_self_component_source_add_output_port(
238 bt_self_component_source *self_component,
239 const char *name, void *PY_SELF_PORT_USER_DATA,
240 bt_self_component_port_output **OUT);
241
242 /* From self-component-filter.h */
243
244 bt_self_component *bt_self_component_filter_as_self_component(
245 bt_self_component_filter *self_comp_filter);
246
247 const bt_component_filter *
248 bt_self_component_filter_as_component_filter(
249 bt_self_component_filter *self_comp_filter);
250
251 extern bt_self_component_port_output *
252 bt_self_component_filter_borrow_output_port_by_name(
253 bt_self_component_filter *self_component,
254 const char *name);
255
256 extern bt_self_component_port_output *
257 bt_self_component_filter_borrow_output_port_by_index(
258 bt_self_component_filter *self_component,
259 uint64_t index);
260
261 extern bt_self_component_status
262 bt_self_component_filter_add_output_port(
263 bt_self_component_filter *self_component,
264 const char *name, void *PY_SELF_PORT_USER_DATA,
265 bt_self_component_port_output **OUT);
266
267 extern bt_self_component_port_input *
268 bt_self_component_filter_borrow_input_port_by_name(
269 bt_self_component_filter *self_component,
270 const char *name);
271
272 extern bt_self_component_port_input *
273 bt_self_component_filter_borrow_input_port_by_index(
274 bt_self_component_filter *self_component,
275 uint64_t index);
276
277 extern bt_self_component_status
278 bt_self_component_filter_add_input_port(
279 bt_self_component_filter *self_component,
280 const char *name, void *PY_SELF_PORT_USER_DATA,
281 bt_self_component_port_input **OUT);
282
283 /* From self-component-sink.h */
284
285 bt_self_component *bt_self_component_sink_as_self_component(
286 bt_self_component_sink *self_comp_sink);
287
288 const bt_component_sink *
289 bt_self_component_sink_as_component_sink(
290 bt_self_component_sink *self_comp_sink);
291
292 extern bt_self_component_port_input *
293 bt_self_component_sink_borrow_input_port_by_name(
294 bt_self_component_sink *self_component,
295 const char *name);
296
297 extern bt_self_component_port_input *
298 bt_self_component_sink_borrow_input_port_by_index(
299 bt_self_component_sink *self_component, uint64_t index);
300
301 extern bt_self_component_status
302 bt_self_component_sink_add_input_port(
303 bt_self_component_sink *self_component,
304 const char *name, void *PY_SELF_PORT_USER_DATA,
305 bt_self_component_port_input **OUT);
This page took 0.036741 seconds and 4 git commands to generate.