lib: make discarded events/packets support and clock snapshots optional
[babeltrace.git] / bindings / python / bt2 / bt2 / native_bt_component.i
... / ...
CommitLineData
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
87extern const char *bt_component_get_name(const bt_component *component);
88
89extern const bt_component_class *bt_component_borrow_class_const(
90 const bt_component *component);
91
92extern bt_component_class_type bt_component_get_class_type(
93 const bt_component *component);
94
95bt_bool bt_component_is_source(const bt_component *component);
96
97bt_bool bt_component_is_filter(const bt_component *component);
98
99bt_bool bt_component_is_sink(const bt_component *component);
100
101extern bt_bool bt_component_graph_is_canceled(
102 const bt_component *component);
103
104extern void bt_component_get_ref(const bt_component *component);
105
106extern void bt_component_put_ref(const bt_component *component);
107
108/* From component-source-const.h */
109
110const bt_component *bt_component_source_as_component_const(
111 const bt_component_source *component);
112
113extern const bt_component_class_source *
114bt_component_source_borrow_class_const(
115 const bt_component_source *component);
116
117extern uint64_t bt_component_source_get_output_port_count(
118 const bt_component_source *component);
119
120extern const bt_port_output *
121bt_component_source_borrow_output_port_by_name_const(
122 const bt_component_source *component, const char *name);
123
124extern const bt_port_output *
125bt_component_source_borrow_output_port_by_index_const(
126 const bt_component_source *component, uint64_t index);
127
128extern void bt_component_source_get_ref(
129 const bt_component_source *component_source);
130
131extern void bt_component_source_put_ref(
132 const bt_component_source *component_source);
133
134/* From component-filter-const.h */
135
136const bt_component *bt_component_filter_as_component_const(
137 const bt_component_filter *component);
138
139extern const bt_component_class_filter *
140bt_component_filter_borrow_class_const(
141 const bt_component_filter *component);
142
143extern uint64_t bt_component_filter_get_input_port_count(
144 const bt_component_filter *component);
145
146extern const bt_port_input *
147bt_component_filter_borrow_input_port_by_name_const(
148 const bt_component_filter *component, const char *name);
149
150extern const bt_port_input *
151bt_component_filter_borrow_input_port_by_index_const(
152 const bt_component_filter *component, uint64_t index);
153
154extern uint64_t bt_component_filter_get_output_port_count(
155 const bt_component_filter *component);
156
157extern const bt_port_output *
158bt_component_filter_borrow_output_port_by_name_const(
159 const bt_component_filter *component, const char *name);
160
161extern const bt_port_output *
162bt_component_filter_borrow_output_port_by_index_const(
163 const bt_component_filter *component, uint64_t index);
164
165extern void bt_component_filter_get_ref(
166 const bt_component_filter *component_filter);
167
168extern void bt_component_filter_put_ref(
169 const bt_component_filter *component_filter);
170
171/* From component-sink-const.h */
172
173const bt_component *bt_component_sink_as_component_const(
174 const bt_component_sink *component);
175
176extern const bt_component_class_sink *
177bt_component_sink_borrow_class_const(
178 const bt_component_sink *component);
179
180extern uint64_t bt_component_sink_get_input_port_count(
181 const bt_component_sink *component);
182
183extern const bt_port_input *
184bt_component_sink_borrow_input_port_by_name_const(
185 const bt_component_sink *component, const char *name);
186
187extern const bt_port_input *
188bt_component_sink_borrow_input_port_by_index_const(
189 const bt_component_sink *component, uint64_t index);
190
191extern void bt_component_sink_get_ref(
192 const bt_component_sink *component_sink);
193
194extern void bt_component_sink_put_ref(
195 const bt_component_sink *component_sink);
196
197/* From self-component.h */
198
199typedef 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
208const bt_component *bt_self_component_as_component(
209 bt_self_component *self_component);
210
211extern void *bt_self_component_get_data(
212 const bt_self_component *self_component);
213
214extern void bt_self_component_set_data(
215 bt_self_component *self_component, void *data);
216
217/* From self-component-source.h */
218
219bt_self_component *bt_self_component_source_as_self_component(
220 bt_self_component_source *self_comp_source);
221
222const bt_component_source *
223bt_self_component_source_as_component_source(
224 bt_self_component_source *self_comp_source);
225
226extern bt_self_component_port_output *
227bt_self_component_source_borrow_output_port_by_name(
228 bt_self_component_source *self_component,
229 const char *name);
230
231extern bt_self_component_port_output *
232bt_self_component_source_borrow_output_port_by_index(
233 bt_self_component_source *self_component,
234 uint64_t index);
235
236extern bt_self_component_status
237bt_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
244bt_self_component *bt_self_component_filter_as_self_component(
245 bt_self_component_filter *self_comp_filter);
246
247const bt_component_filter *
248bt_self_component_filter_as_component_filter(
249 bt_self_component_filter *self_comp_filter);
250
251extern bt_self_component_port_output *
252bt_self_component_filter_borrow_output_port_by_name(
253 bt_self_component_filter *self_component,
254 const char *name);
255
256extern bt_self_component_port_output *
257bt_self_component_filter_borrow_output_port_by_index(
258 bt_self_component_filter *self_component,
259 uint64_t index);
260
261extern bt_self_component_status
262bt_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
267extern bt_self_component_port_input *
268bt_self_component_filter_borrow_input_port_by_name(
269 bt_self_component_filter *self_component,
270 const char *name);
271
272extern bt_self_component_port_input *
273bt_self_component_filter_borrow_input_port_by_index(
274 bt_self_component_filter *self_component,
275 uint64_t index);
276
277extern bt_self_component_status
278bt_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
285bt_self_component *bt_self_component_sink_as_self_component(
286 bt_self_component_sink *self_comp_sink);
287
288const bt_component_sink *
289bt_self_component_sink_as_component_sink(
290 bt_self_component_sink *self_comp_sink);
291
292extern bt_self_component_port_input *
293bt_self_component_sink_borrow_input_port_by_name(
294 bt_self_component_sink *self_component,
295 const char *name);
296
297extern bt_self_component_port_input *
298bt_self_component_sink_borrow_input_port_by_index(
299 bt_self_component_sink *self_component, uint64_t index);
300
301extern bt_self_component_status
302bt_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.023943 seconds and 4 git commands to generate.