lib: add internal object pool API and use it; adapt plugins/tests
[babeltrace.git] / include / babeltrace / ctf-writer / fields.h
1 #ifndef BABELTRACE_CTF_WRITER_FIELDS_H
2 #define BABELTRACE_CTF_WRITER_FIELDS_H
3
4 /*
5 * Babeltrace - CTF writer: Event Fields
6 *
7 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 *
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28 *
29 * The Common Trace Format (CTF) Specification is available at
30 * http://www.efficios.com/ctf
31 */
32
33 #include <stdint.h>
34 #include <stddef.h>
35
36 /* For bt_bool */
37 #include <babeltrace/ctf-writer/fields.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 struct bt_ctf_field;
44 struct bt_ctf_event_class;
45 struct bt_ctf_event;
46 struct bt_ctf_field_type;
47 struct bt_ctf_field_type_enumeration_mapping_iterator;
48
49 extern struct bt_ctf_field *bt_ctf_field_create(
50 struct bt_ctf_field_type *field_type);
51
52 extern struct bt_ctf_field_type *bt_ctf_field_get_type(
53 struct bt_ctf_field *field);
54
55 extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id(
56 struct bt_ctf_field *field);
57
58 extern struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field);
59
60 extern int bt_ctf_field_integer_signed_get_value(
61 struct bt_ctf_field *integer_field, int64_t *value);
62
63 /* Pre-2.0 CTF writer compatibility */
64 static inline
65 int bt_ctf_field_signed_integer_set_value(
66 struct bt_ctf_field *integer_field, int64_t *value)
67 {
68 return bt_ctf_field_integer_signed_get_value(integer_field, value);
69 }
70
71 extern int bt_ctf_field_integer_signed_set_value(
72 struct bt_ctf_field *integer_field, int64_t value);
73
74 extern int bt_ctf_field_integer_unsigned_get_value(
75 struct bt_ctf_field *integer_field, uint64_t *value);
76
77 extern int bt_ctf_field_integer_unsigned_set_value(
78 struct bt_ctf_field *integer_field, uint64_t value);
79
80 /* Pre-2.0 CTF writer compatibility */
81 static inline
82 int bt_ctf_field_unsigned_integer_set_value(
83 struct bt_ctf_field *integer_field, uint64_t *value)
84 {
85 return bt_ctf_field_integer_unsigned_get_value(integer_field, value);
86 }
87
88 extern int bt_ctf_field_floating_point_get_value(
89 struct bt_ctf_field *float_field, double *value);
90
91 extern int bt_ctf_field_floating_point_set_value(
92 struct bt_ctf_field *float_field, double value);
93
94 extern struct bt_ctf_field *bt_ctf_field_enumeration_get_container(
95 struct bt_ctf_field *enum_field);
96
97 extern const char *bt_ctf_field_string_get_value(
98 struct bt_ctf_field *string_field);
99
100 extern int bt_ctf_field_string_set_value(struct bt_ctf_field *string_field,
101 const char *value);
102
103 extern int bt_ctf_field_string_append(struct bt_ctf_field *string_field,
104 const char *value);
105
106 extern int bt_ctf_field_string_append_len(
107 struct bt_ctf_field *string_field, const char *value,
108 unsigned int length);
109
110 extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
111 struct bt_ctf_field *struct_field, const char *name);
112
113 /* Pre-2.0 CTF writer compatibility */
114 static inline
115 struct bt_ctf_field *bt_ctf_field_structure_get_field(
116 struct bt_ctf_field *structure, const char *name)
117 {
118 return bt_ctf_field_structure_get_field_by_name(structure, name);
119 }
120
121 extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
122 struct bt_ctf_field *struct_field, uint64_t index);
123
124 extern struct bt_ctf_field *bt_ctf_field_array_get_field(
125 struct bt_ctf_field *array_field, uint64_t index);
126
127 extern struct bt_ctf_field *bt_ctf_field_sequence_get_field(
128 struct bt_ctf_field *sequence_field, uint64_t index);
129
130 extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field *sequence_field,
131 struct bt_ctf_field *length_field);
132
133 extern struct bt_ctf_field *bt_ctf_field_variant_get_field(
134 struct bt_ctf_field *variant_field,
135 struct bt_ctf_field *tag_field);
136
137 extern struct bt_ctf_field *bt_ctf_field_variant_get_current_field(
138 struct bt_ctf_field *variant_field);
139
140 #ifdef __cplusplus
141 }
142 #endif
143
144 #endif /* BABELTRACE_CTF_WRITER_FIELDS_H */
This page took 0.031722 seconds and 4 git commands to generate.