lib: Make bt_value_null a const pointer
[deliverable/babeltrace.git] / include / babeltrace / value.h
CommitLineData
1ca80abd
PP
1#ifndef BABELTRACE_VALUES_H
2#define BABELTRACE_VALUES_H
dac5c838
PP
3
4/*
82fa4539 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 28
b9879703 29/* For bt_bool, bt_value */
c55a9f58 30#include <babeltrace/types.h>
dac5c838 31
b7c5b62e 32/* For bt_value_status, bt_value_type */
c319d0ae 33#include <babeltrace/value-const.h>
dadf29b9 34
dac5c838
PP
35#ifdef __cplusplus
36extern "C" {
37#endif
38
130aea3e 39extern bt_value *const bt_value_null;
dac5c838 40
b9879703 41extern bt_value *bt_value_bool_create(void);
dac5c838 42
b9879703 43extern bt_value *bt_value_bool_create_init(bt_bool val);
dac5c838 44
b9879703 45extern void bt_value_bool_set(bt_value *bool_obj, bt_bool val);
dac5c838 46
b9879703 47extern bt_value *bt_value_integer_create(void);
dac5c838 48
b9879703 49extern bt_value *bt_value_integer_create_init(
82fa4539 50 int64_t val);
dac5c838 51
b9879703 52extern void bt_value_integer_set(bt_value *integer_obj, int64_t val);
de079588 53
b9879703 54extern bt_value *bt_value_real_create(void);
de079588 55
b9879703 56extern bt_value *bt_value_real_create_init(double val);
dac5c838 57
b9879703 58extern void bt_value_real_set(bt_value *real_obj, double val);
dac5c838 59
b9879703 60extern bt_value *bt_value_string_create(void);
dac5c838 61
b9879703 62extern bt_value *bt_value_string_create_init(const char *val);
dac5c838 63
b7c5b62e 64extern bt_value_status bt_value_string_set(bt_value *string_obj,
82fa4539 65 const char *val);
de079588 66
b9879703 67extern bt_value *bt_value_array_create(void);
dac5c838 68
b9879703
PP
69extern bt_value *bt_value_array_borrow_element_by_index(
70 bt_value *array_obj, uint64_t index);
dac5c838 71
b7c5b62e 72extern bt_value_status bt_value_array_append_element(
b9879703
PP
73 bt_value *array_obj,
74 bt_value *element_obj);
dac5c838 75
b7c5b62e 76extern bt_value_status bt_value_array_append_bool_element(
b9879703 77 bt_value *array_obj, bt_bool val);
82fa4539 78
b7c5b62e 79extern bt_value_status bt_value_array_append_integer_element(
b9879703 80 bt_value *array_obj, int64_t val);
82fa4539 81
b7c5b62e 82extern bt_value_status bt_value_array_append_real_element(
b9879703 83 bt_value *array_obj, double val);
82fa4539 84
b7c5b62e 85extern bt_value_status bt_value_array_append_string_element(
b9879703 86 bt_value *array_obj, const char *val);
82fa4539 87
b7c5b62e 88extern bt_value_status bt_value_array_append_empty_array_element(
b9879703 89 bt_value *array_obj);
82fa4539 90
b7c5b62e 91extern bt_value_status bt_value_array_append_empty_map_element(
b9879703 92 bt_value *array_obj);
82fa4539 93
b7c5b62e 94extern bt_value_status bt_value_array_set_element_by_index(
b9879703
PP
95 bt_value *array_obj, uint64_t index,
96 bt_value *element_obj);
82fa4539 97
b9879703 98extern bt_value *bt_value_map_create(void);
dac5c838 99
b9879703
PP
100extern bt_value *bt_value_map_borrow_entry_value(
101 bt_value *map_obj, const char *key);
dac5c838 102
dadf29b9 103typedef bt_bool (* bt_value_map_foreach_entry_func)(const char *key,
b9879703 104 bt_value *object, void *data);
de079588 105
b7c5b62e 106extern bt_value_status bt_value_map_foreach_entry(
b9879703 107 bt_value *map_obj,
dadf29b9 108 bt_value_map_foreach_entry_func func, void *data);
dac5c838 109
b7c5b62e 110extern bt_value_status bt_value_map_insert_entry(
b9879703
PP
111 bt_value *map_obj, const char *key,
112 bt_value *element_obj);
82fa4539 113
b7c5b62e 114extern bt_value_status bt_value_map_insert_bool_entry(
b9879703 115 bt_value *map_obj, const char *key, bt_bool val);
82fa4539 116
b7c5b62e 117extern bt_value_status bt_value_map_insert_integer_entry(
b9879703 118 bt_value *map_obj, const char *key, int64_t val);
82fa4539 119
b7c5b62e 120extern bt_value_status bt_value_map_insert_real_entry(
b9879703 121 bt_value *map_obj, const char *key, double val);
82fa4539 122
b7c5b62e 123extern bt_value_status bt_value_map_insert_string_entry(
b9879703 124 bt_value *map_obj, const char *key,
82fa4539
PP
125 const char *val);
126
b7c5b62e 127extern bt_value_status bt_value_map_insert_empty_array_entry(
b9879703 128 bt_value *map_obj, const char *key);
dac5c838 129
b7c5b62e 130extern bt_value_status bt_value_map_insert_empty_map_entry(
b9879703 131 bt_value *map_obj, const char *key);
770750d3 132
dac5c838
PP
133#ifdef __cplusplus
134}
135#endif
136
1ca80abd 137#endif /* BABELTRACE_VALUES_H */
This page took 0.053075 seconds and 5 git commands to generate.