Move to kernel style SPDX license identifiers
[babeltrace.git] / include / babeltrace2-ctf-writer / fields.h
CommitLineData
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
14extern "C" {
15#endif
16
17struct bt_ctf_field;
18struct bt_ctf_event_class;
19struct bt_ctf_event;
20struct bt_ctf_field_type;
21struct bt_ctf_field_type_enumeration_mapping_iterator;
22
23extern struct bt_ctf_field *bt_ctf_field_create(
24 struct bt_ctf_field_type *field_type);
25
26extern struct bt_ctf_field_type *bt_ctf_field_get_type(
27 struct bt_ctf_field *field);
28
29extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id(
30 struct bt_ctf_field *field);
31
32extern struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field);
33
34extern 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 */
38static inline
39int 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
45extern int bt_ctf_field_integer_signed_set_value(
46 struct bt_ctf_field *integer_field, int64_t value);
47
48extern int bt_ctf_field_integer_unsigned_get_value(
49 struct bt_ctf_field *integer_field, uint64_t *value);
50
51extern 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 */
55static inline
16b589f8 56int 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
62extern int bt_ctf_field_floating_point_get_value(
63 struct bt_ctf_field *float_field, double *value);
64
65extern int bt_ctf_field_floating_point_set_value(
66 struct bt_ctf_field *float_field, double value);
67
68extern struct bt_ctf_field *bt_ctf_field_enumeration_get_container(
69 struct bt_ctf_field *enum_field);
70
3dca2276
PP
71extern const char *bt_ctf_field_string_get_value(
72 struct bt_ctf_field *string_field);
73
74extern int bt_ctf_field_string_set_value(struct bt_ctf_field *string_field,
75 const char *value);
76
77extern int bt_ctf_field_string_append(struct bt_ctf_field *string_field,
78 const char *value);
79
80extern int bt_ctf_field_string_append_len(
81 struct bt_ctf_field *string_field, const char *value,
82 unsigned int length);
83
84extern 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 */
88static inline
89struct 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
95extern 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
98extern struct bt_ctf_field *bt_ctf_field_array_get_field(
99 struct bt_ctf_field *array_field, uint64_t index);
100
101extern struct bt_ctf_field *bt_ctf_field_sequence_get_field(
102 struct bt_ctf_field *sequence_field, uint64_t index);
103
3dca2276
PP
104extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field *sequence_field,
105 struct bt_ctf_field *length_field);
106
107extern 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
111extern 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 */
This page took 0.053238 seconds and 4 git commands to generate.