bindings/python/bt2: Make the bt2 Python bindings build
[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
132extern void bt_field_class_unsigned_enumeration_borrow_mapping_by_index_const(
133 const bt_field_class *field_class, uint64_t index,
134 const char **OUT,
135 const bt_field_class_unsigned_enumeration_mapping_ranges **ENUM_RANGE_MAPPING);
136
137extern void bt_field_class_signed_enumeration_borrow_mapping_by_index_const(
138 const bt_field_class *field_class, uint64_t index,
139 const char **OUT,
140 const bt_field_class_signed_enumeration_mapping_ranges **ENUM_RANGE_MAPPING);
141
142extern uint64_t
143bt_field_class_unsigned_enumeration_mapping_ranges_get_range_count(
144 const bt_field_class_unsigned_enumeration_mapping_ranges *ranges);
145
146extern uint64_t
147bt_field_class_signed_enumeration_mapping_ranges_get_range_count(
148 const bt_field_class_signed_enumeration_mapping_ranges *ranges);
149
150extern void
151bt_field_class_unsigned_enumeration_mapping_ranges_get_range_by_index(
152 const bt_field_class_unsigned_enumeration_mapping_ranges *ranges,
153 uint64_t index, uint64_t *OUT, uint64_t *OUT);
154
155extern void
156bt_field_class_signed_enumeration_mapping_ranges_get_range_by_index(
157 const bt_field_class_signed_enumeration_mapping_ranges *ranges,
158 uint64_t index, int64_t *OUT, int64_t *OUT);
159
160extern bt_field_class_status
161bt_field_class_unsigned_enumeration_get_mapping_labels_by_value(
162 const bt_field_class *field_class, uint64_t value,
163 bt_field_class_enumeration_mapping_label_array *LABELARRAY,
164 uint64_t *LABELCOUNT);
165
166extern bt_field_class_status
167bt_field_class_signed_enumeration_get_mapping_labels_by_value(
168 const bt_field_class *field_class, int64_t value,
169 bt_field_class_enumeration_mapping_label_array *LABELARRAY,
170 uint64_t *LABELCOUNT);
171
172extern uint64_t bt_field_class_structure_get_member_count(
173 const bt_field_class *field_class);
174
175extern const bt_field_class_structure_member *
176bt_field_class_structure_borrow_member_by_index_const(
177 const bt_field_class *field_class, uint64_t index);
178
179extern const bt_field_class_structure_member *
180bt_field_class_structure_borrow_member_by_name_const(
181 const bt_field_class *field_class, const char *name);
182
183extern const char *bt_field_class_structure_member_get_name(
184 const bt_field_class_structure_member *member);
185
186extern const bt_field_class *
187bt_field_class_structure_member_borrow_field_class_const(
188 const bt_field_class_structure_member *member);
189
190extern const bt_field_class *
191bt_field_class_array_borrow_element_field_class_const(
192 const bt_field_class *field_class);
193
194extern uint64_t bt_field_class_static_array_get_length(
195 const bt_field_class *field_class);
196
197extern const bt_field_path *
198bt_field_class_dynamic_array_borrow_length_field_path_const(
199 const bt_field_class *field_class);
200
201extern const bt_field_path *
202bt_field_class_variant_borrow_selector_field_path_const(
203 const bt_field_class *field_class);
204
205extern uint64_t bt_field_class_variant_get_option_count(
206 const bt_field_class *field_class);
207
208extern const bt_field_class_variant_option *
209bt_field_class_variant_borrow_option_by_index_const(
210 const bt_field_class *field_class, uint64_t index);
211
212extern const bt_field_class_variant_option *
213bt_field_class_variant_borrow_option_by_name_const(
214 const bt_field_class *field_class, const char *name);
215
216extern const char *bt_field_class_variant_option_get_name(
217 const bt_field_class_variant_option *option);
218
219extern const bt_field_class *
220bt_field_class_variant_option_borrow_field_class_const(
221 const bt_field_class_variant_option *option);
222
223extern void bt_field_class_get_ref(const bt_field_class *field_class);
224
225extern void bt_field_class_put_ref(const bt_field_class *field_class);
226
227/* From field-class.h */
228
229extern bt_field_class *bt_field_class_unsigned_integer_create(
230 bt_trace_class *trace_class);
231
232extern bt_field_class *bt_field_class_signed_integer_create(
233 bt_trace_class *trace_class);
234
235extern void bt_field_class_integer_set_field_value_range(
236 bt_field_class *field_class, uint64_t size);
237
238extern void bt_field_class_integer_set_preferred_display_base(
239 bt_field_class *field_class,
240 bt_field_class_integer_preferred_display_base base);
241
242extern bt_field_class *bt_field_class_real_create(bt_trace_class *trace_class);
243
244extern void bt_field_class_real_set_is_single_precision(
245 bt_field_class *field_class,
246 bt_bool is_single_precision);
247
248extern bt_field_class *bt_field_class_unsigned_enumeration_create(
249 bt_trace_class *trace_class);
250
251extern bt_field_class *bt_field_class_signed_enumeration_create(
252 bt_trace_class *trace_class);
253
254extern bt_field_class_status bt_field_class_unsigned_enumeration_map_range(
255 bt_field_class *field_class, const char *label,
256 uint64_t range_lower, uint64_t range_upper);
257
258extern bt_field_class_status bt_field_class_signed_enumeration_map_range(
259 bt_field_class *field_class, const char *label,
260 int64_t range_lower, int64_t range_upper);
261
262extern bt_field_class *bt_field_class_string_create(
263 bt_trace_class *trace_class);
264
265extern bt_field_class *bt_field_class_structure_create(
266 bt_trace_class *trace_class);
267
268extern bt_field_class_status bt_field_class_structure_append_member(
269 bt_field_class *struct_field_class,
270 const char *name, bt_field_class *field_class);
271
272extern bt_field_class_structure_member *
273bt_field_class_structure_borrow_member_by_index(
274 bt_field_class *field_class, uint64_t index);
275
276extern bt_field_class_structure_member *
277bt_field_class_structure_borrow_member_by_name(
278 bt_field_class *field_class, const char *name);
279
280extern bt_field_class *bt_field_class_static_array_create(
281 bt_trace_class *trace_class,
282 bt_field_class *elem_field_class, uint64_t length);
283
284extern bt_field_class *bt_field_class_dynamic_array_create(
285 bt_trace_class *trace_class,
286 bt_field_class *elem_field_class);
287
288extern bt_field_class *bt_field_class_array_borrow_element_field_class(
289 bt_field_class *field_class);
290
291extern bt_field_class_status
292bt_field_class_dynamic_array_set_length_field_class(
293 bt_field_class *field_class,
294 bt_field_class *length_field_class);
295
296extern bt_field_class *bt_field_class_variant_create(
297 bt_trace_class *trace_class);
298
299extern bt_field_class_status
300bt_field_class_variant_set_selector_field_class(bt_field_class *field_class,
301 bt_field_class *selector_field_class);
302
303extern bt_field_class_status bt_field_class_variant_append_option(
304 bt_field_class *var_field_class,
305 const char *name, bt_field_class *field_class);
306
307extern bt_field_class_variant_option *
308bt_field_class_variant_borrow_option_by_index(
309 bt_field_class *field_class, uint64_t index);
310
311extern bt_field_class_variant_option *
312bt_field_class_variant_borrow_option_by_name(
313 bt_field_class *field_class, char *name);
314
315extern bt_field_class *bt_field_class_variant_option_borrow_field_class(
316 bt_field_class_variant_option *option);
This page took 0.037365 seconds and 4 git commands to generate.