1 #ifndef BABELTRACE2_TRACE_IR_FIELD_CLASS_CONST_H
2 #define BABELTRACE2_TRACE_IR_FIELD_CLASS_CONST_H
5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 #ifndef __BT_IN_BABELTRACE_H
27 # error "Please include <babeltrace2/babeltrace.h> instead."
33 #include <babeltrace2/types.h>
39 typedef enum bt_field_class_type
{
40 BT_FIELD_CLASS_TYPE_BOOL
= 0,
41 BT_FIELD_CLASS_TYPE_BIT_ARRAY
= 1,
42 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER
= 2,
43 BT_FIELD_CLASS_TYPE_SIGNED_INTEGER
= 3,
44 BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION
= 4,
45 BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION
= 5,
46 BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL
= 6,
47 BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL
= 7,
48 BT_FIELD_CLASS_TYPE_STRING
= 8,
49 BT_FIELD_CLASS_TYPE_STRUCTURE
= 9,
50 BT_FIELD_CLASS_TYPE_STATIC_ARRAY
= 10,
51 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD
= 11,
52 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD
= 12,
53 BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD
= 13,
54 BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD
= 14,
55 BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD
= 15,
56 BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD
= 16,
57 BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD
= 17,
58 BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD
= 18,
59 BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD
= 19,
60 } bt_field_class_type
;
62 typedef enum bt_field_class_integer_preferred_display_base
{
63 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY
= 2,
64 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL
= 8,
65 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
= 10,
66 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL
= 16,
67 } bt_field_class_integer_preferred_display_base
;
69 extern bt_field_class_type
bt_field_class_get_type(
70 const bt_field_class
*field_class
);
72 extern const bt_value
*bt_field_class_borrow_user_attributes_const(
73 const bt_field_class
*field_class
);
75 extern uint64_t bt_field_class_bit_array_get_length(
76 const bt_field_class
*field_class
);
78 extern uint64_t bt_field_class_integer_get_field_value_range(
79 const bt_field_class
*field_class
);
81 extern bt_field_class_integer_preferred_display_base
82 bt_field_class_integer_get_preferred_display_base(
83 const bt_field_class
*field_class
);
85 extern uint64_t bt_field_class_enumeration_get_mapping_count(
86 const bt_field_class
*field_class
);
88 extern const bt_field_class_enumeration_unsigned_mapping
*
89 bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const(
90 const bt_field_class
*field_class
, uint64_t index
);
92 extern const bt_field_class_enumeration_unsigned_mapping
*
93 bt_field_class_enumeration_unsigned_borrow_mapping_by_label_const(
94 const bt_field_class
*field_class
, const char *label
);
96 extern const bt_field_class_enumeration_signed_mapping
*
97 bt_field_class_enumeration_signed_borrow_mapping_by_index_const(
98 const bt_field_class
*field_class
, uint64_t index
);
100 extern const bt_field_class_enumeration_signed_mapping
*
101 bt_field_class_enumeration_signed_borrow_mapping_by_label_const(
102 const bt_field_class
*field_class
, const char *label
);
105 const bt_field_class_enumeration_mapping
*
106 bt_field_class_enumeration_unsigned_mapping_as_mapping_const(
107 const bt_field_class_enumeration_unsigned_mapping
*mapping
)
109 return __BT_UPCAST_CONST(bt_field_class_enumeration_mapping
, mapping
);
113 const bt_field_class_enumeration_mapping
*
114 bt_field_class_enumeration_signed_mapping_as_mapping_const(
115 const bt_field_class_enumeration_signed_mapping
*mapping
)
117 return __BT_UPCAST_CONST(bt_field_class_enumeration_mapping
, mapping
);
120 extern const char *bt_field_class_enumeration_mapping_get_label(
121 const bt_field_class_enumeration_mapping
*mapping
);
123 extern const bt_integer_range_set_unsigned
*
124 bt_field_class_enumeration_unsigned_mapping_borrow_ranges_const(
125 const bt_field_class_enumeration_unsigned_mapping
*mapping
);
127 extern const bt_integer_range_set_signed
*
128 bt_field_class_enumeration_signed_mapping_borrow_ranges_const(
129 const bt_field_class_enumeration_signed_mapping
*mapping
);
131 typedef enum bt_field_class_enumeration_get_mapping_labels_for_value_status
{
132 BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
133 BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK
= __BT_FUNC_STATUS_OK
,
134 } bt_field_class_enumeration_get_mapping_labels_for_value_status
;
136 extern bt_field_class_enumeration_get_mapping_labels_for_value_status
137 bt_field_class_enumeration_unsigned_get_mapping_labels_for_value(
138 const bt_field_class
*field_class
, uint64_t value
,
139 bt_field_class_enumeration_mapping_label_array
*label_array
,
142 extern bt_field_class_enumeration_get_mapping_labels_for_value_status
143 bt_field_class_enumeration_signed_get_mapping_labels_for_value(
144 const bt_field_class
*field_class
, int64_t value
,
145 bt_field_class_enumeration_mapping_label_array
*label_array
,
148 extern uint64_t bt_field_class_structure_get_member_count(
149 const bt_field_class
*field_class
);
151 extern const bt_field_class_structure_member
*
152 bt_field_class_structure_borrow_member_by_index_const(
153 const bt_field_class
*field_class
, uint64_t index
);
155 extern const bt_field_class_structure_member
*
156 bt_field_class_structure_borrow_member_by_name_const(
157 const bt_field_class
*field_class
, const char *name
);
159 extern const char *bt_field_class_structure_member_get_name(
160 const bt_field_class_structure_member
*member
);
162 extern const bt_field_class
*
163 bt_field_class_structure_member_borrow_field_class_const(
164 const bt_field_class_structure_member
*member
);
166 extern const bt_value
*bt_field_class_structure_member_borrow_user_attributes_const(
167 const bt_field_class_structure_member
*member
);
169 extern const bt_field_class
*
170 bt_field_class_array_borrow_element_field_class_const(
171 const bt_field_class
*field_class
);
173 extern uint64_t bt_field_class_array_static_get_length(
174 const bt_field_class
*field_class
);
176 extern const bt_field_path
*
177 bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const(
178 const bt_field_class
*field_class
);
180 extern const bt_field_class
*
181 bt_field_class_option_borrow_field_class_const(
182 const bt_field_class
*field_class
);
184 extern const bt_field_path
*
185 bt_field_class_option_with_selector_field_borrow_selector_field_path_const(
186 const bt_field_class
*field_class
);
189 bt_field_class_option_with_selector_field_bool_selector_is_reversed(
190 const bt_field_class
*field_class
);
192 extern const bt_integer_range_set_unsigned
*
193 bt_field_class_option_with_selector_field_integer_unsigned_borrow_selector_ranges_const(
194 const bt_field_class
*field_class
);
196 extern const bt_integer_range_set_signed
*
197 bt_field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_const(
198 const bt_field_class
*field_class
);
200 extern uint64_t bt_field_class_variant_get_option_count(
201 const bt_field_class
*field_class
);
203 extern const bt_field_class_variant_option
*
204 bt_field_class_variant_borrow_option_by_index_const(
205 const bt_field_class
*field_class
, uint64_t index
);
207 extern const bt_field_class_variant_option
*
208 bt_field_class_variant_borrow_option_by_name_const(
209 const bt_field_class
*field_class
, const char *name
);
211 extern const bt_field_class_variant_with_selector_field_integer_unsigned_option
*
212 bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_index_const(
213 const bt_field_class
*field_class
, uint64_t index
);
215 extern const bt_field_class_variant_with_selector_field_integer_unsigned_option
*
216 bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const(
217 const bt_field_class
*field_class
, const char *name
);
219 extern const bt_field_class_variant_with_selector_field_integer_signed_option
*
220 bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_index_const(
221 const bt_field_class
*field_class
, uint64_t index
);
223 extern const bt_field_class_variant_with_selector_field_integer_signed_option
*
224 bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const(
225 const bt_field_class
*field_class
, const char *name
);
227 extern const char *bt_field_class_variant_option_get_name(
228 const bt_field_class_variant_option
*option
);
230 extern const bt_field_class
*
231 bt_field_class_variant_option_borrow_field_class_const(
232 const bt_field_class_variant_option
*option
);
234 extern const bt_value
*bt_field_class_variant_option_borrow_user_attributes_const(
235 const bt_field_class_variant_option
*option
);
237 extern const bt_field_path
*
238 bt_field_class_variant_with_selector_field_borrow_selector_field_path_const(
239 const bt_field_class
*field_class
);
241 extern const bt_integer_range_set_unsigned
*
242 bt_field_class_variant_with_selector_field_integer_unsigned_option_borrow_ranges_const(
243 const bt_field_class_variant_with_selector_field_integer_unsigned_option
*option
);
246 const bt_field_class_variant_option
*
247 bt_field_class_variant_with_selector_field_integer_unsigned_option_as_option_const(
248 const bt_field_class_variant_with_selector_field_integer_unsigned_option
*option
)
250 return __BT_UPCAST_CONST(bt_field_class_variant_option
, option
);
253 extern const bt_integer_range_set_signed
*
254 bt_field_class_variant_with_selector_field_integer_signed_option_borrow_ranges_const(
255 const bt_field_class_variant_with_selector_field_integer_signed_option
*option
);
258 const bt_field_class_variant_option
*
259 bt_field_class_variant_with_selector_field_integer_signed_option_as_option_const(
260 const bt_field_class_variant_with_selector_field_integer_signed_option
*option
)
262 return __BT_UPCAST_CONST(bt_field_class_variant_option
, option
);
265 extern void bt_field_class_get_ref(const bt_field_class
*field_class
);
267 extern void bt_field_class_put_ref(const bt_field_class
*field_class
);
269 #define BT_FIELD_CLASS_PUT_REF_AND_RESET(_var) \
271 bt_field_class_put_ref(_var); \
275 #define BT_FIELD_CLASS_MOVE_REF(_var_dst, _var_src) \
277 bt_field_class_put_ref(_var_dst); \
278 (_var_dst) = (_var_src); \
287 #endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_CONST_H */