Add Babeltrace 2 Python bindings
[babeltrace.git] / bindings / python / bt2 / native_btft.i
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 %{
26 #include <babeltrace/ctf-ir/field-types.h>
27 %}
28
29 /* Type */
30 struct bt_ctf_field_type;
31
32 /* Common enumerations */
33 enum bt_ctf_scope {
34 BT_CTF_SCOPE_UNKNOWN = -1,
35 BT_CTF_SCOPE_TRACE_PACKET_HEADER = 1,
36 BT_CTF_SCOPE_STREAM_PACKET_CONTEXT = 2,
37 BT_CTF_SCOPE_STREAM_EVENT_HEADER = 3,
38 BT_CTF_SCOPE_STREAM_EVENT_CONTEXT = 4,
39 BT_CTF_SCOPE_EVENT_CONTEXT = 5,
40 BT_CTF_SCOPE_EVENT_PAYLOAD = 6,
41 BT_CTF_SCOPE_ENV = 0,
42 BT_CTF_SCOPE_EVENT_FIELDS = 6,
43 };
44
45 enum bt_ctf_type_id {
46 BT_CTF_TYPE_ID_UNKNOWN = CTF_TYPE_UNKNOWN,
47 BT_CTF_TYPE_ID_INTEGER = CTF_TYPE_INTEGER,
48 BT_CTF_TYPE_ID_FLOAT = CTF_TYPE_FLOAT,
49 BT_CTF_TYPE_ID_ENUM = CTF_TYPE_ENUM,
50 BT_CTF_TYPE_ID_STRING = CTF_TYPE_STRING,
51 BT_CTF_TYPE_ID_STRUCT = CTF_TYPE_STRUCT,
52 BT_CTF_TYPE_ID_UNTAGGED_VARIANT = CTF_TYPE_UNTAGGED_VARIANT,
53 BT_CTF_TYPE_ID_ARRAY = CTF_TYPE_ARRAY,
54 BT_CTF_TYPE_ID_SEQUENCE = CTF_TYPE_SEQUENCE,
55 BT_CTF_TYPE_ID_VARIANT = CTF_TYPE_VARIANT,
56 BT_CTF_NR_TYPE_IDS = NR_CTF_TYPES,
57 };
58
59 enum bt_ctf_byte_order {
60 BT_CTF_BYTE_ORDER_UNKNOWN = -1,
61 BT_CTF_BYTE_ORDER_NATIVE = 0,
62 BT_CTF_BYTE_ORDER_LITTLE_ENDIAN,
63 BT_CTF_BYTE_ORDER_BIG_ENDIAN,
64 BT_CTF_BYTE_ORDER_NETWORK,
65 };
66
67 enum bt_ctf_string_encoding {
68 BT_CTF_STRING_ENCODING_UNKNOWN = CTF_STRING_UNKNOWN,
69 BT_CTF_STRING_ENCODING_NONE = CTF_STRING_NONE,
70 BT_CTF_STRING_ENCODING_UTF8 = CTF_STRING_UTF8,
71 BT_CTF_STRING_ENCODING_ASCII = CTF_STRING_ASCII,
72 };
73
74 /* Common functions */
75 enum bt_ctf_type_id bt_ctf_field_type_get_type_id(
76 struct bt_ctf_field_type *field_type);
77 int bt_ctf_field_type_get_alignment(
78 struct bt_ctf_field_type *field_type);
79 int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *field_type,
80 unsigned int alignment);
81 enum bt_ctf_byte_order bt_ctf_field_type_get_byte_order(
82 struct bt_ctf_field_type *field_type);
83 int bt_ctf_field_type_set_byte_order(
84 struct bt_ctf_field_type *field_type,
85 enum bt_ctf_byte_order byte_order);
86 int bt_ctf_field_type_compare(struct bt_ctf_field_type *field_type_a,
87 struct bt_ctf_field_type *field_type_b);
88 struct bt_ctf_field_type *bt_ctf_field_type_copy(
89 struct bt_ctf_field_type *field_type);
90
91 /* Integer field type base enumeration */
92 enum bt_ctf_integer_base {
93 BT_CTF_INTEGER_BASE_UNKNOWN = -1,
94 BT_CTF_INTEGER_BASE_BINARY = 2,
95 BT_CTF_INTEGER_BASE_OCTAL = 8,
96 BT_CTF_INTEGER_BASE_DECIMAL = 10,
97 BT_CTF_INTEGER_BASE_HEXADECIMAL = 16,
98 };
99
100 /* Integer field type functions */
101 struct bt_ctf_field_type *bt_ctf_field_type_integer_create(
102 unsigned int size);
103 int bt_ctf_field_type_integer_get_size(
104 struct bt_ctf_field_type *int_field_type);
105 int bt_ctf_field_type_integer_get_signed(
106 struct bt_ctf_field_type *int_field_type);
107 int bt_ctf_field_type_integer_set_signed(
108 struct bt_ctf_field_type *int_field_type, int is_signed);
109 enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base(
110 struct bt_ctf_field_type *int_field_type);
111 int bt_ctf_field_type_integer_set_base(
112 struct bt_ctf_field_type *int_field_type,
113 enum bt_ctf_integer_base base);
114 enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
115 struct bt_ctf_field_type *int_field_type);
116 int bt_ctf_field_type_integer_set_encoding(
117 struct bt_ctf_field_type *int_field_type,
118 enum bt_ctf_string_encoding encoding);
119 struct bt_ctf_clock_class *bt_ctf_field_type_integer_get_mapped_clock_class(
120 struct bt_ctf_field_type *int_field_type);
121 int bt_ctf_field_type_integer_set_mapped_clock_class(
122 struct bt_ctf_field_type *int_field_type,
123 struct bt_ctf_clock_class *clock_class);
124
125 /* Floating point number field type functions */
126 struct bt_ctf_field_type *bt_ctf_field_type_floating_point_create(void);
127 int bt_ctf_field_type_floating_point_get_exponent_digits(
128 struct bt_ctf_field_type *float_field_type);
129 int bt_ctf_field_type_floating_point_set_exponent_digits(
130 struct bt_ctf_field_type *float_field_type,
131 unsigned int exponent_size);
132 int bt_ctf_field_type_floating_point_get_mantissa_digits(
133 struct bt_ctf_field_type *float_field_type);
134 int bt_ctf_field_type_floating_point_set_mantissa_digits(
135 struct bt_ctf_field_type *float_field_type,
136 unsigned int mantissa_sign_size);
137
138 /* Enumeration field type functions */
139 struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create(
140 struct bt_ctf_field_type *int_field_type);
141 struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_type(
142 struct bt_ctf_field_type *enum_field_type);
143 int bt_ctf_field_type_enumeration_get_mapping_count(
144 struct bt_ctf_field_type *enum_field_type);
145 int bt_ctf_field_type_enumeration_get_mapping_signed(
146 struct bt_ctf_field_type *enum_field_type, int index,
147 const char **BTOUTSTR, int64_t *OUTPUT, int64_t *OUTPUT);
148 int bt_ctf_field_type_enumeration_get_mapping_unsigned(
149 struct bt_ctf_field_type *enum_field_type, int index,
150 const char **BTOUTSTR, uint64_t *OUTPUT,
151 uint64_t *OUTPUT);
152 int bt_ctf_field_type_enumeration_add_mapping(
153 struct bt_ctf_field_type *enum_field_type, const char *name,
154 int64_t range_begin, int64_t range_end);
155 int bt_ctf_field_type_enumeration_add_mapping_unsigned(
156 struct bt_ctf_field_type *enum_field_type, const char *name,
157 uint64_t range_begin, uint64_t range_end);
158 struct bt_ctf_field_type_enumeration_mapping_iterator *
159 bt_ctf_field_type_enumeration_find_mappings_by_name(
160 struct bt_ctf_field_type *enum_field_type,
161 const char *name);
162 struct bt_ctf_field_type_enumeration_mapping_iterator *
163 bt_ctf_field_type_enumeration_find_mappings_by_signed_value(
164 struct bt_ctf_field_type *enum_field_type,
165 int64_t value);
166 struct bt_ctf_field_type_enumeration_mapping_iterator *
167 bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(
168 struct bt_ctf_field_type *enum_field_type,
169 uint64_t value);
170
171 /* Enumeration field type mapping iterator functions */
172 int bt_ctf_field_type_enumeration_mapping_iterator_get_signed(
173 struct bt_ctf_field_type_enumeration_mapping_iterator *iter,
174 const char **BTOUTSTR, int64_t *OUTPUT, int64_t *OUTPUT);
175 int bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned(
176 struct bt_ctf_field_type_enumeration_mapping_iterator *iter,
177 const char **BTOUTSTR, int64_t *OUTPUT, int64_t *OUTPUT);
178 int bt_ctf_field_type_enumeration_mapping_iterator_next(
179 struct bt_ctf_field_type_enumeration_mapping_iterator *iter);
180
181 /* String field type functions */
182 struct bt_ctf_field_type *bt_ctf_field_type_string_create(void);
183 enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding(
184 struct bt_ctf_field_type *string_field_type);
185 int bt_ctf_field_type_string_set_encoding(
186 struct bt_ctf_field_type *string_field_type,
187 enum bt_ctf_string_encoding encoding);
188
189 /* Structure field type functions */
190 struct bt_ctf_field_type *bt_ctf_field_type_structure_create(void);
191 int bt_ctf_field_type_structure_get_field_count(
192 struct bt_ctf_field_type *struct_field_type);
193 int bt_ctf_field_type_structure_get_field(
194 struct bt_ctf_field_type *struct_field_type,
195 const char **BTOUTSTR, struct bt_ctf_field_type **BTOUTFT,
196 int index);
197 struct bt_ctf_field_type *bt_ctf_field_type_structure_get_field_type_by_name(
198 struct bt_ctf_field_type *struct_field_type,
199 const char *field_name);
200 int bt_ctf_field_type_structure_add_field(
201 struct bt_ctf_field_type *struct_field_type,
202 struct bt_ctf_field_type *field_type,
203 const char *field_name);
204
205 /* Array field type functions */
206 struct bt_ctf_field_type *bt_ctf_field_type_array_create(
207 struct bt_ctf_field_type *element_field_type,
208 unsigned int length);
209 struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_type(
210 struct bt_ctf_field_type *array_field_type);
211 int64_t bt_ctf_field_type_array_get_length(
212 struct bt_ctf_field_type *array_field_type);
213
214 /* Sequence field type functions */
215 extern struct bt_ctf_field_type *bt_ctf_field_type_sequence_create(
216 struct bt_ctf_field_type *element_field_type,
217 const char *length_name);
218 extern struct bt_ctf_field_type *bt_ctf_field_type_sequence_get_element_type(
219 struct bt_ctf_field_type *sequence_field_type);
220 extern const char *bt_ctf_field_type_sequence_get_length_field_name(
221 struct bt_ctf_field_type *sequence_field_type);
222 extern struct bt_ctf_field_path *bt_ctf_field_type_sequence_get_length_field_path(
223 struct bt_ctf_field_type *sequence_field_type);
224
225 /* Variant field type functions */
226 struct bt_ctf_field_type *bt_ctf_field_type_variant_create(
227 struct bt_ctf_field_type *tag_field_type,
228 const char *tag_name);
229 struct bt_ctf_field_type *bt_ctf_field_type_variant_get_tag_type(
230 struct bt_ctf_field_type *variant_field_type);
231 const char *bt_ctf_field_type_variant_get_tag_name(
232 struct bt_ctf_field_type *variant_field_type);
233 int bt_ctf_field_type_variant_set_tag_name(
234 struct bt_ctf_field_type *variant_field_type,
235 const char *tag_name);
236 struct bt_ctf_field_path *bt_ctf_field_type_variant_get_tag_field_path(
237 struct bt_ctf_field_type *variant_field_type);
238 int bt_ctf_field_type_variant_get_field_count(
239 struct bt_ctf_field_type *variant_field_type);
240 int bt_ctf_field_type_variant_get_field(
241 struct bt_ctf_field_type *variant_field_type,
242 const char **BTOUTSTR,
243 struct bt_ctf_field_type **BTOUTFT, int index);
244 struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_by_name(
245 struct bt_ctf_field_type *variant_field_type,
246 const char *field_name);
247 int bt_ctf_field_type_variant_add_field(
248 struct bt_ctf_field_type *variant_field_type,
249 struct bt_ctf_field_type *field_type,
250 const char *field_name);
This page took 0.033836 seconds and 4 git commands to generate.