lib: Add functions to borrow specialized component classes from specialized components
[babeltrace.git] / bindings / python / bt2 / bt2 / native_bt_component.i
CommitLineData
6fa6bfa1
SM
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/* From component-const.h */
66
67extern const char *bt_component_get_name(const bt_component *component);
68
69extern const bt_component_class *bt_component_borrow_class_const(
70 const bt_component *component);
71
72extern bt_component_class_type bt_component_get_class_type(
73 const bt_component *component);
74
75bt_bool bt_component_is_source(const bt_component *component);
76
77bt_bool bt_component_is_filter(const bt_component *component);
78
79bt_bool bt_component_is_sink(const bt_component *component);
80
81extern bt_bool bt_component_graph_is_canceled(
82 const bt_component *component);
83
84extern void bt_component_get_ref(const bt_component *component);
85
86extern void bt_component_put_ref(const bt_component *component);
87
88/* From component-source-const.h */
89
90const bt_component *bt_component_source_as_component_const(
91 const bt_component_source *component);
92
61fd44ac
SM
93extern const bt_component_class_source *
94bt_component_source_borrow_class_const(
95 const bt_component_source *component);
96
6fa6bfa1
SM
97extern uint64_t bt_component_source_get_output_port_count(
98 const bt_component_source *component);
99
100extern const bt_port_output *
101bt_component_source_borrow_output_port_by_name_const(
102 const bt_component_source *component, const char *name);
103
104extern const bt_port_output *
105bt_component_source_borrow_output_port_by_index_const(
106 const bt_component_source *component, uint64_t index);
107
108extern void bt_component_source_get_ref(
109 const bt_component_source *component_source);
110
111extern void bt_component_source_put_ref(
112 const bt_component_source *component_source);
113
114/* From component-filter-const.h */
115
116const bt_component *bt_component_filter_as_component_const(
117 const bt_component_filter *component);
118
61fd44ac
SM
119extern const bt_component_class_filter *
120bt_component_filter_borrow_class_const(
121 const bt_component_filter *component);
122
6fa6bfa1
SM
123extern uint64_t bt_component_filter_get_input_port_count(
124 const bt_component_filter *component);
125
126extern const bt_port_input *
127bt_component_filter_borrow_input_port_by_name_const(
128 const bt_component_filter *component, const char *name);
129
130extern const bt_port_input *
131bt_component_filter_borrow_input_port_by_index_const(
132 const bt_component_filter *component, uint64_t index);
133
134extern uint64_t bt_component_filter_get_output_port_count(
135 const bt_component_filter *component);
136
137extern const bt_port_output *
138bt_component_filter_borrow_output_port_by_name_const(
139 const bt_component_filter *component, const char *name);
140
141extern const bt_port_output *
142bt_component_filter_borrow_output_port_by_index_const(
143 const bt_component_filter *component, uint64_t index);
144
145extern void bt_component_filter_get_ref(
146 const bt_component_filter *component_filter);
147
148extern void bt_component_filter_put_ref(
149 const bt_component_filter *component_filter);
150
151/* From component-sink-const.h */
152
153const bt_component *bt_component_sink_as_component_const(
154 const bt_component_sink *component);
155
61fd44ac
SM
156extern const bt_component_class_sink *
157bt_component_sink_borrow_class_const(
158 const bt_component_sink *component);
159
6fa6bfa1
SM
160extern uint64_t bt_component_sink_get_input_port_count(
161 const bt_component_sink *component);
162
163extern const bt_port_input *
164bt_component_sink_borrow_input_port_by_name_const(
165 const bt_component_sink *component, const char *name);
166
167extern const bt_port_input *
168bt_component_sink_borrow_input_port_by_index_const(
169 const bt_component_sink *component, uint64_t index);
170
171extern void bt_component_sink_get_ref(
172 const bt_component_sink *component_sink);
173
174extern void bt_component_sink_put_ref(
175 const bt_component_sink *component_sink);
176
177/* From self-component.h */
178
179typedef enum bt_self_component_status {
180 BT_SELF_COMPONENT_STATUS_OK = 0,
181 BT_SELF_COMPONENT_STATUS_END = 1,
182 BT_SELF_COMPONENT_STATUS_AGAIN = 11,
183 BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION = 111,
184 BT_SELF_COMPONENT_STATUS_ERROR = -1,
185 BT_SELF_COMPONENT_STATUS_NOMEM = -12,
186} bt_self_component_status;
187
188const bt_component *bt_self_component_as_component(
189 bt_self_component *self_component);
190
191extern void *bt_self_component_get_data(
192 const bt_self_component *self_component);
193
194extern void bt_self_component_set_data(
195 bt_self_component *self_component, void *data);
196
197/* From self-component-source.h */
198
199bt_self_component *bt_self_component_source_as_self_component(
200 bt_self_component_source *self_comp_source);
201
202const bt_component_source *
203bt_self_component_source_as_component_source(
204 bt_self_component_source *self_comp_source);
205
206extern bt_self_component_port_output *
207bt_self_component_source_borrow_output_port_by_name(
208 bt_self_component_source *self_component,
209 const char *name);
210
211extern bt_self_component_port_output *
212bt_self_component_source_borrow_output_port_by_index(
213 bt_self_component_source *self_component,
214 uint64_t index);
215
216extern bt_self_component_status
217bt_self_component_source_add_output_port(
218 bt_self_component_source *self_component,
219 const char *name, void *user_data,
220 bt_self_component_port_output **OUT);
221
222/* From self-component-filter.h */
223
224bt_self_component *bt_self_component_filter_as_self_component(
225 bt_self_component_filter *self_comp_filter);
226
227const bt_component_filter *
228bt_self_component_filter_as_component_filter(
229 bt_self_component_filter *self_comp_filter);
230
231extern bt_self_component_port_output *
232bt_self_component_filter_borrow_output_port_by_name(
233 bt_self_component_filter *self_component,
234 const char *name);
235
236extern bt_self_component_port_output *
237bt_self_component_filter_borrow_output_port_by_index(
238 bt_self_component_filter *self_component,
239 uint64_t index);
240
241extern bt_self_component_status
242bt_self_component_filter_add_output_port(
243 bt_self_component_filter *self_component,
244 const char *name, void *data,
245 bt_self_component_port_output **OUT);
246
247extern bt_self_component_port_input *
248bt_self_component_filter_borrow_input_port_by_name(
249 bt_self_component_filter *self_component,
250 const char *name);
251
252extern bt_self_component_port_input *
253bt_self_component_filter_borrow_input_port_by_index(
254 bt_self_component_filter *self_component,
255 uint64_t index);
256
257extern bt_self_component_status
258bt_self_component_filter_add_input_port(
259 bt_self_component_filter *self_component,
260 const char *name, void *data,
261 bt_self_component_port_input **OUT);
262
263/* From self-component-sink.h */
264
265bt_self_component *bt_self_component_sink_as_self_component(
266 bt_self_component_sink *self_comp_sink);
267
268const bt_component_sink *
269bt_self_component_sink_as_component_sink(
270 bt_self_component_sink *self_comp_sink);
271
272extern bt_self_component_port_input *
273bt_self_component_sink_borrow_input_port_by_name(
274 bt_self_component_sink *self_component,
275 const char *name);
276
277extern bt_self_component_port_input *
278bt_self_component_sink_borrow_input_port_by_index(
279 bt_self_component_sink *self_component, uint64_t index);
280
281extern bt_self_component_status
282bt_self_component_sink_add_input_port(
283 bt_self_component_sink *self_component,
284 const char *name, void *user_data,
285 bt_self_component_port_input **OUT);
This page took 0.032678 seconds and 4 git commands to generate.