lib: force user to include `<babeltrace2/babeltrace.h>`
[babeltrace.git] / include / babeltrace2 / trace-ir / field-class.h
CommitLineData
924dc299
PP
1#ifndef BABELTRACE2_TRACE_IR_FIELD_CLASS_H
2#define BABELTRACE2_TRACE_IR_FIELD_CLASS_H
5cd6d0e5
PP
3
4/*
e2f7325d 5 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
5cd6d0e5
PP
6 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 *
5cd6d0e5
PP
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:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
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
24 * SOFTWARE.
25 *
26 * The Common Trace Format (CTF) Specification is available at
27 * http://www.efficios.com/ctf
28 */
29
4fa90f32
PP
30#ifndef __BT_IN_BABELTRACE_H
31# error "Please include <babeltrace2/babeltrace.h> instead."
32#endif
33
d24d5663
PP
34#include <stdint.h>
35#include <stddef.h>
36
1122a43a 37/* For bt_bool, bt_field_class, bt_trace_class */
3fadfbc0 38#include <babeltrace2/types.h>
5cd6d0e5 39
d24d5663 40/* For bt_field_class_integer_preferred_display_base */
3fadfbc0 41#include <babeltrace2/trace-ir/field-class-const.h>
40f4ba76 42
5cd6d0e5
PP
43#ifdef __cplusplus
44extern "C" {
45#endif
46
1122a43a
PP
47extern bt_field_class *bt_field_class_unsigned_integer_create(
48 bt_trace_class *trace_class);
5cd6d0e5 49
1122a43a
PP
50extern bt_field_class *bt_field_class_signed_integer_create(
51 bt_trace_class *trace_class);
40f4ba76
PP
52
53extern void bt_field_class_integer_set_field_value_range(
b19ff26f 54 bt_field_class *field_class, uint64_t size);
40f4ba76
PP
55
56extern void bt_field_class_integer_set_preferred_display_base(
b19ff26f 57 bt_field_class *field_class,
4cdfc5e8 58 bt_field_class_integer_preferred_display_base base);
40f4ba76 59
1122a43a 60extern bt_field_class *bt_field_class_real_create(bt_trace_class *trace_class);
40f4ba76
PP
61
62extern void bt_field_class_real_set_is_single_precision(
b19ff26f 63 bt_field_class *field_class,
40f4ba76
PP
64 bt_bool is_single_precision);
65
1122a43a
PP
66extern bt_field_class *bt_field_class_unsigned_enumeration_create(
67 bt_trace_class *trace_class);
40f4ba76 68
1122a43a
PP
69extern bt_field_class *bt_field_class_signed_enumeration_create(
70 bt_trace_class *trace_class);
40f4ba76 71
d24d5663
PP
72typedef enum bt_field_class_enumeration_map_range_status {
73 BT_FIELD_CLASS_ENUMERATION_MAP_RANGE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
74 BT_FIELD_CLASS_ENUMERATION_MAP_RANGE_STATUS_OK = __BT_FUNC_STATUS_OK,
75} bt_field_class_enumeration_map_range_status;
76
77extern bt_field_class_enumeration_map_range_status
78bt_field_class_unsigned_enumeration_map_range(
b19ff26f 79 bt_field_class *field_class, const char *label,
40f4ba76
PP
80 uint64_t range_lower, uint64_t range_upper);
81
d24d5663
PP
82extern bt_field_class_enumeration_map_range_status
83bt_field_class_signed_enumeration_map_range(
b19ff26f 84 bt_field_class *field_class, const char *label,
40f4ba76
PP
85 int64_t range_lower, int64_t range_upper);
86
1122a43a
PP
87extern bt_field_class *bt_field_class_string_create(
88 bt_trace_class *trace_class);
40f4ba76 89
1122a43a
PP
90extern bt_field_class *bt_field_class_structure_create(
91 bt_trace_class *trace_class);
40f4ba76 92
d24d5663
PP
93typedef enum bt_field_class_structure_append_member_status {
94 BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
95 BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK = __BT_FUNC_STATUS_OK,
96} bt_field_class_structure_append_member_status;
97
98extern bt_field_class_structure_append_member_status
99bt_field_class_structure_append_member(
b19ff26f
PP
100 bt_field_class *struct_field_class,
101 const char *name, bt_field_class *field_class);
40f4ba76 102
1e6fd1d7
PP
103extern bt_field_class_structure_member *
104bt_field_class_structure_borrow_member_by_index(
105 bt_field_class *field_class, uint64_t index);
740faaf4 106
1e6fd1d7
PP
107extern bt_field_class_structure_member *
108bt_field_class_structure_borrow_member_by_name(
740faaf4
PP
109 bt_field_class *field_class, const char *name);
110
b19ff26f 111extern bt_field_class *bt_field_class_static_array_create(
1122a43a 112 bt_trace_class *trace_class,
b19ff26f 113 bt_field_class *elem_field_class, uint64_t length);
40f4ba76 114
b19ff26f 115extern bt_field_class *bt_field_class_dynamic_array_create(
1122a43a 116 bt_trace_class *trace_class,
b19ff26f 117 bt_field_class *elem_field_class);
40f4ba76 118
740faaf4
PP
119extern bt_field_class *bt_field_class_array_borrow_element_field_class(
120 bt_field_class *field_class);
121
d24d5663
PP
122typedef enum bt_field_class_dynamic_array_set_length_field_class_status {
123 BT_FIELD_CLASS_DYNAMIC_ARRAY_SET_LENGTH_FIELD_CLASS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
124 BT_FIELD_CLASS_DYNAMIC_ARRAY_SET_LENGTH_FIELD_CLASS_STATUS_OK = __BT_FUNC_STATUS_OK,
125} bt_field_class_dynamic_array_set_length_field_class_status;
126
127extern bt_field_class_dynamic_array_set_length_field_class_status
4295b9e0 128bt_field_class_dynamic_array_set_length_field_class(
b19ff26f
PP
129 bt_field_class *field_class,
130 bt_field_class *length_field_class);
40f4ba76 131
1122a43a
PP
132extern bt_field_class *bt_field_class_variant_create(
133 bt_trace_class *trace_class);
40f4ba76 134
d24d5663
PP
135typedef enum bt_field_class_variant_set_selector_field_class_status {
136 BT_FIELD_CLASS_VARIANT_SET_SELECTOR_FIELD_CLASS_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
137 BT_FIELD_CLASS_VARIANT_SET_SELECTOR_FIELD_CLASS_STATUS_OK = __BT_FUNC_STATUS_OK,
138} bt_field_class_variant_set_selector_field_class_status;
139
140extern bt_field_class_variant_set_selector_field_class_status
4295b9e0 141bt_field_class_variant_set_selector_field_class(bt_field_class *field_class,
b19ff26f 142 bt_field_class *selector_field_class);
40f4ba76 143
d24d5663
PP
144typedef enum bt_field_class_variant_append_option_status {
145 BT_FIELD_CLASS_VARIANT_APPEND_OPTION_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
146 BT_FIELD_CLASS_VARIANT_APPEND_OPTION_STATUS_OK = __BT_FUNC_STATUS_OK,
147} bt_field_class_variant_append_option_status;
148
149extern bt_field_class_variant_append_option_status
150bt_field_class_variant_append_option(
b19ff26f
PP
151 bt_field_class *var_field_class,
152 const char *name, bt_field_class *field_class);
5cd6d0e5 153
1e6fd1d7
PP
154extern bt_field_class_variant_option *
155bt_field_class_variant_borrow_option_by_index(
156 bt_field_class *field_class, uint64_t index);
740faaf4 157
1e6fd1d7
PP
158extern bt_field_class_variant_option *
159bt_field_class_variant_borrow_option_by_name(
7c06e353 160 bt_field_class *field_class, const char *name);
1e6fd1d7
PP
161
162extern bt_field_class *bt_field_class_variant_option_borrow_field_class(
163 bt_field_class_variant_option *option);
740faaf4 164
5cd6d0e5
PP
165#ifdef __cplusplus
166}
167#endif
168
924dc299 169#endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_H */
This page took 0.039775 seconds and 4 git commands to generate.