Commit | Line | Data |
---|---|---|
3dca2276 | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
3dca2276 | 3 | * |
0235b0db | 4 | * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation |
3dca2276 PP |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef BABELTRACE2_CTF_WRITER_FIELDS_H |
8 | #define BABELTRACE2_CTF_WRITER_FIELDS_H | |
9 | ||
3dca2276 PP |
10 | #include <stdint.h> |
11 | #include <stddef.h> | |
12 | ||
3dca2276 PP |
13 | #ifdef __cplusplus |
14 | extern "C" { | |
15 | #endif | |
16 | ||
17 | struct bt_ctf_field; | |
18 | struct bt_ctf_event_class; | |
19 | struct bt_ctf_event; | |
20 | struct bt_ctf_field_type; | |
21 | struct bt_ctf_field_type_enumeration_mapping_iterator; | |
22 | ||
23 | extern struct bt_ctf_field *bt_ctf_field_create( | |
24 | struct bt_ctf_field_type *field_type); | |
25 | ||
26 | extern struct bt_ctf_field_type *bt_ctf_field_get_type( | |
27 | struct bt_ctf_field *field); | |
28 | ||
29 | extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id( | |
30 | struct bt_ctf_field *field); | |
31 | ||
32 | extern struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field); | |
33 | ||
34 | extern int bt_ctf_field_integer_signed_get_value( | |
35 | struct bt_ctf_field *integer_field, int64_t *value); | |
36 | ||
37 | /* Pre-2.0 CTF writer compatibility */ | |
38 | static inline | |
39 | int bt_ctf_field_signed_integer_set_value( | |
40 | struct bt_ctf_field *integer_field, int64_t *value) | |
41 | { | |
42 | return bt_ctf_field_integer_signed_get_value(integer_field, value); | |
43 | } | |
44 | ||
45 | extern int bt_ctf_field_integer_signed_set_value( | |
46 | struct bt_ctf_field *integer_field, int64_t value); | |
47 | ||
48 | extern int bt_ctf_field_integer_unsigned_get_value( | |
49 | struct bt_ctf_field *integer_field, uint64_t *value); | |
50 | ||
51 | extern int bt_ctf_field_integer_unsigned_set_value( | |
52 | struct bt_ctf_field *integer_field, uint64_t value); | |
53 | ||
54 | /* Pre-2.0 CTF writer compatibility */ | |
55 | static inline | |
16b589f8 | 56 | int bt_ctf_field_unsigned_integer_get_value( |
3dca2276 PP |
57 | struct bt_ctf_field *integer_field, uint64_t *value) |
58 | { | |
59 | return bt_ctf_field_integer_unsigned_get_value(integer_field, value); | |
60 | } | |
61 | ||
62 | extern int bt_ctf_field_floating_point_get_value( | |
63 | struct bt_ctf_field *float_field, double *value); | |
64 | ||
65 | extern int bt_ctf_field_floating_point_set_value( | |
66 | struct bt_ctf_field *float_field, double value); | |
67 | ||
68 | extern struct bt_ctf_field *bt_ctf_field_enumeration_get_container( | |
69 | struct bt_ctf_field *enum_field); | |
70 | ||
3dca2276 PP |
71 | extern const char *bt_ctf_field_string_get_value( |
72 | struct bt_ctf_field *string_field); | |
73 | ||
74 | extern int bt_ctf_field_string_set_value(struct bt_ctf_field *string_field, | |
75 | const char *value); | |
76 | ||
77 | extern int bt_ctf_field_string_append(struct bt_ctf_field *string_field, | |
78 | const char *value); | |
79 | ||
80 | extern int bt_ctf_field_string_append_len( | |
81 | struct bt_ctf_field *string_field, const char *value, | |
82 | unsigned int length); | |
83 | ||
84 | extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name( | |
85 | struct bt_ctf_field *struct_field, const char *name); | |
86 | ||
87 | /* Pre-2.0 CTF writer compatibility */ | |
88 | static inline | |
89 | struct bt_ctf_field *bt_ctf_field_structure_get_field( | |
90 | struct bt_ctf_field *structure, const char *name) | |
91 | { | |
92 | return bt_ctf_field_structure_get_field_by_name(structure, name); | |
93 | } | |
94 | ||
95 | extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index( | |
96 | struct bt_ctf_field *struct_field, uint64_t index); | |
97 | ||
3dca2276 PP |
98 | extern struct bt_ctf_field *bt_ctf_field_array_get_field( |
99 | struct bt_ctf_field *array_field, uint64_t index); | |
100 | ||
101 | extern struct bt_ctf_field *bt_ctf_field_sequence_get_field( | |
102 | struct bt_ctf_field *sequence_field, uint64_t index); | |
103 | ||
3dca2276 PP |
104 | extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field *sequence_field, |
105 | struct bt_ctf_field *length_field); | |
106 | ||
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); | |
110 | ||
111 | extern struct bt_ctf_field *bt_ctf_field_variant_get_current_field( | |
112 | struct bt_ctf_field *variant_field); | |
113 | ||
3dca2276 PP |
114 | #ifdef __cplusplus |
115 | } | |
116 | #endif | |
117 | ||
924dc299 | 118 | #endif /* BABELTRACE2_CTF_WRITER_FIELDS_H */ |