| 1 | #ifndef BABELTRACE2_TRACE_IR_FIELD_CLASS_H |
| 2 | #define BABELTRACE2_TRACE_IR_FIELD_CLASS_H |
| 3 | |
| 4 | /* |
| 5 | * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation |
| 6 | * |
| 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. |
| 24 | */ |
| 25 | |
| 26 | #ifndef __BT_IN_BABELTRACE_H |
| 27 | # error "Please include <babeltrace2/babeltrace.h> instead." |
| 28 | #endif |
| 29 | |
| 30 | #include <stdint.h> |
| 31 | #include <stddef.h> |
| 32 | |
| 33 | #include <babeltrace2/types.h> |
| 34 | #include <babeltrace2/trace-ir/field-class-const.h> |
| 35 | |
| 36 | #ifdef __cplusplus |
| 37 | extern "C" { |
| 38 | #endif |
| 39 | |
| 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 | |
| 46 | extern bt_field_class *bt_field_class_bool_create( |
| 47 | bt_trace_class *trace_class); |
| 48 | |
| 49 | extern bt_field_class *bt_field_class_bit_array_create( |
| 50 | bt_trace_class *trace_class, uint64_t length); |
| 51 | |
| 52 | extern bt_field_class *bt_field_class_integer_unsigned_create( |
| 53 | bt_trace_class *trace_class); |
| 54 | |
| 55 | extern bt_field_class *bt_field_class_integer_signed_create( |
| 56 | bt_trace_class *trace_class); |
| 57 | |
| 58 | extern void bt_field_class_integer_set_field_value_range( |
| 59 | bt_field_class *field_class, uint64_t size); |
| 60 | |
| 61 | extern void bt_field_class_integer_set_preferred_display_base( |
| 62 | bt_field_class *field_class, |
| 63 | bt_field_class_integer_preferred_display_base base); |
| 64 | |
| 65 | extern bt_field_class *bt_field_class_real_create(bt_trace_class *trace_class); |
| 66 | |
| 67 | extern void bt_field_class_real_set_is_single_precision( |
| 68 | bt_field_class *field_class, |
| 69 | bt_bool is_single_precision); |
| 70 | |
| 71 | extern bt_field_class *bt_field_class_enumeration_unsigned_create( |
| 72 | bt_trace_class *trace_class); |
| 73 | |
| 74 | extern bt_field_class *bt_field_class_enumeration_signed_create( |
| 75 | bt_trace_class *trace_class); |
| 76 | |
| 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; |
| 81 | |
| 82 | extern bt_field_class_enumeration_add_mapping_status |
| 83 | bt_field_class_enumeration_unsigned_add_mapping( |
| 84 | bt_field_class *field_class, const char *label, |
| 85 | const bt_integer_range_set_unsigned *range_set); |
| 86 | |
| 87 | extern bt_field_class_enumeration_add_mapping_status |
| 88 | bt_field_class_enumeration_signed_add_mapping( |
| 89 | bt_field_class *field_class, const char *label, |
| 90 | const bt_integer_range_set_signed *range_set); |
| 91 | |
| 92 | extern bt_field_class *bt_field_class_string_create( |
| 93 | bt_trace_class *trace_class); |
| 94 | |
| 95 | extern bt_field_class *bt_field_class_structure_create( |
| 96 | bt_trace_class *trace_class); |
| 97 | |
| 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( |
| 105 | bt_field_class *struct_field_class, |
| 106 | const char *name, bt_field_class *field_class); |
| 107 | |
| 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); |
| 111 | |
| 112 | extern bt_field_class_structure_member * |
| 113 | bt_field_class_structure_borrow_member_by_name( |
| 114 | bt_field_class *field_class, const char *name); |
| 115 | |
| 116 | extern bt_value *bt_field_class_structure_member_borrow_user_attributes( |
| 117 | bt_field_class_structure_member *member); |
| 118 | |
| 119 | extern void bt_field_class_structure_member_set_user_attributes( |
| 120 | bt_field_class_structure_member *member, |
| 121 | const bt_value *user_attributes); |
| 122 | |
| 123 | extern bt_field_class *bt_field_class_array_static_create( |
| 124 | bt_trace_class *trace_class, |
| 125 | bt_field_class *elem_field_class, uint64_t length); |
| 126 | |
| 127 | extern bt_field_class *bt_field_class_array_dynamic_create( |
| 128 | bt_trace_class *trace_class, |
| 129 | bt_field_class *elem_field_class, |
| 130 | bt_field_class *length_field_class); |
| 131 | |
| 132 | extern bt_field_class *bt_field_class_array_borrow_element_field_class( |
| 133 | bt_field_class *field_class); |
| 134 | |
| 135 | extern bt_field_class *bt_field_class_option_create( |
| 136 | bt_trace_class *trace_class, |
| 137 | bt_field_class *content_field_class, |
| 138 | bt_field_class *selector_field_class); |
| 139 | |
| 140 | extern bt_field_class *bt_field_class_variant_create( |
| 141 | bt_trace_class *trace_class, |
| 142 | bt_field_class *selector_field_class); |
| 143 | |
| 144 | typedef enum bt_field_class_variant_without_selector_append_option_status { |
| 145 | BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 146 | BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 147 | } bt_field_class_variant_without_selector_append_option_status; |
| 148 | |
| 149 | extern bt_field_class_variant_without_selector_append_option_status |
| 150 | bt_field_class_variant_without_selector_append_option( |
| 151 | bt_field_class *var_field_class, const char *name, |
| 152 | bt_field_class *field_class); |
| 153 | |
| 154 | typedef enum bt_field_class_variant_with_selector_append_option_status { |
| 155 | BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, |
| 156 | BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK, |
| 157 | } bt_field_class_variant_with_selector_append_option_status; |
| 158 | |
| 159 | extern bt_field_class_variant_with_selector_append_option_status |
| 160 | bt_field_class_variant_with_selector_unsigned_append_option( |
| 161 | bt_field_class *var_field_class, const char *name, |
| 162 | bt_field_class *field_class, |
| 163 | const bt_integer_range_set_unsigned *range_set); |
| 164 | |
| 165 | extern bt_field_class_variant_with_selector_append_option_status |
| 166 | bt_field_class_variant_with_selector_signed_append_option( |
| 167 | bt_field_class *var_field_class, const char *name, |
| 168 | bt_field_class *field_class, |
| 169 | const bt_integer_range_set_signed *range_set); |
| 170 | |
| 171 | extern bt_field_class_variant_option * |
| 172 | bt_field_class_variant_borrow_option_by_index( |
| 173 | bt_field_class *field_class, uint64_t index); |
| 174 | |
| 175 | extern bt_field_class_variant_option * |
| 176 | bt_field_class_variant_borrow_option_by_name( |
| 177 | bt_field_class *field_class, const char *name); |
| 178 | |
| 179 | extern bt_value *bt_field_class_variant_option_borrow_user_attributes( |
| 180 | bt_field_class_variant_option *option); |
| 181 | |
| 182 | extern void bt_field_class_variant_option_set_user_attributes( |
| 183 | bt_field_class_variant_option *option, |
| 184 | const bt_value *user_attributes); |
| 185 | |
| 186 | #ifdef __cplusplus |
| 187 | } |
| 188 | #endif |
| 189 | |
| 190 | #endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_H */ |