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
41 struct bt_ctf_event_class
;
43 struct bt_ctf_field_type
;
44 struct bt_ctf_field_type_enumeration_mapping_iterator
;
46 extern struct bt_ctf_field
*bt_ctf_field_create(
47 struct bt_ctf_field_type
*field_type
);
49 extern struct bt_ctf_field_type
*bt_ctf_field_get_type(
50 struct bt_ctf_field
*field
);
52 extern enum bt_ctf_field_type_id
bt_ctf_field_get_type_id(
53 struct bt_ctf_field
*field
);
55 extern struct bt_ctf_field
*bt_ctf_field_copy(struct bt_ctf_field
*field
);
57 extern int bt_ctf_field_integer_signed_get_value(
58 struct bt_ctf_field
*integer_field
, int64_t *value
);
60 /* Pre-2.0 CTF writer compatibility */
62 int bt_ctf_field_signed_integer_set_value(
63 struct bt_ctf_field
*integer_field
, int64_t *value
)
65 return bt_ctf_field_integer_signed_get_value(integer_field
, value
);
68 extern int bt_ctf_field_integer_signed_set_value(
69 struct bt_ctf_field
*integer_field
, int64_t value
);
71 extern int bt_ctf_field_integer_unsigned_get_value(
72 struct bt_ctf_field
*integer_field
, uint64_t *value
);
74 extern int bt_ctf_field_integer_unsigned_set_value(
75 struct bt_ctf_field
*integer_field
, uint64_t value
);
77 /* Pre-2.0 CTF writer compatibility */
79 int bt_ctf_field_unsigned_integer_set_value(
80 struct bt_ctf_field
*integer_field
, uint64_t *value
)
82 return bt_ctf_field_integer_unsigned_get_value(integer_field
, value
);
85 extern int bt_ctf_field_floating_point_get_value(
86 struct bt_ctf_field
*float_field
, double *value
);
88 extern int bt_ctf_field_floating_point_set_value(
89 struct bt_ctf_field
*float_field
, double value
);
91 extern struct bt_ctf_field
*bt_ctf_field_enumeration_get_container(
92 struct bt_ctf_field
*enum_field
);
94 extern const char *bt_ctf_field_string_get_value(
95 struct bt_ctf_field
*string_field
);
97 extern int bt_ctf_field_string_set_value(struct bt_ctf_field
*string_field
,
100 extern int bt_ctf_field_string_append(struct bt_ctf_field
*string_field
,
103 extern int bt_ctf_field_string_append_len(
104 struct bt_ctf_field
*string_field
, const char *value
,
105 unsigned int length
);
107 extern struct bt_ctf_field
*bt_ctf_field_structure_get_field_by_name(
108 struct bt_ctf_field
*struct_field
, const char *name
);
110 /* Pre-2.0 CTF writer compatibility */
112 struct bt_ctf_field
*bt_ctf_field_structure_get_field(
113 struct bt_ctf_field
*structure
, const char *name
)
115 return bt_ctf_field_structure_get_field_by_name(structure
, name
);
118 extern struct bt_ctf_field
*bt_ctf_field_structure_get_field_by_index(
119 struct bt_ctf_field
*struct_field
, uint64_t index
);
121 extern struct bt_ctf_field
*bt_ctf_field_array_get_field(
122 struct bt_ctf_field
*array_field
, uint64_t index
);
124 extern struct bt_ctf_field
*bt_ctf_field_sequence_get_field(
125 struct bt_ctf_field
*sequence_field
, uint64_t index
);
127 extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field
*sequence_field
,
128 struct bt_ctf_field
*length_field
);
130 extern struct bt_ctf_field
*bt_ctf_field_variant_get_field(
131 struct bt_ctf_field
*variant_field
,
132 struct bt_ctf_field
*tag_field
);
134 extern struct bt_ctf_field
*bt_ctf_field_variant_get_current_field(
135 struct bt_ctf_field
*variant_field
);
141 #endif /* BABELTRACE_CTF_WRITER_FIELDS_H */