Commit | Line | Data |
---|---|---|
3fd40f46 PP |
1 | #ifndef BABELTRACE2_TRACE_IR_FIELD_CLASS_H |
2 | #define BABELTRACE2_TRACE_IR_FIELD_CLASS_H | |
939190b3 PP |
3 | |
4 | /* | |
0dcb770f | 5 | * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation |
939190b3 | 6 | * |
939190b3 PP |
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: | |
13 | * | |
14 | * The above copyright notice and this permission notice shall be included in | |
15 | * all copies or substantial portions of the Software. | |
16 | * | |
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 | |
23 | * SOFTWARE. | |
939190b3 PP |
24 | */ |
25 | ||
9df34b44 PP |
26 | #ifndef __BT_IN_BABELTRACE_H |
27 | # error "Please include <babeltrace2/babeltrace.h> instead." | |
28 | #endif | |
29 | ||
fb25b9e3 PP |
30 | #include <stdint.h> |
31 | #include <stddef.h> | |
32 | ||
71c5da58 | 33 | #include <babeltrace2/types.h> |
71c5da58 | 34 | #include <babeltrace2/trace-ir/field-class-const.h> |
78cf9df6 | 35 | |
939190b3 PP |
36 | #ifdef __cplusplus |
37 | extern "C" { | |
38 | #endif | |
39 | ||
af90138b PP |
40 | extern void bt_field_class_set_user_attributes( |
41 | bt_field_class *field_class, const bt_value *user_attributes); | |
42 | ||
43 | extern bt_value *bt_field_class_borrow_user_attributes( | |
44 | bt_field_class *field_class); | |
45 | ||
9414b439 PP |
46 | extern bt_field_class *bt_field_class_bool_create( |
47 | bt_trace_class *trace_class); | |
48 | ||
6943da6a PP |
49 | extern bt_field_class *bt_field_class_bit_array_create( |
50 | bt_trace_class *trace_class, uint64_t length); | |
51 | ||
60bbfc7c | 52 | extern bt_field_class *bt_field_class_integer_unsigned_create( |
b7396828 | 53 | bt_trace_class *trace_class); |
939190b3 | 54 | |
60bbfc7c | 55 | extern bt_field_class *bt_field_class_integer_signed_create( |
b7396828 | 56 | bt_trace_class *trace_class); |
78cf9df6 PP |
57 | |
58 | extern void bt_field_class_integer_set_field_value_range( | |
8eee8ea2 | 59 | bt_field_class *field_class, uint64_t size); |
78cf9df6 PP |
60 | |
61 | extern void bt_field_class_integer_set_preferred_display_base( | |
8eee8ea2 | 62 | bt_field_class *field_class, |
ee78f405 | 63 | bt_field_class_integer_preferred_display_base base); |
78cf9df6 | 64 | |
76276a81 FD |
65 | extern bt_field_class *bt_field_class_real_single_precision_create( |
66 | bt_trace_class *trace_class); | |
78cf9df6 | 67 | |
76276a81 FD |
68 | extern bt_field_class *bt_field_class_real_double_precision_create( |
69 | bt_trace_class *trace_class); | |
78cf9df6 | 70 | |
60bbfc7c | 71 | extern bt_field_class *bt_field_class_enumeration_unsigned_create( |
b7396828 | 72 | bt_trace_class *trace_class); |
78cf9df6 | 73 | |
60bbfc7c | 74 | extern bt_field_class *bt_field_class_enumeration_signed_create( |
b7396828 | 75 | bt_trace_class *trace_class); |
78cf9df6 | 76 | |
02b61fe0 PP |
77 | typedef enum bt_field_class_enumeration_add_mapping_status { |
78 | BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
79 | BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK = __BT_FUNC_STATUS_OK, | |
80 | } bt_field_class_enumeration_add_mapping_status; | |
fb25b9e3 | 81 | |
02b61fe0 | 82 | extern bt_field_class_enumeration_add_mapping_status |
60bbfc7c | 83 | bt_field_class_enumeration_unsigned_add_mapping( |
8eee8ea2 | 84 | bt_field_class *field_class, const char *label, |
02b61fe0 | 85 | const bt_integer_range_set_unsigned *range_set); |
78cf9df6 | 86 | |
02b61fe0 | 87 | extern bt_field_class_enumeration_add_mapping_status |
60bbfc7c | 88 | bt_field_class_enumeration_signed_add_mapping( |
8eee8ea2 | 89 | bt_field_class *field_class, const char *label, |
02b61fe0 | 90 | const bt_integer_range_set_signed *range_set); |
78cf9df6 | 91 | |
b7396828 PP |
92 | extern bt_field_class *bt_field_class_string_create( |
93 | bt_trace_class *trace_class); | |
78cf9df6 | 94 | |
b7396828 PP |
95 | extern bt_field_class *bt_field_class_structure_create( |
96 | bt_trace_class *trace_class); | |
78cf9df6 | 97 | |
fb25b9e3 PP |
98 | typedef enum bt_field_class_structure_append_member_status { |
99 | BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
100 | BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK = __BT_FUNC_STATUS_OK, | |
101 | } bt_field_class_structure_append_member_status; | |
102 | ||
103 | extern bt_field_class_structure_append_member_status | |
104 | bt_field_class_structure_append_member( | |
8eee8ea2 PP |
105 | bt_field_class *struct_field_class, |
106 | const char *name, bt_field_class *field_class); | |
78cf9df6 | 107 | |
e24f271a PP |
108 | extern bt_field_class_structure_member * |
109 | bt_field_class_structure_borrow_member_by_index( | |
110 | bt_field_class *field_class, uint64_t index); | |
909d0a89 | 111 | |
e24f271a PP |
112 | extern bt_field_class_structure_member * |
113 | bt_field_class_structure_borrow_member_by_name( | |
909d0a89 PP |
114 | bt_field_class *field_class, const char *name); |
115 | ||
87040955 FD |
116 | extern bt_field_class * |
117 | bt_field_class_structure_member_borrow_field_class( | |
118 | bt_field_class_structure_member *member); | |
119 | ||
af90138b PP |
120 | extern bt_value *bt_field_class_structure_member_borrow_user_attributes( |
121 | bt_field_class_structure_member *member); | |
122 | ||
123 | extern void bt_field_class_structure_member_set_user_attributes( | |
124 | bt_field_class_structure_member *member, | |
125 | const bt_value *user_attributes); | |
126 | ||
60bbfc7c | 127 | extern bt_field_class *bt_field_class_array_static_create( |
b7396828 | 128 | bt_trace_class *trace_class, |
8eee8ea2 | 129 | bt_field_class *elem_field_class, uint64_t length); |
78cf9df6 | 130 | |
60bbfc7c | 131 | extern bt_field_class *bt_field_class_array_dynamic_create( |
b7396828 | 132 | bt_trace_class *trace_class, |
93d7d5d1 PP |
133 | bt_field_class *elem_field_class, |
134 | bt_field_class *length_field_class); | |
78cf9df6 | 135 | |
909d0a89 PP |
136 | extern bt_field_class *bt_field_class_array_borrow_element_field_class( |
137 | bt_field_class *field_class); | |
138 | ||
467673c1 PP |
139 | extern bt_field_class *bt_field_class_option_without_selector_create( |
140 | bt_trace_class *trace_class, | |
141 | bt_field_class *content_field_class); | |
142 | ||
8bc207af | 143 | extern bt_field_class *bt_field_class_option_with_selector_field_bool_create( |
247fa9e3 PP |
144 | bt_trace_class *trace_class, |
145 | bt_field_class *content_field_class, | |
146 | bt_field_class *selector_field_class); | |
147 | ||
8bc207af | 148 | extern void bt_field_class_option_with_selector_field_bool_set_selector_is_reversed( |
467673c1 PP |
149 | bt_field_class *field_class, bt_bool selector_is_reversed); |
150 | ||
151 | extern bt_field_class * | |
8bc207af | 152 | bt_field_class_option_with_selector_field_integer_unsigned_create( |
467673c1 PP |
153 | bt_trace_class *trace_class, |
154 | bt_field_class *content_field_class, | |
155 | bt_field_class *selector_field_class, | |
156 | const bt_integer_range_set_unsigned *range_set); | |
157 | ||
158 | extern bt_field_class * | |
8bc207af | 159 | bt_field_class_option_with_selector_field_integer_signed_create( |
467673c1 PP |
160 | bt_trace_class *trace_class, |
161 | bt_field_class *content_field_class, | |
162 | bt_field_class *selector_field_class, | |
163 | const bt_integer_range_set_signed *range_set); | |
164 | ||
87040955 FD |
165 | extern bt_field_class *bt_field_class_option_borrow_field_class( |
166 | bt_field_class *field_class); | |
167 | ||
b7396828 | 168 | extern bt_field_class *bt_field_class_variant_create( |
02b61fe0 | 169 | bt_trace_class *trace_class, |
8eee8ea2 | 170 | bt_field_class *selector_field_class); |
78cf9df6 | 171 | |
02b61fe0 | 172 | typedef enum bt_field_class_variant_without_selector_append_option_status { |
8bc207af PP |
173 | BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
174 | BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK, | |
02b61fe0 | 175 | } bt_field_class_variant_without_selector_append_option_status; |
fb25b9e3 | 176 | |
02b61fe0 PP |
177 | extern bt_field_class_variant_without_selector_append_option_status |
178 | bt_field_class_variant_without_selector_append_option( | |
179 | bt_field_class *var_field_class, const char *name, | |
180 | bt_field_class *field_class); | |
939190b3 | 181 | |
8bc207af PP |
182 | typedef enum bt_field_class_variant_with_selector_field_integer_append_option_status { |
183 | BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, | |
184 | BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK, | |
185 | } bt_field_class_variant_with_selector_field_integer_append_option_status; | |
909d0a89 | 186 | |
8bc207af PP |
187 | extern bt_field_class_variant_with_selector_field_integer_append_option_status |
188 | bt_field_class_variant_with_selector_field_integer_unsigned_append_option( | |
02b61fe0 PP |
189 | bt_field_class *var_field_class, const char *name, |
190 | bt_field_class *field_class, | |
191 | const bt_integer_range_set_unsigned *range_set); | |
e24f271a | 192 | |
8bc207af PP |
193 | extern bt_field_class_variant_with_selector_field_integer_append_option_status |
194 | bt_field_class_variant_with_selector_field_integer_signed_append_option( | |
02b61fe0 PP |
195 | bt_field_class *var_field_class, const char *name, |
196 | bt_field_class *field_class, | |
197 | const bt_integer_range_set_signed *range_set); | |
909d0a89 | 198 | |
34dd2c30 PP |
199 | extern bt_field_class_variant_option * |
200 | bt_field_class_variant_borrow_option_by_index( | |
201 | bt_field_class *field_class, uint64_t index); | |
202 | ||
203 | extern bt_field_class_variant_option * | |
204 | bt_field_class_variant_borrow_option_by_name( | |
205 | bt_field_class *field_class, const char *name); | |
206 | ||
87040955 FD |
207 | extern bt_field_class *bt_field_class_variant_option_borrow_field_class( |
208 | bt_field_class_variant_option *option); | |
209 | ||
af90138b PP |
210 | extern bt_value *bt_field_class_variant_option_borrow_user_attributes( |
211 | bt_field_class_variant_option *option); | |
212 | ||
213 | extern void bt_field_class_variant_option_set_user_attributes( | |
214 | bt_field_class_variant_option *option, | |
215 | const bt_value *user_attributes); | |
216 | ||
939190b3 PP |
217 | #ifdef __cplusplus |
218 | } | |
219 | #endif | |
220 | ||
3fd40f46 | 221 | #endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_H */ |