bt2: let components attach "user data" to ports
[babeltrace.git] / bindings / python / bt2 / bt2 / native_bt_field_class.i
CommitLineData
6945df9a
SM
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2016 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%typemap(in, numinputs=0)
26 (bt_field_class_enumeration_mapping_label_array *LABELARRAY, uint64_t *LABELCOUNT)
27 (bt_field_class_enumeration_mapping_label_array temp_array, uint64_t temp_label_count = 0) {
28 $1 = &temp_array;
29 $2 = &temp_label_count;
30}
31
32%typemap(argout)
33 (bt_field_class_enumeration_mapping_label_array *LABELARRAY, uint64_t *LABELCOUNT) {
34 if (*$1) {
35 PyObject *py_label_list = PyList_New(*$2);
36 for (int i = 0; i < *$2; i++) {
37 PyList_SET_ITEM(py_label_list, i, PyUnicode_FromString((*$1)[i]));
38 }
39
40 $result = SWIG_Python_AppendOutput($result, py_label_list);
41 } else {
42 Py_INCREF(Py_None);
43 $result = SWIG_Python_AppendOutput($result, Py_None);
44 }
45}
46
47/* Output argument typemap for value output (always appends) */
48%typemap(in, numinputs=0)
49 (const bt_field_class_signed_enumeration_mapping_ranges **ENUM_RANGE_MAPPING)
50 (bt_field_class_signed_enumeration_mapping_ranges *temp_value = NULL) {
51 $1 = &temp_value;
52}
53
54%typemap(argout)
55 (const bt_field_class_signed_enumeration_mapping_ranges **ENUM_RANGE_MAPPING) {
56 if (*$1) {
57 /* SWIG_Python_AppendOutput() steals the created object */
58 $result = SWIG_Python_AppendOutput($result,
59 SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
60 SWIGTYPE_p_bt_field_class_signed_enumeration_mapping_ranges, 0));
61 } else {
62 /* SWIG_Python_AppendOutput() steals Py_None */
63 Py_INCREF(Py_None);
64 $result = SWIG_Python_AppendOutput($result, Py_None);
65 }
66}
67
68/* Output argument typemap for value output (always appends) */
69%typemap(in, numinputs=0)
70 (const bt_field_class_unsigned_enumeration_mapping_ranges **ENUM_RANGE_MAPPING)
71 (bt_field_class_unsigned_enumeration_mapping_ranges *temp_value = NULL) {
72 $1 = &temp_value;
73}
74
75%typemap(argout)
76 (const bt_field_class_unsigned_enumeration_mapping_ranges **ENUM_RANGE_MAPPING ) {
77 if (*$1) {
78 /* SWIG_Python_AppendOutput() steals the created object */
79 $result = SWIG_Python_AppendOutput($result,
80 SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
81 SWIGTYPE_p_bt_field_class_unsigned_enumeration_mapping_ranges, 0));
82 } else {
83 /* SWIG_Python_AppendOutput() steals Py_None */
84 Py_INCREF(Py_None);
85 $result = SWIG_Python_AppendOutput($result, Py_None);
86 }
87}
88
89/* From field-class-const.h */
90
91typedef enum bt_field_class_status {
92 BT_FIELD_CLASS_STATUS_OK = 0,
93 BT_FIELD_CLASS_STATUS_NOMEM = -12,
94} bt_field_class_status;
95
96typedef enum bt_field_class_type {
97 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER,
98 BT_FIELD_CLASS_TYPE_SIGNED_INTEGER,
99 BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
100 BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
101 BT_FIELD_CLASS_TYPE_REAL,
102 BT_FIELD_CLASS_TYPE_STRING,
103 BT_FIELD_CLASS_TYPE_STRUCTURE,
104 BT_FIELD_CLASS_TYPE_STATIC_ARRAY,
105 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
106 BT_FIELD_CLASS_TYPE_VARIANT,
107} bt_field_class_type;
108
109typedef enum bt_field_class_integer_preferred_display_base {
110 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY,
111 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL,
112 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL,
113 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL,
114} bt_field_class_integer_preferred_display_base;
115
116extern bt_field_class_type bt_field_class_get_type(
117 const bt_field_class *field_class);
118
119extern uint64_t bt_field_class_integer_get_field_value_range(
120 const bt_field_class *field_class);
121
122extern bt_field_class_integer_preferred_display_base
123bt_field_class_integer_get_preferred_display_base(
124 const bt_field_class *field_class);
125
126extern bt_bool bt_field_class_real_is_single_precision(
127 const bt_field_class *field_class);
128
129extern uint64_t bt_field_class_enumeration_get_mapping_count(
130 const bt_field_class *field_class);
131
51c1116e
SM
132extern const bt_field_class_unsigned_enumeration_mapping *
133bt_field_class_unsigned_enumeration_borrow_mapping_by_index_const(
134 const bt_field_class *field_class, uint64_t index);
6945df9a 135
51c1116e
SM
136extern const bt_field_class_signed_enumeration_mapping *
137bt_field_class_signed_enumeration_borrow_mapping_by_index_const(
138 const bt_field_class *field_class, uint64_t index);
6945df9a 139
51c1116e
SM
140const bt_field_class_enumeration_mapping *
141bt_field_class_unsigned_enumeration_mapping_as_mapping_const(
142 const bt_field_class_unsigned_enumeration_mapping *mapping);
6945df9a 143
51c1116e
SM
144const bt_field_class_enumeration_mapping *
145bt_field_class_signed_enumeration_mapping_as_mapping_const(
146 const bt_field_class_signed_enumeration_mapping *mapping);
147
148extern const char *bt_field_class_enumeration_mapping_get_label(
149 const bt_field_class_enumeration_mapping *mapping);
150
151extern uint64_t bt_field_class_enumeration_mapping_get_range_count(
152 const bt_field_class_enumeration_mapping *mapping);
6945df9a
SM
153
154extern void
51c1116e
SM
155bt_field_class_unsigned_enumeration_mapping_get_range_by_index(
156 const bt_field_class_unsigned_enumeration_mapping *mapping,
6945df9a
SM
157 uint64_t index, uint64_t *OUT, uint64_t *OUT);
158
159extern void
51c1116e
SM
160bt_field_class_signed_enumeration_mapping_get_range_by_index(
161 const bt_field_class_signed_enumeration_mapping *mapping,
6945df9a
SM
162 uint64_t index, int64_t *OUT, int64_t *OUT);
163
164extern bt_field_class_status
165bt_field_class_unsigned_enumeration_get_mapping_labels_by_value(
166 const bt_field_class *field_class, uint64_t value,
167 bt_field_class_enumeration_mapping_label_array *LABELARRAY,
168 uint64_t *LABELCOUNT);
169
170extern bt_field_class_status
171bt_field_class_signed_enumeration_get_mapping_labels_by_value(
172 const bt_field_class *field_class, int64_t value,
173 bt_field_class_enumeration_mapping_label_array *LABELARRAY,
174 uint64_t *LABELCOUNT);
175
176extern uint64_t bt_field_class_structure_get_member_count(
177 const bt_field_class *field_class);
178
179extern const bt_field_class_structure_member *
180bt_field_class_structure_borrow_member_by_index_const(
181 const bt_field_class *field_class, uint64_t index);
182
183extern const bt_field_class_structure_member *
184bt_field_class_structure_borrow_member_by_name_const(
185 const bt_field_class *field_class, const char *name);
186
187extern const char *bt_field_class_structure_member_get_name(
188 const bt_field_class_structure_member *member);
189
190extern const bt_field_class *
191bt_field_class_structure_member_borrow_field_class_const(
192 const bt_field_class_structure_member *member);
193
194extern const bt_field_class *
195bt_field_class_array_borrow_element_field_class_const(
196 const bt_field_class *field_class);
197
198extern uint64_t bt_field_class_static_array_get_length(
199 const bt_field_class *field_class);
200
201extern const bt_field_path *
202bt_field_class_dynamic_array_borrow_length_field_path_const(
203 const bt_field_class *field_class);
204
205extern const bt_field_path *
206bt_field_class_variant_borrow_selector_field_path_const(
207 const bt_field_class *field_class);
208
209extern uint64_t bt_field_class_variant_get_option_count(
210 const bt_field_class *field_class);
211
212extern const bt_field_class_variant_option *
213bt_field_class_variant_borrow_option_by_index_const(
214 const bt_field_class *field_class, uint64_t index);
215
216extern const bt_field_class_variant_option *
217bt_field_class_variant_borrow_option_by_name_const(
218 const bt_field_class *field_class, const char *name);
219
220extern const char *bt_field_class_variant_option_get_name(
221 const bt_field_class_variant_option *option);
222
223extern const bt_field_class *
224bt_field_class_variant_option_borrow_field_class_const(
225 const bt_field_class_variant_option *option);
226
227extern void bt_field_class_get_ref(const bt_field_class *field_class);
228
229extern void bt_field_class_put_ref(const bt_field_class *field_class);
230
231/* From field-class.h */
232
233extern bt_field_class *bt_field_class_unsigned_integer_create(
234 bt_trace_class *trace_class);
235
236extern bt_field_class *bt_field_class_signed_integer_create(
237 bt_trace_class *trace_class);
238
239extern void bt_field_class_integer_set_field_value_range(
240 bt_field_class *field_class, uint64_t size);
241
242extern void bt_field_class_integer_set_preferred_display_base(
243 bt_field_class *field_class,
244 bt_field_class_integer_preferred_display_base base);
245
246extern bt_field_class *bt_field_class_real_create(bt_trace_class *trace_class);
247
248extern void bt_field_class_real_set_is_single_precision(
249 bt_field_class *field_class,
250 bt_bool is_single_precision);
251
252extern bt_field_class *bt_field_class_unsigned_enumeration_create(
253 bt_trace_class *trace_class);
254
255extern bt_field_class *bt_field_class_signed_enumeration_create(
256 bt_trace_class *trace_class);
257
258extern bt_field_class_status bt_field_class_unsigned_enumeration_map_range(
259 bt_field_class *field_class, const char *label,
260 uint64_t range_lower, uint64_t range_upper);
261
262extern bt_field_class_status bt_field_class_signed_enumeration_map_range(
263 bt_field_class *field_class, const char *label,
264 int64_t range_lower, int64_t range_upper);
265
266extern bt_field_class *bt_field_class_string_create(
267 bt_trace_class *trace_class);
268
269extern bt_field_class *bt_field_class_structure_create(
270 bt_trace_class *trace_class);
271
272extern bt_field_class_status bt_field_class_structure_append_member(
273 bt_field_class *struct_field_class,
274 const char *name, bt_field_class *field_class);
275
276extern bt_field_class_structure_member *
277bt_field_class_structure_borrow_member_by_index(
278 bt_field_class *field_class, uint64_t index);
279
280extern bt_field_class_structure_member *
281bt_field_class_structure_borrow_member_by_name(
282 bt_field_class *field_class, const char *name);
283
284extern bt_field_class *bt_field_class_static_array_create(
285 bt_trace_class *trace_class,
286 bt_field_class *elem_field_class, uint64_t length);
287
288extern bt_field_class *bt_field_class_dynamic_array_create(
289 bt_trace_class *trace_class,
290 bt_field_class *elem_field_class);
291
292extern bt_field_class *bt_field_class_array_borrow_element_field_class(
293 bt_field_class *field_class);
294
295extern bt_field_class_status
296bt_field_class_dynamic_array_set_length_field_class(
297 bt_field_class *field_class,
298 bt_field_class *length_field_class);
299
300extern bt_field_class *bt_field_class_variant_create(
301 bt_trace_class *trace_class);
302
303extern bt_field_class_status
304bt_field_class_variant_set_selector_field_class(bt_field_class *field_class,
305 bt_field_class *selector_field_class);
306
307extern bt_field_class_status bt_field_class_variant_append_option(
308 bt_field_class *var_field_class,
309 const char *name, bt_field_class *field_class);
310
311extern bt_field_class_variant_option *
312bt_field_class_variant_borrow_option_by_index(
313 bt_field_class *field_class, uint64_t index);
314
315extern bt_field_class_variant_option *
316bt_field_class_variant_borrow_option_by_name(
317 bt_field_class *field_class, char *name);
318
319extern bt_field_class *bt_field_class_variant_option_borrow_field_class(
320 bt_field_class_variant_option *option);
This page took 0.037564 seconds and 4 git commands to generate.