lib: force user to include `<babeltrace2/babeltrace.h>`
[babeltrace.git] / include / babeltrace2 / value.h
CommitLineData
3fd40f46
PP
1#ifndef BABELTRACE2_VALUE_H
2#define BABELTRACE2_VALUE_H
dac5c838
PP
3
4/*
ce141536 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
9df34b44
PP
26#ifndef __BT_IN_BABELTRACE_H
27# error "Please include <babeltrace2/babeltrace.h> instead."
28#endif
29
dac5c838 30#include <stdint.h>
dac5c838 31#include <stddef.h>
e0831b38 32
8eee8ea2 33/* For bt_bool, bt_value */
71c5da58 34#include <babeltrace2/types.h>
dac5c838 35
fb25b9e3 36/* For bt_value_type */
71c5da58 37#include <babeltrace2/value-const.h>
78cf9df6 38
dac5c838
PP
39#ifdef __cplusplus
40extern "C" {
41#endif
42
038be990 43extern bt_value *const bt_value_null;
dac5c838 44
8eee8ea2 45extern bt_value *bt_value_bool_create(void);
dac5c838 46
8eee8ea2 47extern bt_value *bt_value_bool_create_init(bt_bool val);
dac5c838 48
8eee8ea2 49extern void bt_value_bool_set(bt_value *bool_obj, bt_bool val);
dac5c838 50
68d9d039 51extern bt_value *bt_value_unsigned_integer_create(void);
dac5c838 52
68d9d039 53extern bt_value *bt_value_unsigned_integer_create_init(uint64_t val);
dac5c838 54
68d9d039
PP
55extern void bt_value_unsigned_integer_set(bt_value *integer_obj, uint64_t val);
56
57extern bt_value *bt_value_signed_integer_create(void);
58
59extern bt_value *bt_value_signed_integer_create_init(int64_t val);
60
61extern void bt_value_signed_integer_set(bt_value *integer_obj, int64_t val);
de079588 62
8eee8ea2 63extern bt_value *bt_value_real_create(void);
de079588 64
8eee8ea2 65extern bt_value *bt_value_real_create_init(double val);
dac5c838 66
8eee8ea2 67extern void bt_value_real_set(bt_value *real_obj, double val);
dac5c838 68
8eee8ea2 69extern bt_value *bt_value_string_create(void);
dac5c838 70
8eee8ea2 71extern bt_value *bt_value_string_create_init(const char *val);
dac5c838 72
fb25b9e3
PP
73typedef enum bt_value_string_set_status {
74 BT_VALUE_STRING_SET_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
75 BT_VALUE_STRING_SET_STATUS_OK = __BT_FUNC_STATUS_OK,
76} bt_value_string_set_status;
77
78extern bt_value_string_set_status bt_value_string_set(bt_value *string_obj,
ce141536 79 const char *val);
de079588 80
8eee8ea2 81extern bt_value *bt_value_array_create(void);
dac5c838 82
fb25b9e3
PP
83extern bt_value *bt_value_array_borrow_element_by_index(bt_value *array_obj,
84 uint64_t index);
dac5c838 85
fb25b9e3
PP
86typedef enum bt_value_array_append_element_status {
87 BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
88 BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK = __BT_FUNC_STATUS_OK,
89} bt_value_array_append_element_status;
dac5c838 90
fb25b9e3
PP
91extern bt_value_array_append_element_status bt_value_array_append_element(
92 bt_value *array_obj, bt_value *element_obj);
ce141536 93
fb25b9e3
PP
94extern bt_value_array_append_element_status
95bt_value_array_append_bool_element(bt_value *array_obj, bt_bool val);
68d9d039 96
fb25b9e3
PP
97extern bt_value_array_append_element_status
98bt_value_array_append_unsigned_integer_element(bt_value *array_obj,
99 uint64_t val);
ce141536 100
fb25b9e3
PP
101extern bt_value_array_append_element_status
102bt_value_array_append_signed_integer_element(bt_value *array_obj, int64_t val);
ce141536 103
fb25b9e3
PP
104extern bt_value_array_append_element_status
105bt_value_array_append_real_element(bt_value *array_obj, double val);
ce141536 106
fb25b9e3
PP
107extern bt_value_array_append_element_status
108bt_value_array_append_string_element(bt_value *array_obj, const char *val);
ce141536 109
fb25b9e3
PP
110extern bt_value_array_append_element_status
111bt_value_array_append_empty_array_element(bt_value *array_obj);
ce141536 112
fb25b9e3
PP
113extern bt_value_array_append_element_status
114bt_value_array_append_empty_map_element(bt_value *array_obj);
115
116typedef enum bt_value_array_set_element_by_index_status {
117 BT_VALUE_ARRAY_SET_ELEMENT_BY_INDEX_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
118 BT_VALUE_ARRAY_SET_ELEMENT_BY_INDEX_STATUS_OK = __BT_FUNC_STATUS_OK,
119} bt_value_array_set_element_by_index_status;
120
121extern bt_value_array_set_element_by_index_status
122bt_value_array_set_element_by_index(bt_value *array_obj, uint64_t index,
8eee8ea2 123 bt_value *element_obj);
ce141536 124
8eee8ea2 125extern bt_value *bt_value_map_create(void);
dac5c838 126
8eee8ea2
PP
127extern bt_value *bt_value_map_borrow_entry_value(
128 bt_value *map_obj, const char *key);
dac5c838 129
78cf9df6 130typedef bt_bool (* bt_value_map_foreach_entry_func)(const char *key,
8eee8ea2 131 bt_value *object, void *data);
de079588 132
fb25b9e3
PP
133typedef enum bt_value_map_foreach_entry_status {
134 BT_VALUE_MAP_FOREACH_ENTRY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
135 BT_VALUE_MAP_FOREACH_ENTRY_STATUS_OK = __BT_FUNC_STATUS_OK,
136 BT_VALUE_MAP_FOREACH_ENTRY_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED,
137} bt_value_map_foreach_entry_status;
dac5c838 138
fb25b9e3
PP
139extern bt_value_map_foreach_entry_status bt_value_map_foreach_entry(
140 bt_value *map_obj, bt_value_map_foreach_entry_func func,
141 void *data);
ce141536 142
fb25b9e3
PP
143typedef enum bt_value_map_insert_entry_status {
144 BT_VALUE_MAP_INSERT_ENTRY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
145 BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK = __BT_FUNC_STATUS_OK,
146} bt_value_map_insert_entry_status;
147
148extern bt_value_map_insert_entry_status bt_value_map_insert_entry(
149 bt_value *map_obj, const char *key, bt_value *element_obj);
150
151extern bt_value_map_insert_entry_status bt_value_map_insert_bool_entry(
8eee8ea2 152 bt_value *map_obj, const char *key, bt_bool val);
ce141536 153
fb25b9e3
PP
154extern bt_value_map_insert_entry_status
155bt_value_map_insert_unsigned_integer_entry(bt_value *map_obj, const char *key,
156 uint64_t val);
68d9d039 157
fb25b9e3
PP
158extern bt_value_map_insert_entry_status
159bt_value_map_insert_signed_integer_entry(bt_value *map_obj, const char *key,
160 int64_t val);
ce141536 161
fb25b9e3 162extern bt_value_map_insert_entry_status bt_value_map_insert_real_entry(
8eee8ea2 163 bt_value *map_obj, const char *key, double val);
ce141536 164
fb25b9e3
PP
165extern bt_value_map_insert_entry_status
166bt_value_map_insert_string_entry(bt_value *map_obj, const char *key,
ce141536
PP
167 const char *val);
168
fb25b9e3
PP
169extern bt_value_map_insert_entry_status
170bt_value_map_insert_empty_array_entry(bt_value *map_obj, const char *key);
dac5c838 171
fb25b9e3
PP
172extern bt_value_map_insert_entry_status
173bt_value_map_insert_empty_map_entry(bt_value *map_obj, const char *key);
770750d3 174
dac5c838
PP
175#ifdef __cplusplus
176}
177#endif
178
3fd40f46 179#endif /* BABELTRACE2_VALUE_H */
This page took 0.060283 seconds and 4 git commands to generate.