| 1 | #ifndef BABELTRACE_TRACE_IR_FIELD_CLASSES_CONST_H |
| 2 | #define BABELTRACE_TRACE_IR_FIELD_CLASSES_CONST_H |
| 3 | |
| 4 | /* |
| 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 | |
| 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 | |
| 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, |
| 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 | |
| 68 | extern enum bt_field_class_type bt_field_class_get_type( |
| 69 | const struct bt_field_class *field_class); |
| 70 | |
| 71 | extern uint64_t bt_field_class_integer_get_field_value_range( |
| 72 | const struct bt_field_class *field_class); |
| 73 | |
| 74 | extern enum bt_field_class_integer_preferred_display_base |
| 75 | bt_field_class_integer_get_preferred_display_base( |
| 76 | const struct bt_field_class *field_class); |
| 77 | |
| 78 | extern bt_bool bt_field_class_real_is_single_precision( |
| 79 | const struct bt_field_class *field_class); |
| 80 | |
| 81 | extern uint64_t bt_field_class_enumeration_get_mapping_count( |
| 82 | const struct bt_field_class *field_class); |
| 83 | |
| 84 | extern void bt_field_class_unsigned_enumeration_borrow_mapping_by_index_const( |
| 85 | const struct bt_field_class *field_class, uint64_t index, |
| 86 | const char **label, |
| 87 | const struct bt_field_class_unsigned_enumeration_mapping_ranges **ranges); |
| 88 | |
| 89 | extern void bt_field_class_signed_enumeration_borrow_mapping_by_index_const( |
| 90 | const struct bt_field_class *field_class, uint64_t index, |
| 91 | const char **label, |
| 92 | const struct bt_field_class_signed_enumeration_mapping_ranges **ranges); |
| 93 | |
| 94 | extern uint64_t |
| 95 | bt_field_class_unsigned_enumeration_mapping_ranges_get_range_count( |
| 96 | const struct bt_field_class_unsigned_enumeration_mapping_ranges *ranges); |
| 97 | |
| 98 | extern uint64_t |
| 99 | bt_field_class_signed_enumeration_mapping_ranges_get_range_count( |
| 100 | const struct bt_field_class_signed_enumeration_mapping_ranges *ranges); |
| 101 | |
| 102 | extern void |
| 103 | bt_field_class_unsigned_enumeration_mapping_ranges_get_range_by_index( |
| 104 | const struct bt_field_class_unsigned_enumeration_mapping_ranges *ranges, |
| 105 | uint64_t index, uint64_t *lower, uint64_t *upper); |
| 106 | |
| 107 | extern void |
| 108 | bt_field_class_signed_enumeration_mapping_ranges_get_range_by_index( |
| 109 | const struct bt_field_class_unsigned_enumeration_mapping_ranges *ranges, |
| 110 | uint64_t index, int64_t *lower, int64_t *upper); |
| 111 | |
| 112 | extern int bt_field_class_unsigned_enumeration_get_mapping_labels_by_value( |
| 113 | const struct bt_field_class *field_class, uint64_t value, |
| 114 | bt_field_class_enumeration_mapping_label_array *label_array, |
| 115 | uint64_t *count); |
| 116 | |
| 117 | extern int bt_field_class_signed_enumeration_get_mapping_labels_by_value( |
| 118 | const struct bt_field_class *field_class, int64_t value, |
| 119 | bt_field_class_enumeration_mapping_label_array *label_array, |
| 120 | uint64_t *count); |
| 121 | |
| 122 | extern uint64_t bt_field_class_structure_get_member_count( |
| 123 | const struct bt_field_class *field_class); |
| 124 | |
| 125 | extern void bt_field_class_structure_borrow_member_by_index_const( |
| 126 | const struct bt_field_class *struct_field_class, uint64_t index, |
| 127 | const char **name, const struct bt_field_class **field_class); |
| 128 | |
| 129 | extern |
| 130 | const struct bt_field_class * |
| 131 | bt_field_class_structure_borrow_member_field_class_by_name_const( |
| 132 | const struct bt_field_class *field_class, const char *name); |
| 133 | |
| 134 | extern const struct bt_field_class * |
| 135 | bt_field_class_array_borrow_element_field_class_const( |
| 136 | const struct bt_field_class *field_class); |
| 137 | |
| 138 | extern uint64_t bt_field_class_static_array_get_length( |
| 139 | const struct bt_field_class *field_class); |
| 140 | |
| 141 | extern const struct bt_field_path * |
| 142 | bt_field_class_dynamic_array_borrow_length_field_path_const( |
| 143 | const struct bt_field_class *field_class); |
| 144 | |
| 145 | extern const struct bt_field_path * |
| 146 | bt_field_class_variant_borrow_selector_field_path_const( |
| 147 | const struct bt_field_class *field_class); |
| 148 | |
| 149 | extern uint64_t bt_field_class_variant_get_option_count( |
| 150 | const struct bt_field_class *field_class); |
| 151 | |
| 152 | extern void bt_field_class_variant_borrow_option_by_index_const( |
| 153 | const struct bt_field_class *variant_field_class, uint64_t index, |
| 154 | const char **name, const struct bt_field_class **field_class); |
| 155 | |
| 156 | extern |
| 157 | const struct bt_field_class * |
| 158 | bt_field_class_variant_borrow_option_field_class_by_name_const( |
| 159 | const struct bt_field_class *field_class, |
| 160 | const char *name); |
| 161 | |
| 162 | #ifdef __cplusplus |
| 163 | } |
| 164 | #endif |
| 165 | |
| 166 | #endif /* BABELTRACE_TRACE_IR_FIELD_CLASSES_CONST_H */ |