1 #ifndef BABELTRACE2_CTF_WRITER_FIELDS_H
2 #define BABELTRACE2_CTF_WRITER_FIELDS_H
5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 struct bt_ctf_event_class
;
36 struct bt_ctf_field_type
;
37 struct bt_ctf_field_type_enumeration_mapping_iterator
;
39 extern struct bt_ctf_field
*bt_ctf_field_create(
40 struct bt_ctf_field_type
*field_type
);
42 extern struct bt_ctf_field_type
*bt_ctf_field_get_type(
43 struct bt_ctf_field
*field
);
45 extern enum bt_ctf_field_type_id
bt_ctf_field_get_type_id(
46 struct bt_ctf_field
*field
);
48 extern struct bt_ctf_field
*bt_ctf_field_copy(struct bt_ctf_field
*field
);
50 extern int bt_ctf_field_integer_signed_get_value(
51 struct bt_ctf_field
*integer_field
, int64_t *value
);
53 /* Pre-2.0 CTF writer compatibility */
55 int bt_ctf_field_signed_integer_set_value(
56 struct bt_ctf_field
*integer_field
, int64_t *value
)
58 return bt_ctf_field_integer_signed_get_value(integer_field
, value
);
61 extern int bt_ctf_field_integer_signed_set_value(
62 struct bt_ctf_field
*integer_field
, int64_t value
);
64 extern int bt_ctf_field_integer_unsigned_get_value(
65 struct bt_ctf_field
*integer_field
, uint64_t *value
);
67 extern int bt_ctf_field_integer_unsigned_set_value(
68 struct bt_ctf_field
*integer_field
, uint64_t value
);
70 /* Pre-2.0 CTF writer compatibility */
72 int bt_ctf_field_unsigned_integer_get_value(
73 struct bt_ctf_field
*integer_field
, uint64_t *value
)
75 return bt_ctf_field_integer_unsigned_get_value(integer_field
, value
);
78 extern int bt_ctf_field_floating_point_get_value(
79 struct bt_ctf_field
*float_field
, double *value
);
81 extern int bt_ctf_field_floating_point_set_value(
82 struct bt_ctf_field
*float_field
, double value
);
84 extern struct bt_ctf_field
*bt_ctf_field_enumeration_get_container(
85 struct bt_ctf_field
*enum_field
);
87 extern const char *bt_ctf_field_string_get_value(
88 struct bt_ctf_field
*string_field
);
90 extern int bt_ctf_field_string_set_value(struct bt_ctf_field
*string_field
,
93 extern int bt_ctf_field_string_append(struct bt_ctf_field
*string_field
,
96 extern int bt_ctf_field_string_append_len(
97 struct bt_ctf_field
*string_field
, const char *value
,
100 extern struct bt_ctf_field
*bt_ctf_field_structure_get_field_by_name(
101 struct bt_ctf_field
*struct_field
, const char *name
);
103 /* Pre-2.0 CTF writer compatibility */
105 struct bt_ctf_field
*bt_ctf_field_structure_get_field(
106 struct bt_ctf_field
*structure
, const char *name
)
108 return bt_ctf_field_structure_get_field_by_name(structure
, name
);
111 extern struct bt_ctf_field
*bt_ctf_field_structure_get_field_by_index(
112 struct bt_ctf_field
*struct_field
, uint64_t index
);
114 extern struct bt_ctf_field
*bt_ctf_field_array_get_field(
115 struct bt_ctf_field
*array_field
, uint64_t index
);
117 extern struct bt_ctf_field
*bt_ctf_field_sequence_get_field(
118 struct bt_ctf_field
*sequence_field
, uint64_t index
);
120 extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field
*sequence_field
,
121 struct bt_ctf_field
*length_field
);
123 extern struct bt_ctf_field
*bt_ctf_field_variant_get_field(
124 struct bt_ctf_field
*variant_field
,
125 struct bt_ctf_field
*tag_field
);
127 extern struct bt_ctf_field
*bt_ctf_field_variant_get_current_field(
128 struct bt_ctf_field
*variant_field
);
134 #endif /* BABELTRACE2_CTF_WRITER_FIELDS_H */