Rename: bt_put(), bt_get() -> bt_object_put_ref(), bt_object_get_ref()
[babeltrace.git] / include / babeltrace / trace-ir / field-classes.h
1 #ifndef BABELTRACE_TRACE_IR_FIELD_CLASSES_H
2 #define BABELTRACE_TRACE_IR_FIELD_CLASSES_H
3
4 /*
5 * BabelTrace - Trace IR: Event field classes
6 *
7 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
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
33 /* For bt_object_get_ref() */
34 #include <babeltrace/object.h>
35
36 /* For bt_bool */
37 #include <babeltrace/types.h>
38
39 #include <stdint.h>
40 #include <stddef.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 struct bt_field_class;
47 struct bt_field_path;
48 struct bt_field_class_signed_enumeration_mapping_ranges;
49 struct bt_field_class_unsigned_enumeration_mapping_ranges;
50
51 typedef const char * const *bt_field_class_enumeration_mapping_label_array;
52
53 enum bt_field_class_type {
54 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER,
55 BT_FIELD_CLASS_TYPE_SIGNED_INTEGER,
56 BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
57 BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
58 BT_FIELD_CLASS_TYPE_REAL,
59 BT_FIELD_CLASS_TYPE_STRING,
60 BT_FIELD_CLASS_TYPE_STRUCTURE,
61 BT_FIELD_CLASS_TYPE_STATIC_ARRAY,
62 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
63 BT_FIELD_CLASS_TYPE_VARIANT,
64 };
65
66 enum bt_field_class_integer_preferred_display_base {
67 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY,
68 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL,
69 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL,
70 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL,
71 };
72
73 extern enum bt_field_class_type bt_field_class_get_type(
74 struct bt_field_class *field_class);
75
76 extern struct bt_field_class *bt_field_class_unsigned_integer_create(void);
77
78 extern struct bt_field_class *bt_field_class_signed_integer_create(void);
79
80 extern uint64_t bt_field_class_integer_get_field_value_range(
81 struct bt_field_class *field_class);
82
83 extern int bt_field_class_integer_set_field_value_range(
84 struct bt_field_class *field_class, uint64_t size);
85
86 extern enum bt_field_class_integer_preferred_display_base
87 bt_field_class_integer_get_preferred_display_base(
88 struct bt_field_class *field_class);
89
90 extern int bt_field_class_integer_set_preferred_display_base(
91 struct bt_field_class *field_class,
92 enum bt_field_class_integer_preferred_display_base base);
93
94 extern struct bt_field_class *bt_field_class_real_create(void);
95
96 extern bt_bool bt_field_class_real_is_single_precision(
97 struct bt_field_class *field_class);
98
99 extern int bt_field_class_real_set_is_single_precision(
100 struct bt_field_class *field_class,
101 bt_bool is_single_precision);
102
103 extern struct bt_field_class *bt_field_class_unsigned_enumeration_create(void);
104
105 extern struct bt_field_class *bt_field_class_signed_enumeration_create(void);
106
107 extern uint64_t bt_field_class_enumeration_get_mapping_count(
108 struct bt_field_class *field_class);
109
110 extern void bt_field_class_unsigned_enumeration_borrow_mapping_by_index(
111 struct bt_field_class *field_class, uint64_t index,
112 const char **label,
113 struct bt_field_class_unsigned_enumeration_mapping_ranges **ranges);
114
115 extern void bt_field_class_signed_enumeration_borrow_mapping_by_index(
116 struct bt_field_class *field_class, uint64_t index,
117 const char **label,
118 struct bt_field_class_signed_enumeration_mapping_ranges **ranges);
119
120 extern uint64_t bt_field_class_unsigned_enumeration_mapping_ranges_get_range_count(
121 struct bt_field_class_unsigned_enumeration_mapping_ranges *ranges);
122
123 extern uint64_t bt_field_class_signed_enumeration_mapping_ranges_get_range_count(
124 struct bt_field_class_signed_enumeration_mapping_ranges *ranges);
125
126 extern void bt_field_class_unsigned_enumeration_mapping_ranges_get_range_by_index(
127 struct bt_field_class_unsigned_enumeration_mapping_ranges *ranges,
128 uint64_t index, uint64_t *lower, uint64_t *upper);
129
130 extern void bt_field_class_signed_enumeration_mapping_ranges_get_range_by_index(
131 struct bt_field_class_unsigned_enumeration_mapping_ranges *ranges,
132 uint64_t index, int64_t *lower, int64_t *upper);
133
134 extern int bt_field_class_unsigned_enumeration_get_mapping_labels_by_value(
135 struct bt_field_class *field_class, uint64_t value,
136 bt_field_class_enumeration_mapping_label_array *label_array,
137 uint64_t *count);
138
139 extern int bt_field_class_signed_enumeration_get_mapping_labels_by_value(
140 struct bt_field_class *field_class, int64_t value,
141 bt_field_class_enumeration_mapping_label_array *label_array,
142 uint64_t *count);
143
144 extern int bt_field_class_unsigned_enumeration_map_range(
145 struct bt_field_class *field_class, const char *label,
146 uint64_t range_lower, uint64_t range_upper);
147
148 extern int bt_field_class_signed_enumeration_map_range(
149 struct bt_field_class *field_class, const char *label,
150 int64_t range_lower, int64_t range_upper);
151
152 extern struct bt_field_class *bt_field_class_string_create(void);
153
154 extern struct bt_field_class *bt_field_class_structure_create(void);
155
156 extern uint64_t bt_field_class_structure_get_member_count(
157 struct bt_field_class *field_class);
158
159 extern void bt_field_class_structure_borrow_member_by_index(
160 struct bt_field_class *struct_field_class, uint64_t index,
161 const char **name, struct bt_field_class **field_class);
162
163 extern
164 struct bt_field_class *bt_field_class_structure_borrow_member_field_class_by_name(
165 struct bt_field_class *field_class, const char *name);
166
167 extern int bt_field_class_structure_append_member(
168 struct bt_field_class *struct_field_class, const char *name,
169 struct bt_field_class *field_class);
170
171 extern struct bt_field_class *bt_field_class_static_array_create(
172 struct bt_field_class *elem_field_class,
173 uint64_t length);
174
175 extern struct bt_field_class *bt_field_class_dynamic_array_create(
176 struct bt_field_class *elem_field_class);
177
178 extern struct bt_field_class *bt_field_class_array_borrow_element_field_class(
179 struct bt_field_class *field_class);
180
181 extern uint64_t bt_field_class_static_array_get_length(
182 struct bt_field_class *field_class);
183
184 extern struct bt_field_path *
185 bt_field_class_dynamic_array_borrow_length_field_path(
186 struct bt_field_class *field_class);
187
188 extern int bt_field_class_dynamic_array_set_length_field_class(
189 struct bt_field_class *field_class,
190 struct bt_field_class *length_field_class);
191
192 extern struct bt_field_class *bt_field_class_variant_create(void);
193
194 extern struct bt_field_path *
195 bt_field_class_variant_borrow_selector_field_path(
196 struct bt_field_class *field_class);
197
198 extern int bt_field_class_variant_set_selector_field_class(
199 struct bt_field_class *field_class,
200 struct bt_field_class *selector_field_class);
201
202 extern uint64_t bt_field_class_variant_get_option_count(
203 struct bt_field_class *field_class);
204
205 extern void bt_field_class_variant_borrow_option_by_index(
206 struct bt_field_class *variant_field_class, uint64_t index,
207 const char **name, struct bt_field_class **field_class);
208
209 extern
210 struct bt_field_class *bt_field_class_variant_borrow_option_field_class_by_name(
211 struct bt_field_class *field_class,
212 const char *name);
213
214 extern int bt_field_class_variant_append_option(
215 struct bt_field_class *var_field_class,
216 const char *name, struct bt_field_class *field_class);
217
218 #ifdef __cplusplus
219 }
220 #endif
221
222 #endif /* BABELTRACE_TRACE_IR_FIELD_CLASSES_H */
This page took 0.032944 seconds and 4 git commands to generate.