07dd64b40cfb31c4bcca4948c1058511d052fb98
[babeltrace.git] / include / babeltrace2-ctf-writer / fields.h
1 #ifndef BABELTRACE2_CTF_WRITER_FIELDS_H
2 #define BABELTRACE2_CTF_WRITER_FIELDS_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 #include <stdint.h>
27 #include <stddef.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 struct bt_ctf_field;
34 struct bt_ctf_event_class;
35 struct bt_ctf_event;
36 struct bt_ctf_field_type;
37 struct bt_ctf_field_type_enumeration_mapping_iterator;
38
39 extern struct bt_ctf_field *bt_ctf_field_create(
40 struct bt_ctf_field_type *field_type);
41
42 extern struct bt_ctf_field_type *bt_ctf_field_get_type(
43 struct bt_ctf_field *field);
44
45 extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id(
46 struct bt_ctf_field *field);
47
48 extern struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field);
49
50 extern int bt_ctf_field_integer_signed_get_value(
51 struct bt_ctf_field *integer_field, int64_t *value);
52
53 /* Pre-2.0 CTF writer compatibility */
54 static inline
55 int bt_ctf_field_signed_integer_set_value(
56 struct bt_ctf_field *integer_field, int64_t *value)
57 {
58 return bt_ctf_field_integer_signed_get_value(integer_field, value);
59 }
60
61 extern int bt_ctf_field_integer_signed_set_value(
62 struct bt_ctf_field *integer_field, int64_t value);
63
64 extern int bt_ctf_field_integer_unsigned_get_value(
65 struct bt_ctf_field *integer_field, uint64_t *value);
66
67 extern int bt_ctf_field_integer_unsigned_set_value(
68 struct bt_ctf_field *integer_field, uint64_t value);
69
70 /* Pre-2.0 CTF writer compatibility */
71 static inline
72 int bt_ctf_field_unsigned_integer_get_value(
73 struct bt_ctf_field *integer_field, uint64_t *value)
74 {
75 return bt_ctf_field_integer_unsigned_get_value(integer_field, value);
76 }
77
78 extern int bt_ctf_field_floating_point_get_value(
79 struct bt_ctf_field *float_field, double *value);
80
81 extern int bt_ctf_field_floating_point_set_value(
82 struct bt_ctf_field *float_field, double value);
83
84 extern struct bt_ctf_field *bt_ctf_field_enumeration_get_container(
85 struct bt_ctf_field *enum_field);
86
87 extern const char *bt_ctf_field_string_get_value(
88 struct bt_ctf_field *string_field);
89
90 extern int bt_ctf_field_string_set_value(struct bt_ctf_field *string_field,
91 const char *value);
92
93 extern int bt_ctf_field_string_append(struct bt_ctf_field *string_field,
94 const char *value);
95
96 extern int bt_ctf_field_string_append_len(
97 struct bt_ctf_field *string_field, const char *value,
98 unsigned int length);
99
100 extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
101 struct bt_ctf_field *struct_field, const char *name);
102
103 /* Pre-2.0 CTF writer compatibility */
104 static inline
105 struct bt_ctf_field *bt_ctf_field_structure_get_field(
106 struct bt_ctf_field *structure, const char *name)
107 {
108 return bt_ctf_field_structure_get_field_by_name(structure, name);
109 }
110
111 extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
112 struct bt_ctf_field *struct_field, uint64_t index);
113
114 extern struct bt_ctf_field *bt_ctf_field_array_get_field(
115 struct bt_ctf_field *array_field, uint64_t index);
116
117 extern struct bt_ctf_field *bt_ctf_field_sequence_get_field(
118 struct bt_ctf_field *sequence_field, uint64_t index);
119
120 extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field *sequence_field,
121 struct bt_ctf_field *length_field);
122
123 extern struct bt_ctf_field *bt_ctf_field_variant_get_field(
124 struct bt_ctf_field *variant_field,
125 struct bt_ctf_field *tag_field);
126
127 extern struct bt_ctf_field *bt_ctf_field_variant_get_current_field(
128 struct bt_ctf_field *variant_field);
129
130 #ifdef __cplusplus
131 }
132 #endif
133
134 #endif /* BABELTRACE2_CTF_WRITER_FIELDS_H */
This page took 0.032116 seconds and 4 git commands to generate.