Commit | Line | Data |
---|---|---|
2e33ac5a PP |
1 | #ifndef BABELTRACE_CTF_IR_FIELD_TYPES_H |
2 | #define BABELTRACE_CTF_IR_FIELD_TYPES_H | |
adc315b8 JG |
3 | |
4 | /* | |
2e33ac5a | 5 | * BabelTrace - CTF IR: Event field types |
adc315b8 | 6 | * |
de9dd397 | 7 | * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
adc315b8 JG |
8 | * |
9 | * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
10 | * | |
11 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
12 | * of this software and associated documentation files (the "Software"), to deal | |
13 | * in the Software without restriction, including without limitation the rights | |
14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
15 | * copies of the Software, and to permit persons to whom the Software is | |
16 | * furnished to do so, subject to the following conditions: | |
17 | * | |
18 | * The above copyright notice and this permission notice shall be included in | |
19 | * all copies or substantial portions of the Software. | |
20 | * | |
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
27 | * SOFTWARE. | |
28 | * | |
29 | * The Common Trace Format (CTF) Specification is available at | |
30 | * http://www.efficios.com/ctf | |
31 | */ | |
32 | ||
094ff7c0 PP |
33 | /* For bt_get() */ |
34 | #include <babeltrace/ref.h> | |
35 | ||
9d408fca | 36 | /* For bt_bool */ |
c14d64fa | 37 | #include <babeltrace/types.h> |
9d408fca | 38 | |
adc315b8 | 39 | #include <stdint.h> |
c3c35de4 | 40 | #include <stddef.h> |
adc315b8 JG |
41 | |
42 | #ifdef __cplusplus | |
43 | extern "C" { | |
44 | #endif | |
45 | ||
50842bdc | 46 | struct bt_field_type; |
50842bdc | 47 | struct bt_field_path; |
44c440bc PP |
48 | struct bt_field_type_signed_enumeration_mapping_ranges; |
49 | struct bt_field_type_unsigned_enumeration_mapping_ranges; | |
78c8ab4f | 50 | |
44c440bc | 51 | typedef const char * const *bt_field_type_enumeration_mapping_label_array; |
78c8ab4f | 52 | |
50842bdc | 53 | enum bt_field_type_id { |
44c440bc PP |
54 | BT_FIELD_TYPE_ID_UNSIGNED_INTEGER, |
55 | BT_FIELD_TYPE_ID_SIGNED_INTEGER, | |
56 | BT_FIELD_TYPE_ID_UNSIGNED_ENUMERATION, | |
57 | BT_FIELD_TYPE_ID_SIGNED_ENUMERATION, | |
58 | BT_FIELD_TYPE_ID_REAL, | |
59 | BT_FIELD_TYPE_ID_STRING, | |
60 | BT_FIELD_TYPE_ID_STRUCTURE, | |
61 | BT_FIELD_TYPE_ID_STATIC_ARRAY, | |
62 | BT_FIELD_TYPE_ID_DYNAMIC_ARRAY, | |
63 | BT_FIELD_TYPE_ID_VARIANT, | |
adc315b8 JG |
64 | }; |
65 | ||
44c440bc PP |
66 | enum bt_field_type_integer_preferred_display_base { |
67 | BT_FIELD_TYPE_INTEGER_PREFERRED_DISPLAY_BASE_BINARY, | |
68 | BT_FIELD_TYPE_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL, | |
69 | BT_FIELD_TYPE_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL, | |
70 | BT_FIELD_TYPE_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL, | |
71 | }; | |
78c8ab4f | 72 | |
50842bdc PP |
73 | extern enum bt_field_type_id bt_field_type_get_type_id( |
74 | struct bt_field_type *field_type); | |
78c8ab4f | 75 | |
44c440bc | 76 | extern struct bt_field_type *bt_field_type_unsigned_integer_create(void); |
78c8ab4f | 77 | |
44c440bc | 78 | extern struct bt_field_type *bt_field_type_signed_integer_create(void); |
78c8ab4f | 79 | |
44c440bc | 80 | extern uint64_t bt_field_type_integer_get_field_value_range( |
50842bdc | 81 | struct bt_field_type *field_type); |
78c8ab4f | 82 | |
44c440bc PP |
83 | extern int bt_field_type_integer_set_field_value_range( |
84 | struct bt_field_type *field_type, uint64_t size); | |
78c8ab4f | 85 | |
44c440bc PP |
86 | extern enum bt_field_type_integer_preferred_display_base |
87 | bt_field_type_integer_get_preferred_display_base( | |
50842bdc | 88 | struct bt_field_type *field_type); |
78c8ab4f | 89 | |
44c440bc | 90 | extern int bt_field_type_integer_set_preferred_display_base( |
50842bdc | 91 | struct bt_field_type *field_type, |
44c440bc | 92 | enum bt_field_type_integer_preferred_display_base base); |
78c8ab4f | 93 | |
44c440bc | 94 | extern struct bt_field_type *bt_field_type_real_create(void); |
78c8ab4f | 95 | |
44c440bc | 96 | extern bt_bool bt_field_type_real_is_single_precision( |
50842bdc | 97 | struct bt_field_type *field_type); |
78c8ab4f | 98 | |
44c440bc PP |
99 | extern int bt_field_type_real_set_is_single_precision( |
100 | struct bt_field_type *field_type, | |
101 | bt_bool is_single_precision); | |
cfb61c11 | 102 | |
44c440bc | 103 | extern struct bt_field_type *bt_field_type_unsigned_enumeration_create(void); |
cfb61c11 | 104 | |
44c440bc | 105 | extern struct bt_field_type *bt_field_type_signed_enumeration_create(void); |
cfb61c11 | 106 | |
44c440bc PP |
107 | extern uint64_t bt_field_type_enumeration_get_mapping_count( |
108 | struct bt_field_type *field_type); | |
cfb61c11 | 109 | |
44c440bc PP |
110 | extern void bt_field_type_unsigned_enumeration_borrow_mapping_by_index( |
111 | struct bt_field_type *field_type, uint64_t index, | |
112 | const char **label, | |
113 | struct bt_field_type_unsigned_enumeration_mapping_ranges **ranges); | |
cfb61c11 | 114 | |
44c440bc PP |
115 | extern void bt_field_type_signed_enumeration_borrow_mapping_by_index( |
116 | struct bt_field_type *field_type, uint64_t index, | |
117 | const char **label, | |
118 | struct bt_field_type_signed_enumeration_mapping_ranges **ranges); | |
b92ddaaa | 119 | |
44c440bc PP |
120 | extern uint64_t bt_field_type_unsigned_enumeration_mapping_ranges_get_range_count( |
121 | struct bt_field_type_unsigned_enumeration_mapping_ranges *ranges); | |
adc315b8 | 122 | |
44c440bc PP |
123 | extern uint64_t bt_field_type_signed_enumeration_mapping_ranges_get_range_count( |
124 | struct bt_field_type_signed_enumeration_mapping_ranges *ranges); | |
adc315b8 | 125 | |
44c440bc PP |
126 | extern void bt_field_type_unsigned_enumeration_mapping_ranges_get_range_by_index( |
127 | struct bt_field_type_unsigned_enumeration_mapping_ranges *ranges, | |
128 | uint64_t index, uint64_t *lower, uint64_t *upper); | |
adc315b8 | 129 | |
44c440bc PP |
130 | extern void bt_field_type_signed_enumeration_mapping_ranges_get_range_by_index( |
131 | struct bt_field_type_unsigned_enumeration_mapping_ranges *ranges, | |
132 | uint64_t index, int64_t *lower, int64_t *upper); | |
78c8ab4f | 133 | |
44c440bc PP |
134 | extern int bt_field_type_unsigned_enumeration_get_mapping_labels_by_value( |
135 | struct bt_field_type *field_type, uint64_t value, | |
136 | bt_field_type_enumeration_mapping_label_array *label_array, | |
137 | uint64_t *count); | |
78c8ab4f | 138 | |
44c440bc PP |
139 | extern int bt_field_type_signed_enumeration_get_mapping_labels_by_value( |
140 | struct bt_field_type *field_type, int64_t value, | |
141 | bt_field_type_enumeration_mapping_label_array *label_array, | |
142 | uint64_t *count); | |
78c8ab4f | 143 | |
44c440bc PP |
144 | extern int bt_field_type_unsigned_enumeration_map_range( |
145 | struct bt_field_type *field_type, const char *label, | |
146 | uint64_t range_lower, uint64_t range_upper); | |
78c8ab4f | 147 | |
44c440bc PP |
148 | extern int bt_field_type_signed_enumeration_map_range( |
149 | struct bt_field_type *field_type, const char *label, | |
150 | int64_t range_lower, int64_t range_upper); | |
78c8ab4f | 151 | |
50842bdc | 152 | extern struct bt_field_type *bt_field_type_string_create(void); |
78c8ab4f | 153 | |
50842bdc | 154 | extern struct bt_field_type *bt_field_type_structure_create(void); |
78c8ab4f | 155 | |
44c440bc PP |
156 | extern uint64_t bt_field_type_structure_get_member_count( |
157 | struct bt_field_type *field_type); | |
094ff7c0 | 158 | |
44c440bc PP |
159 | extern void bt_field_type_structure_borrow_member_by_index( |
160 | struct bt_field_type *struct_field_type, uint64_t index, | |
161 | const char **name, struct bt_field_type **field_type); | |
094ff7c0 PP |
162 | |
163 | extern | |
44c440bc PP |
164 | struct bt_field_type *bt_field_type_structure_borrow_member_field_type_by_name( |
165 | struct bt_field_type *field_type, const char *name); | |
78c8ab4f | 166 | |
44c440bc PP |
167 | extern int bt_field_type_structure_append_member( |
168 | struct bt_field_type *struct_field_type, const char *name, | |
169 | struct bt_field_type *field_type); | |
78c8ab4f | 170 | |
44c440bc PP |
171 | extern struct bt_field_type *bt_field_type_static_array_create( |
172 | struct bt_field_type *elem_field_type, | |
173 | uint64_t length); | |
78c8ab4f | 174 | |
44c440bc PP |
175 | extern struct bt_field_type *bt_field_type_dynamic_array_create( |
176 | struct bt_field_type *elem_field_type); | |
b92ddaaa | 177 | |
094ff7c0 | 178 | extern struct bt_field_type *bt_field_type_array_borrow_element_field_type( |
44c440bc | 179 | struct bt_field_type *field_type); |
78c8ab4f | 180 | |
44c440bc PP |
181 | extern uint64_t bt_field_type_static_array_get_length( |
182 | struct bt_field_type *field_type); | |
094ff7c0 | 183 | |
44c440bc PP |
184 | extern struct bt_field_path * |
185 | bt_field_type_dynamic_array_borrow_length_field_path( | |
186 | struct bt_field_type *field_type); | |
094ff7c0 | 187 | |
44c440bc PP |
188 | extern int bt_field_type_dynamic_array_set_length_field_type( |
189 | struct bt_field_type *field_type, | |
190 | struct bt_field_type *length_field_type); | |
094ff7c0 | 191 | |
44c440bc | 192 | extern struct bt_field_type *bt_field_type_variant_create(void); |
56db8d7a | 193 | |
44c440bc PP |
194 | extern struct bt_field_path * |
195 | bt_field_type_variant_borrow_selector_field_path( | |
196 | struct bt_field_type *field_type); | |
78c8ab4f | 197 | |
44c440bc PP |
198 | extern int bt_field_type_variant_set_selector_field_type( |
199 | struct bt_field_type *field_type, | |
200 | struct bt_field_type *selector_field_type); | |
78c8ab4f | 201 | |
44c440bc PP |
202 | extern uint64_t bt_field_type_variant_get_option_count( |
203 | struct bt_field_type *field_type); | |
78c8ab4f | 204 | |
44c440bc PP |
205 | extern void bt_field_type_variant_borrow_option_by_index( |
206 | struct bt_field_type *variant_field_type, uint64_t index, | |
207 | const char **name, struct bt_field_type **field_type); | |
094ff7c0 PP |
208 | |
209 | extern | |
44c440bc | 210 | struct bt_field_type *bt_field_type_variant_borrow_option_field_type_by_name( |
50842bdc | 211 | struct bt_field_type *field_type, |
44c440bc | 212 | const char *name); |
78c8ab4f | 213 | |
44c440bc PP |
214 | extern int bt_field_type_variant_append_option( |
215 | struct bt_field_type *var_field_type, | |
216 | const char *name, struct bt_field_type *field_type); | |
56db8d7a | 217 | |
adc315b8 JG |
218 | #ifdef __cplusplus |
219 | } | |
220 | #endif | |
221 | ||
2e33ac5a | 222 | #endif /* BABELTRACE_CTF_IR_FIELD_TYPES_H */ |