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