lib: make trace IR API const-correct
[babeltrace.git] / include / babeltrace / values.h
CommitLineData
1ca80abd
PP
1#ifndef BABELTRACE_VALUES_H
2#define BABELTRACE_VALUES_H
dac5c838
PP
3
4/*
de079588 5 * Copyright (c) 2015-2016 EfficiOS Inc. and Linux Foundation
05e21286 6 * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com>
dac5c838
PP
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
25 */
26
dac5c838 27#include <stdint.h>
dac5c838 28#include <stddef.h>
9d408fca
PP
29
30/* For bt_bool */
c55a9f58 31#include <babeltrace/types.h>
dac5c838 32
40f4ba76
PP
33/* For enum bt_value_status, enum bt_value_type */
34#include <babeltrace/values-const.h>
35
dac5c838
PP
36#ifdef __cplusplus
37extern "C" {
38#endif
39
05e21286 40struct bt_value;
dac5c838 41
05e21286 42extern struct bt_value *bt_value_null;
dac5c838 43
05e21286 44extern struct bt_value *bt_value_bool_create(void);
dac5c838 45
05e21286 46extern struct bt_value *bt_value_bool_create_init(bt_bool val);
dac5c838 47
05e21286 48extern void bt_value_bool_set(struct bt_value *bool_obj, bt_bool val);
dac5c838 49
05e21286 50extern struct bt_value *bt_value_integer_create(void);
dac5c838 51
05e21286
PP
52extern struct bt_value *bt_value_integer_create_init(
53 int64_t val);
dac5c838 54
05e21286 55extern void bt_value_integer_set(struct bt_value *integer_obj, int64_t val);
de079588 56
05e21286 57extern struct bt_value *bt_value_real_create(void);
de079588 58
05e21286 59extern struct bt_value *bt_value_real_create_init(double val);
dac5c838 60
05e21286 61extern void bt_value_real_set(struct bt_value *real_obj, double val);
dac5c838 62
05e21286 63extern struct bt_value *bt_value_string_create(void);
dac5c838 64
05e21286 65extern struct bt_value *bt_value_string_create_init(const char *val);
dac5c838 66
05e21286
PP
67extern enum bt_value_status bt_value_string_set(struct bt_value *string_obj,
68 const char *val);
de079588 69
05e21286 70extern struct bt_value *bt_value_array_create(void);
dac5c838 71
07208d85 72extern struct bt_value *bt_value_array_borrow_element_by_index(
05e21286 73 struct bt_value *array_obj, uint64_t index);
dac5c838 74
05e21286
PP
75extern enum bt_value_status bt_value_array_append_element(
76 struct bt_value *array_obj,
77 struct bt_value *element_obj);
dac5c838 78
05e21286
PP
79extern enum bt_value_status bt_value_array_append_bool_element(
80 struct bt_value *array_obj, bt_bool val);
81
82extern enum bt_value_status bt_value_array_append_integer_element(
83 struct bt_value *array_obj, int64_t val);
84
85extern enum bt_value_status bt_value_array_append_real_element(
86 struct bt_value *array_obj, double val);
87
88extern enum bt_value_status bt_value_array_append_string_element(
89 struct bt_value *array_obj, const char *val);
90
91extern enum bt_value_status bt_value_array_append_empty_array_element(
92 struct bt_value *array_obj);
93
94extern enum bt_value_status bt_value_array_append_empty_map_element(
95 struct bt_value *array_obj);
96
97extern enum bt_value_status bt_value_array_set_element_by_index(
98 struct bt_value *array_obj, uint64_t index,
99 struct bt_value *element_obj);
100
101extern struct bt_value *bt_value_map_create(void);
dac5c838 102
07208d85 103extern struct bt_value *bt_value_map_borrow_entry_value(
05e21286 104 struct bt_value *map_obj, const char *key);
dac5c838 105
40f4ba76 106typedef bt_bool (* bt_value_map_foreach_entry_func)(const char *key,
05e21286 107 struct bt_value *object, void *data);
de079588 108
07208d85 109extern enum bt_value_status bt_value_map_foreach_entry(
05e21286 110 struct bt_value *map_obj,
40f4ba76 111 bt_value_map_foreach_entry_func func, void *data);
dac5c838 112
05e21286
PP
113extern enum bt_value_status bt_value_map_insert_entry(
114 struct bt_value *map_obj, const char *key,
115 struct bt_value *element_obj);
116
117extern enum bt_value_status bt_value_map_insert_bool_entry(
118 struct bt_value *map_obj, const char *key, bt_bool val);
119
120extern enum bt_value_status bt_value_map_insert_integer_entry(
121 struct bt_value *map_obj, const char *key, int64_t val);
122
123extern enum bt_value_status bt_value_map_insert_real_entry(
124 struct bt_value *map_obj, const char *key, double val);
125
126extern enum bt_value_status bt_value_map_insert_string_entry(
127 struct bt_value *map_obj, const char *key,
128 const char *val);
129
130extern enum bt_value_status bt_value_map_insert_empty_array_entry(
131 struct bt_value *map_obj, const char *key);
dac5c838 132
05e21286
PP
133extern enum bt_value_status bt_value_map_insert_empty_map_entry(
134 struct bt_value *map_obj, const char *key);
770750d3 135
dac5c838
PP
136#ifdef __cplusplus
137}
138#endif
139
1ca80abd 140#endif /* BABELTRACE_VALUES_H */
This page took 0.049784 seconds and 4 git commands to generate.