lib: make public reference count functions have strict types
[babeltrace.git] / include / babeltrace / value.h
CommitLineData
1ca80abd
PP
1#ifndef BABELTRACE_VALUES_H
2#define BABELTRACE_VALUES_H
dac5c838
PP
3
4/*
05e21286 5 * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com>
dac5c838
PP
6 *
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:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
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
23 * SOFTWARE.
24 */
25
dac5c838 26#include <stdint.h>
dac5c838 27#include <stddef.h>
9d408fca
PP
28
29/* For bt_bool */
c55a9f58 30#include <babeltrace/types.h>
dac5c838 31
40f4ba76 32/* For enum bt_value_status, enum bt_value_type */
c6bd8523 33#include <babeltrace/value-const.h>
40f4ba76 34
dac5c838
PP
35#ifdef __cplusplus
36extern "C" {
37#endif
38
05e21286 39struct bt_value;
dac5c838 40
05e21286 41extern struct bt_value *bt_value_null;
dac5c838 42
05e21286 43extern struct bt_value *bt_value_bool_create(void);
dac5c838 44
05e21286 45extern struct bt_value *bt_value_bool_create_init(bt_bool val);
dac5c838 46
05e21286 47extern void bt_value_bool_set(struct bt_value *bool_obj, bt_bool val);
dac5c838 48
05e21286 49extern struct bt_value *bt_value_integer_create(void);
dac5c838 50
05e21286
PP
51extern struct bt_value *bt_value_integer_create_init(
52 int64_t val);
dac5c838 53
05e21286 54extern void bt_value_integer_set(struct bt_value *integer_obj, int64_t val);
de079588 55
05e21286 56extern struct bt_value *bt_value_real_create(void);
de079588 57
05e21286 58extern struct bt_value *bt_value_real_create_init(double val);
dac5c838 59
05e21286 60extern void bt_value_real_set(struct bt_value *real_obj, double val);
dac5c838 61
05e21286 62extern struct bt_value *bt_value_string_create(void);
dac5c838 63
05e21286 64extern struct bt_value *bt_value_string_create_init(const char *val);
dac5c838 65
05e21286
PP
66extern enum bt_value_status bt_value_string_set(struct bt_value *string_obj,
67 const char *val);
de079588 68
05e21286 69extern struct bt_value *bt_value_array_create(void);
dac5c838 70
07208d85 71extern struct bt_value *bt_value_array_borrow_element_by_index(
05e21286 72 struct bt_value *array_obj, uint64_t index);
dac5c838 73
05e21286
PP
74extern enum bt_value_status bt_value_array_append_element(
75 struct bt_value *array_obj,
76 struct bt_value *element_obj);
dac5c838 77
05e21286
PP
78extern enum bt_value_status bt_value_array_append_bool_element(
79 struct bt_value *array_obj, bt_bool val);
80
81extern enum bt_value_status bt_value_array_append_integer_element(
82 struct bt_value *array_obj, int64_t val);
83
84extern enum bt_value_status bt_value_array_append_real_element(
85 struct bt_value *array_obj, double val);
86
87extern enum bt_value_status bt_value_array_append_string_element(
88 struct bt_value *array_obj, const char *val);
89
90extern enum bt_value_status bt_value_array_append_empty_array_element(
91 struct bt_value *array_obj);
92
93extern enum bt_value_status bt_value_array_append_empty_map_element(
94 struct bt_value *array_obj);
95
96extern enum bt_value_status bt_value_array_set_element_by_index(
97 struct bt_value *array_obj, uint64_t index,
98 struct bt_value *element_obj);
99
100extern struct bt_value *bt_value_map_create(void);
dac5c838 101
07208d85 102extern struct bt_value *bt_value_map_borrow_entry_value(
05e21286 103 struct bt_value *map_obj, const char *key);
dac5c838 104
40f4ba76 105typedef bt_bool (* bt_value_map_foreach_entry_func)(const char *key,
05e21286 106 struct bt_value *object, void *data);
de079588 107
07208d85 108extern enum bt_value_status bt_value_map_foreach_entry(
05e21286 109 struct bt_value *map_obj,
40f4ba76 110 bt_value_map_foreach_entry_func func, void *data);
dac5c838 111
05e21286
PP
112extern enum bt_value_status bt_value_map_insert_entry(
113 struct bt_value *map_obj, const char *key,
114 struct bt_value *element_obj);
115
116extern enum bt_value_status bt_value_map_insert_bool_entry(
117 struct bt_value *map_obj, const char *key, bt_bool val);
118
119extern enum bt_value_status bt_value_map_insert_integer_entry(
120 struct bt_value *map_obj, const char *key, int64_t val);
121
122extern enum bt_value_status bt_value_map_insert_real_entry(
123 struct bt_value *map_obj, const char *key, double val);
124
125extern enum bt_value_status bt_value_map_insert_string_entry(
126 struct bt_value *map_obj, const char *key,
127 const char *val);
128
129extern enum bt_value_status bt_value_map_insert_empty_array_entry(
130 struct bt_value *map_obj, const char *key);
dac5c838 131
05e21286
PP
132extern enum bt_value_status bt_value_map_insert_empty_map_entry(
133 struct bt_value *map_obj, const char *key);
770750d3 134
dac5c838
PP
135#ifdef __cplusplus
136}
137#endif
138
1ca80abd 139#endif /* BABELTRACE_VALUES_H */
This page took 0.0524790000000001 seconds and 4 git commands to generate.