1 #ifndef BABELTRACE_CTF_WRITER_FIELDS_H
2 #define BABELTRACE_CTF_WRITER_FIELDS_H
5 * Babeltrace - CTF writer: Event Fields
7 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
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:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
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
29 * The Common Trace Format (CTF) Specification is available at
30 * http://www.efficios.com/ctf
37 #include <babeltrace/ctf-writer/fields.h>
44 struct bt_ctf_event_class
;
46 struct bt_ctf_field_type
;
47 struct bt_ctf_field_type_enumeration_mapping_iterator
;
49 extern struct bt_ctf_field
*bt_ctf_field_create(
50 struct bt_ctf_field_type
*field_type
);
52 extern struct bt_ctf_field_type
*bt_ctf_field_get_type(
53 struct bt_ctf_field
*field
);
55 extern enum bt_ctf_field_type_id
bt_ctf_field_get_type_id(
56 struct bt_ctf_field
*field
);
58 extern struct bt_ctf_field
*bt_ctf_field_copy(struct bt_ctf_field
*field
);
60 extern int bt_ctf_field_integer_signed_get_value(
61 struct bt_ctf_field
*integer_field
, int64_t *value
);
63 /* Pre-2.0 CTF writer compatibility */
65 int bt_ctf_field_signed_integer_set_value(
66 struct bt_ctf_field
*integer_field
, int64_t *value
)
68 return bt_ctf_field_integer_signed_get_value(integer_field
, value
);
71 extern int bt_ctf_field_integer_signed_set_value(
72 struct bt_ctf_field
*integer_field
, int64_t value
);
74 extern int bt_ctf_field_integer_unsigned_get_value(
75 struct bt_ctf_field
*integer_field
, uint64_t *value
);
77 extern int bt_ctf_field_integer_unsigned_set_value(
78 struct bt_ctf_field
*integer_field
, uint64_t value
);
80 /* Pre-2.0 CTF writer compatibility */
82 int bt_ctf_field_unsigned_integer_set_value(
83 struct bt_ctf_field
*integer_field
, uint64_t *value
)
85 return bt_ctf_field_integer_unsigned_get_value(integer_field
, value
);
88 extern int bt_ctf_field_floating_point_get_value(
89 struct bt_ctf_field
*float_field
, double *value
);
91 extern int bt_ctf_field_floating_point_set_value(
92 struct bt_ctf_field
*float_field
, double value
);
94 extern struct bt_ctf_field
*bt_ctf_field_enumeration_get_container(
95 struct bt_ctf_field
*enum_field
);
97 extern const char *bt_ctf_field_string_get_value(
98 struct bt_ctf_field
*string_field
);
100 extern int bt_ctf_field_string_set_value(struct bt_ctf_field
*string_field
,
103 extern int bt_ctf_field_string_append(struct bt_ctf_field
*string_field
,
106 extern int bt_ctf_field_string_append_len(
107 struct bt_ctf_field
*string_field
, const char *value
,
108 unsigned int length
);
110 extern struct bt_ctf_field
*bt_ctf_field_structure_get_field_by_name(
111 struct bt_ctf_field
*struct_field
, const char *name
);
113 /* Pre-2.0 CTF writer compatibility */
115 struct bt_ctf_field
*bt_ctf_field_structure_get_field(
116 struct bt_ctf_field
*structure
, const char *name
)
118 return bt_ctf_field_structure_get_field_by_name(structure
, name
);
121 extern struct bt_ctf_field
*bt_ctf_field_structure_get_field_by_index(
122 struct bt_ctf_field
*struct_field
, uint64_t index
);
124 extern struct bt_ctf_field
*bt_ctf_field_array_get_field(
125 struct bt_ctf_field
*array_field
, uint64_t index
);
127 extern struct bt_ctf_field
*bt_ctf_field_sequence_get_field(
128 struct bt_ctf_field
*sequence_field
, uint64_t index
);
130 extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field
*sequence_field
,
131 struct bt_ctf_field
*length_field
);
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
);
137 extern struct bt_ctf_field
*bt_ctf_field_variant_get_current_field(
138 struct bt_ctf_field
*variant_field
);
144 #endif /* BABELTRACE_CTF_WRITER_FIELDS_H */