1 #ifndef BABELTRACE_CTF_WRITER_FIELDS_H
2 #define BABELTRACE_CTF_WRITER_FIELDS_H
5 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
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:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
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
27 * The Common Trace Format (CTF) Specification is available at
28 * http://www.efficios.com/ctf
39 struct bt_ctf_event_class
;
41 struct bt_ctf_field_type
;
42 struct bt_ctf_field_type_enumeration_mapping_iterator
;
44 extern struct bt_ctf_field
*bt_ctf_field_create(
45 struct bt_ctf_field_type
*field_type
);
47 extern struct bt_ctf_field_type
*bt_ctf_field_get_type(
48 struct bt_ctf_field
*field
);
50 extern enum bt_ctf_field_type_id
bt_ctf_field_get_type_id(
51 struct bt_ctf_field
*field
);
53 extern struct bt_ctf_field
*bt_ctf_field_copy(struct bt_ctf_field
*field
);
55 extern int bt_ctf_field_integer_signed_get_value(
56 struct bt_ctf_field
*integer_field
, int64_t *value
);
58 /* Pre-2.0 CTF writer compatibility */
60 int bt_ctf_field_signed_integer_set_value(
61 struct bt_ctf_field
*integer_field
, int64_t *value
)
63 return bt_ctf_field_integer_signed_get_value(integer_field
, value
);
66 extern int bt_ctf_field_integer_signed_set_value(
67 struct bt_ctf_field
*integer_field
, int64_t value
);
69 extern int bt_ctf_field_integer_unsigned_get_value(
70 struct bt_ctf_field
*integer_field
, uint64_t *value
);
72 extern int bt_ctf_field_integer_unsigned_set_value(
73 struct bt_ctf_field
*integer_field
, uint64_t value
);
75 /* Pre-2.0 CTF writer compatibility */
77 int bt_ctf_field_unsigned_integer_set_value(
78 struct bt_ctf_field
*integer_field
, uint64_t *value
)
80 return bt_ctf_field_integer_unsigned_get_value(integer_field
, value
);
83 extern int bt_ctf_field_floating_point_get_value(
84 struct bt_ctf_field
*float_field
, double *value
);
86 extern int bt_ctf_field_floating_point_set_value(
87 struct bt_ctf_field
*float_field
, double value
);
89 extern struct bt_ctf_field
*bt_ctf_field_enumeration_get_container(
90 struct bt_ctf_field
*enum_field
);
92 extern const char *bt_ctf_field_string_get_value(
93 struct bt_ctf_field
*string_field
);
95 extern int bt_ctf_field_string_set_value(struct bt_ctf_field
*string_field
,
98 extern int bt_ctf_field_string_append(struct bt_ctf_field
*string_field
,
101 extern int bt_ctf_field_string_append_len(
102 struct bt_ctf_field
*string_field
, const char *value
,
103 unsigned int length
);
105 extern struct bt_ctf_field
*bt_ctf_field_structure_get_field_by_name(
106 struct bt_ctf_field
*struct_field
, const char *name
);
108 /* Pre-2.0 CTF writer compatibility */
110 struct bt_ctf_field
*bt_ctf_field_structure_get_field(
111 struct bt_ctf_field
*structure
, const char *name
)
113 return bt_ctf_field_structure_get_field_by_name(structure
, name
);
116 extern struct bt_ctf_field
*bt_ctf_field_structure_get_field_by_index(
117 struct bt_ctf_field
*struct_field
, uint64_t index
);
119 extern struct bt_ctf_field
*bt_ctf_field_array_get_field(
120 struct bt_ctf_field
*array_field
, uint64_t index
);
122 extern struct bt_ctf_field
*bt_ctf_field_sequence_get_field(
123 struct bt_ctf_field
*sequence_field
, uint64_t index
);
125 extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field
*sequence_field
,
126 struct bt_ctf_field
*length_field
);
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
);
132 extern struct bt_ctf_field
*bt_ctf_field_variant_get_current_field(
133 struct bt_ctf_field
*variant_field
);
139 #endif /* BABELTRACE_CTF_WRITER_FIELDS_H */