2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
7 #ifndef BABELTRACE2_CTF_WRITER_FIELDS_H
8 #define BABELTRACE2_CTF_WRITER_FIELDS_H
18 struct bt_ctf_event_class
;
20 struct bt_ctf_field_type
;
21 struct bt_ctf_field_type_enumeration_mapping_iterator
;
23 extern struct bt_ctf_field
*bt_ctf_field_create(
24 struct bt_ctf_field_type
*field_type
);
26 extern struct bt_ctf_field_type
*bt_ctf_field_get_type(
27 struct bt_ctf_field
*field
);
29 extern enum bt_ctf_field_type_id
bt_ctf_field_get_type_id(
30 struct bt_ctf_field
*field
);
32 extern struct bt_ctf_field
*bt_ctf_field_copy(struct bt_ctf_field
*field
);
34 extern int bt_ctf_field_integer_signed_get_value(
35 struct bt_ctf_field
*integer_field
, int64_t *value
);
37 /* Pre-2.0 CTF writer compatibility */
39 int bt_ctf_field_signed_integer_set_value(
40 struct bt_ctf_field
*integer_field
, int64_t *value
)
42 return bt_ctf_field_integer_signed_get_value(integer_field
, value
);
45 extern int bt_ctf_field_integer_signed_set_value(
46 struct bt_ctf_field
*integer_field
, int64_t value
);
48 extern int bt_ctf_field_integer_unsigned_get_value(
49 struct bt_ctf_field
*integer_field
, uint64_t *value
);
51 extern int bt_ctf_field_integer_unsigned_set_value(
52 struct bt_ctf_field
*integer_field
, uint64_t value
);
54 /* Pre-2.0 CTF writer compatibility */
56 int bt_ctf_field_unsigned_integer_get_value(
57 struct bt_ctf_field
*integer_field
, uint64_t *value
)
59 return bt_ctf_field_integer_unsigned_get_value(integer_field
, value
);
62 extern int bt_ctf_field_floating_point_get_value(
63 struct bt_ctf_field
*float_field
, double *value
);
65 extern int bt_ctf_field_floating_point_set_value(
66 struct bt_ctf_field
*float_field
, double value
);
68 extern struct bt_ctf_field
*bt_ctf_field_enumeration_get_container(
69 struct bt_ctf_field
*enum_field
);
71 extern const char *bt_ctf_field_string_get_value(
72 struct bt_ctf_field
*string_field
);
74 extern int bt_ctf_field_string_set_value(struct bt_ctf_field
*string_field
,
77 extern int bt_ctf_field_string_append(struct bt_ctf_field
*string_field
,
80 extern int bt_ctf_field_string_append_len(
81 struct bt_ctf_field
*string_field
, const char *value
,
84 extern struct bt_ctf_field
*bt_ctf_field_structure_get_field_by_name(
85 struct bt_ctf_field
*struct_field
, const char *name
);
87 /* Pre-2.0 CTF writer compatibility */
89 struct bt_ctf_field
*bt_ctf_field_structure_get_field(
90 struct bt_ctf_field
*structure
, const char *name
)
92 return bt_ctf_field_structure_get_field_by_name(structure
, name
);
95 extern struct bt_ctf_field
*bt_ctf_field_structure_get_field_by_index(
96 struct bt_ctf_field
*struct_field
, uint64_t index
);
98 extern struct bt_ctf_field
*bt_ctf_field_array_get_field(
99 struct bt_ctf_field
*array_field
, uint64_t index
);
101 extern struct bt_ctf_field
*bt_ctf_field_sequence_get_field(
102 struct bt_ctf_field
*sequence_field
, uint64_t index
);
104 extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field
*sequence_field
,
105 struct bt_ctf_field
*length_field
);
107 extern struct bt_ctf_field
*bt_ctf_field_variant_get_field(
108 struct bt_ctf_field
*variant_field
,
109 struct bt_ctf_field
*tag_field
);
111 extern struct bt_ctf_field
*bt_ctf_field_variant_get_current_field(
112 struct bt_ctf_field
*variant_field
);
118 #endif /* BABELTRACE2_CTF_WRITER_FIELDS_H */