Commit | Line | Data |
---|---|---|
5cd6d0e5 PP |
1 | #ifndef BABELTRACE_TRACE_IR_FIELD_CLASSES_H |
2 | #define BABELTRACE_TRACE_IR_FIELD_CLASSES_H | |
3 | ||
4 | /* | |
5cd6d0e5 PP |
5 | * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
6 | * | |
7 | * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
8 | * | |
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
10 | * of this software and associated documentation files (the "Software"), to deal | |
11 | * in the Software without restriction, including without limitation the rights | |
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
13 | * copies of the Software, and to permit persons to whom the Software is | |
14 | * furnished to do so, subject to the following conditions: | |
15 | * | |
16 | * The above copyright notice and this permission notice shall be included in | |
17 | * all copies or substantial portions of the Software. | |
18 | * | |
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
25 | * SOFTWARE. | |
26 | * | |
27 | * The Common Trace Format (CTF) Specification is available at | |
28 | * http://www.efficios.com/ctf | |
29 | */ | |
30 | ||
5cd6d0e5 PP |
31 | /* For bt_bool */ |
32 | #include <babeltrace/types.h> | |
33 | ||
34 | #include <stdint.h> | |
35 | #include <stddef.h> | |
36 | ||
37 | #ifdef __cplusplus | |
38 | extern "C" { | |
39 | #endif | |
40 | ||
41 | struct bt_field_class; | |
42 | struct bt_field_path; | |
43 | struct bt_field_class_signed_enumeration_mapping_ranges; | |
44 | struct bt_field_class_unsigned_enumeration_mapping_ranges; | |
45 | ||
46 | typedef const char * const *bt_field_class_enumeration_mapping_label_array; | |
47 | ||
864cad70 PP |
48 | enum bt_field_class_type { |
49 | BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER, | |
50 | BT_FIELD_CLASS_TYPE_SIGNED_INTEGER, | |
51 | BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, | |
52 | BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, | |
53 | BT_FIELD_CLASS_TYPE_REAL, | |
54 | BT_FIELD_CLASS_TYPE_STRING, | |
55 | BT_FIELD_CLASS_TYPE_STRUCTURE, | |
56 | BT_FIELD_CLASS_TYPE_STATIC_ARRAY, | |
57 | BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, | |
58 | BT_FIELD_CLASS_TYPE_VARIANT, | |
5cd6d0e5 PP |
59 | }; |
60 | ||
61 | enum bt_field_class_integer_preferred_display_base { | |
62 | BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY, | |
63 | BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL, | |
64 | BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL, | |
65 | BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL, | |
66 | }; | |
67 | ||
864cad70 | 68 | extern enum bt_field_class_type bt_field_class_get_type( |
5cd6d0e5 PP |
69 | struct bt_field_class *field_class); |
70 | ||
5cd6d0e5 PP |
71 | extern uint64_t bt_field_class_integer_get_field_value_range( |
72 | struct bt_field_class *field_class); | |
73 | ||
5cd6d0e5 PP |
74 | extern enum bt_field_class_integer_preferred_display_base |
75 | bt_field_class_integer_get_preferred_display_base( | |
76 | struct bt_field_class *field_class); | |
77 | ||
5cd6d0e5 PP |
78 | extern bt_bool bt_field_class_real_is_single_precision( |
79 | struct bt_field_class *field_class); | |
80 | ||
5cd6d0e5 PP |
81 | extern uint64_t bt_field_class_enumeration_get_mapping_count( |
82 | struct bt_field_class *field_class); | |
83 | ||
84 | extern void bt_field_class_unsigned_enumeration_borrow_mapping_by_index( | |
85 | struct bt_field_class *field_class, uint64_t index, | |
86 | const char **label, | |
87 | struct bt_field_class_unsigned_enumeration_mapping_ranges **ranges); | |
88 | ||
89 | extern void bt_field_class_signed_enumeration_borrow_mapping_by_index( | |
90 | struct bt_field_class *field_class, uint64_t index, | |
91 | const char **label, | |
92 | struct bt_field_class_signed_enumeration_mapping_ranges **ranges); | |
93 | ||
94 | extern uint64_t bt_field_class_unsigned_enumeration_mapping_ranges_get_range_count( | |
95 | struct bt_field_class_unsigned_enumeration_mapping_ranges *ranges); | |
96 | ||
97 | extern uint64_t bt_field_class_signed_enumeration_mapping_ranges_get_range_count( | |
98 | struct bt_field_class_signed_enumeration_mapping_ranges *ranges); | |
99 | ||
100 | extern void bt_field_class_unsigned_enumeration_mapping_ranges_get_range_by_index( | |
101 | struct bt_field_class_unsigned_enumeration_mapping_ranges *ranges, | |
102 | uint64_t index, uint64_t *lower, uint64_t *upper); | |
103 | ||
104 | extern void bt_field_class_signed_enumeration_mapping_ranges_get_range_by_index( | |
105 | struct bt_field_class_unsigned_enumeration_mapping_ranges *ranges, | |
106 | uint64_t index, int64_t *lower, int64_t *upper); | |
107 | ||
108 | extern int bt_field_class_unsigned_enumeration_get_mapping_labels_by_value( | |
109 | struct bt_field_class *field_class, uint64_t value, | |
110 | bt_field_class_enumeration_mapping_label_array *label_array, | |
111 | uint64_t *count); | |
112 | ||
113 | extern int bt_field_class_signed_enumeration_get_mapping_labels_by_value( | |
114 | struct bt_field_class *field_class, int64_t value, | |
115 | bt_field_class_enumeration_mapping_label_array *label_array, | |
116 | uint64_t *count); | |
117 | ||
5cd6d0e5 PP |
118 | extern uint64_t bt_field_class_structure_get_member_count( |
119 | struct bt_field_class *field_class); | |
120 | ||
121 | extern void bt_field_class_structure_borrow_member_by_index( | |
122 | struct bt_field_class *struct_field_class, uint64_t index, | |
123 | const char **name, struct bt_field_class **field_class); | |
124 | ||
125 | extern | |
126 | struct bt_field_class *bt_field_class_structure_borrow_member_field_class_by_name( | |
127 | struct bt_field_class *field_class, const char *name); | |
128 | ||
5cd6d0e5 PP |
129 | extern struct bt_field_class *bt_field_class_array_borrow_element_field_class( |
130 | struct bt_field_class *field_class); | |
131 | ||
132 | extern uint64_t bt_field_class_static_array_get_length( | |
133 | struct bt_field_class *field_class); | |
134 | ||
135 | extern struct bt_field_path * | |
136 | bt_field_class_dynamic_array_borrow_length_field_path( | |
137 | struct bt_field_class *field_class); | |
138 | ||
5cd6d0e5 PP |
139 | extern struct bt_field_path * |
140 | bt_field_class_variant_borrow_selector_field_path( | |
141 | struct bt_field_class *field_class); | |
142 | ||
5cd6d0e5 PP |
143 | extern uint64_t bt_field_class_variant_get_option_count( |
144 | struct bt_field_class *field_class); | |
145 | ||
146 | extern void bt_field_class_variant_borrow_option_by_index( | |
147 | struct bt_field_class *variant_field_class, uint64_t index, | |
148 | const char **name, struct bt_field_class **field_class); | |
149 | ||
150 | extern | |
151 | struct bt_field_class *bt_field_class_variant_borrow_option_field_class_by_name( | |
152 | struct bt_field_class *field_class, | |
153 | const char *name); | |
154 | ||
5cd6d0e5 PP |
155 | #ifdef __cplusplus |
156 | } | |
157 | #endif | |
158 | ||
159 | #endif /* BABELTRACE_TRACE_IR_FIELD_CLASSES_H */ |