1 #ifndef BABELTRACE_TRACE_IR_FIELD_CLASSES_CONST_H
2 #define BABELTRACE_TRACE_IR_FIELD_CLASSES_CONST_H
5 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
6 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 * The Common Trace Format (CTF) Specification is available at
27 * http://www.efficios.com/ctf
31 #include <babeltrace/types.h>
40 struct bt_field_class
;
42 struct bt_field_class_signed_enumeration_mapping_ranges
;
43 struct bt_field_class_unsigned_enumeration_mapping_ranges
;
45 typedef const char * const *bt_field_class_enumeration_mapping_label_array
;
47 enum bt_field_class_type
{
48 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER
,
49 BT_FIELD_CLASS_TYPE_SIGNED_INTEGER
,
50 BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION
,
51 BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION
,
52 BT_FIELD_CLASS_TYPE_REAL
,
53 BT_FIELD_CLASS_TYPE_STRING
,
54 BT_FIELD_CLASS_TYPE_STRUCTURE
,
55 BT_FIELD_CLASS_TYPE_STATIC_ARRAY
,
56 BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY
,
57 BT_FIELD_CLASS_TYPE_VARIANT
,
60 enum bt_field_class_integer_preferred_display_base
{
61 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY
,
62 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL
,
63 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL
,
64 BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL
,
67 extern enum bt_field_class_type
bt_field_class_get_type(
68 const struct bt_field_class
*field_class
);
70 extern uint64_t bt_field_class_integer_get_field_value_range(
71 const struct bt_field_class
*field_class
);
73 extern enum bt_field_class_integer_preferred_display_base
74 bt_field_class_integer_get_preferred_display_base(
75 const struct bt_field_class
*field_class
);
77 extern bt_bool
bt_field_class_real_is_single_precision(
78 const struct bt_field_class
*field_class
);
80 extern uint64_t bt_field_class_enumeration_get_mapping_count(
81 const struct bt_field_class
*field_class
);
83 extern void bt_field_class_unsigned_enumeration_borrow_mapping_by_index_const(
84 const struct bt_field_class
*field_class
, uint64_t index
,
86 const struct bt_field_class_unsigned_enumeration_mapping_ranges
**ranges
);
88 extern void bt_field_class_signed_enumeration_borrow_mapping_by_index_const(
89 const struct bt_field_class
*field_class
, uint64_t index
,
91 const struct bt_field_class_signed_enumeration_mapping_ranges
**ranges
);
94 bt_field_class_unsigned_enumeration_mapping_ranges_get_range_count(
95 const struct bt_field_class_unsigned_enumeration_mapping_ranges
*ranges
);
98 bt_field_class_signed_enumeration_mapping_ranges_get_range_count(
99 const struct bt_field_class_signed_enumeration_mapping_ranges
*ranges
);
102 bt_field_class_unsigned_enumeration_mapping_ranges_get_range_by_index(
103 const struct bt_field_class_unsigned_enumeration_mapping_ranges
*ranges
,
104 uint64_t index
, uint64_t *lower
, uint64_t *upper
);
107 bt_field_class_signed_enumeration_mapping_ranges_get_range_by_index(
108 const struct bt_field_class_unsigned_enumeration_mapping_ranges
*ranges
,
109 uint64_t index
, int64_t *lower
, int64_t *upper
);
111 extern int bt_field_class_unsigned_enumeration_get_mapping_labels_by_value(
112 const struct bt_field_class
*field_class
, uint64_t value
,
113 bt_field_class_enumeration_mapping_label_array
*label_array
,
116 extern int bt_field_class_signed_enumeration_get_mapping_labels_by_value(
117 const struct bt_field_class
*field_class
, int64_t value
,
118 bt_field_class_enumeration_mapping_label_array
*label_array
,
121 extern uint64_t bt_field_class_structure_get_member_count(
122 const struct bt_field_class
*field_class
);
124 extern void bt_field_class_structure_borrow_member_by_index_const(
125 const struct bt_field_class
*struct_field_class
, uint64_t index
,
126 const char **name
, const struct bt_field_class
**field_class
);
129 const struct bt_field_class
*
130 bt_field_class_structure_borrow_member_field_class_by_name_const(
131 const struct bt_field_class
*field_class
, const char *name
);
133 extern const struct bt_field_class
*
134 bt_field_class_array_borrow_element_field_class_const(
135 const struct bt_field_class
*field_class
);
137 extern uint64_t bt_field_class_static_array_get_length(
138 const struct bt_field_class
*field_class
);
140 extern const struct bt_field_path
*
141 bt_field_class_dynamic_array_borrow_length_field_path_const(
142 const struct bt_field_class
*field_class
);
144 extern const struct bt_field_path
*
145 bt_field_class_variant_borrow_selector_field_path_const(
146 const struct bt_field_class
*field_class
);
148 extern uint64_t bt_field_class_variant_get_option_count(
149 const struct bt_field_class
*field_class
);
151 extern void bt_field_class_variant_borrow_option_by_index_const(
152 const struct bt_field_class
*variant_field_class
, uint64_t index
,
153 const char **name
, const struct bt_field_class
**field_class
);
156 const struct bt_field_class
*
157 bt_field_class_variant_borrow_option_field_class_by_name_const(
158 const struct bt_field_class
*field_class
,
165 #endif /* BABELTRACE_TRACE_IR_FIELD_CLASSES_CONST_H */