1 #ifndef BABELTRACE2_TRACE_IR_FIELD_CLASS_H
2 #define BABELTRACE2_TRACE_IR_FIELD_CLASS_H
5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
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:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
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
26 #ifndef __BT_IN_BABELTRACE_H
27 # error "Please include <babeltrace2/babeltrace.h> instead."
33 #include <babeltrace2/types.h>
34 #include <babeltrace2/trace-ir/field-class-const.h>
40 extern bt_field_class
*bt_field_class_unsigned_integer_create(
41 bt_trace_class
*trace_class
);
43 extern bt_field_class
*bt_field_class_signed_integer_create(
44 bt_trace_class
*trace_class
);
46 extern void bt_field_class_integer_set_field_value_range(
47 bt_field_class
*field_class
, uint64_t size
);
49 extern void bt_field_class_integer_set_preferred_display_base(
50 bt_field_class
*field_class
,
51 bt_field_class_integer_preferred_display_base base
);
53 extern bt_field_class
*bt_field_class_real_create(bt_trace_class
*trace_class
);
55 extern void bt_field_class_real_set_is_single_precision(
56 bt_field_class
*field_class
,
57 bt_bool is_single_precision
);
59 extern bt_field_class
*bt_field_class_unsigned_enumeration_create(
60 bt_trace_class
*trace_class
);
62 extern bt_field_class
*bt_field_class_signed_enumeration_create(
63 bt_trace_class
*trace_class
);
65 typedef enum bt_field_class_enumeration_add_mapping_status
{
66 BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
67 BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK
= __BT_FUNC_STATUS_OK
,
68 } bt_field_class_enumeration_add_mapping_status
;
70 extern bt_field_class_enumeration_add_mapping_status
71 bt_field_class_unsigned_enumeration_add_mapping(
72 bt_field_class
*field_class
, const char *label
,
73 const bt_integer_range_set_unsigned
*range_set
);
75 extern bt_field_class_enumeration_add_mapping_status
76 bt_field_class_signed_enumeration_add_mapping(
77 bt_field_class
*field_class
, const char *label
,
78 const bt_integer_range_set_signed
*range_set
);
80 extern bt_field_class
*bt_field_class_string_create(
81 bt_trace_class
*trace_class
);
83 extern bt_field_class
*bt_field_class_structure_create(
84 bt_trace_class
*trace_class
);
86 typedef enum bt_field_class_structure_append_member_status
{
87 BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
88 BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK
= __BT_FUNC_STATUS_OK
,
89 } bt_field_class_structure_append_member_status
;
91 extern bt_field_class_structure_append_member_status
92 bt_field_class_structure_append_member(
93 bt_field_class
*struct_field_class
,
94 const char *name
, bt_field_class
*field_class
);
96 extern bt_field_class_structure_member
*
97 bt_field_class_structure_borrow_member_by_index(
98 bt_field_class
*field_class
, uint64_t index
);
100 extern bt_field_class_structure_member
*
101 bt_field_class_structure_borrow_member_by_name(
102 bt_field_class
*field_class
, const char *name
);
104 extern bt_field_class
*bt_field_class_static_array_create(
105 bt_trace_class
*trace_class
,
106 bt_field_class
*elem_field_class
, uint64_t length
);
108 extern bt_field_class
*bt_field_class_dynamic_array_create(
109 bt_trace_class
*trace_class
,
110 bt_field_class
*elem_field_class
,
111 bt_field_class
*length_field_class
);
113 extern bt_field_class
*bt_field_class_array_borrow_element_field_class(
114 bt_field_class
*field_class
);
116 extern bt_field_class
*bt_field_class_variant_create(
117 bt_trace_class
*trace_class
,
118 bt_field_class
*selector_field_class
);
120 typedef enum bt_field_class_variant_without_selector_append_option_status
{
121 BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_APPEND_OPTION_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
122 BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_APPEND_OPTION_STATUS_OK
= __BT_FUNC_STATUS_OK
,
123 } bt_field_class_variant_without_selector_append_option_status
;
125 extern bt_field_class_variant_without_selector_append_option_status
126 bt_field_class_variant_without_selector_append_option(
127 bt_field_class
*var_field_class
, const char *name
,
128 bt_field_class
*field_class
);
130 typedef enum bt_field_class_variant_with_selector_append_option_status
{
131 BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_APPEND_OPTION_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
132 BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_APPEND_OPTION_STATUS_OK
= __BT_FUNC_STATUS_OK
,
133 } bt_field_class_variant_with_selector_append_option_status
;
135 extern bt_field_class_variant_with_selector_append_option_status
136 bt_field_class_variant_with_unsigned_selector_append_option(
137 bt_field_class
*var_field_class
, const char *name
,
138 bt_field_class
*field_class
,
139 const bt_integer_range_set_unsigned
*range_set
);
141 extern bt_field_class_variant_with_selector_append_option_status
142 bt_field_class_variant_with_signed_selector_append_option(
143 bt_field_class
*var_field_class
, const char *name
,
144 bt_field_class
*field_class
,
145 const bt_integer_range_set_signed
*range_set
);
151 #endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_H */