Commit | Line | Data |
---|---|---|
1ca80abd PP |
1 | #ifndef BABELTRACE_VALUES_H |
2 | #define BABELTRACE_VALUES_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 | ||
dac5c838 | 26 | #include <stdint.h> |
dac5c838 | 27 | #include <stddef.h> |
e0831b38 | 28 | |
8eee8ea2 | 29 | /* For bt_bool, bt_value */ |
c55a9f58 | 30 | #include <babeltrace/types.h> |
dac5c838 | 31 | |
ee78f405 | 32 | /* For bt_value_status, bt_value_type */ |
0f15f666 | 33 | #include <babeltrace/value-const.h> |
78cf9df6 | 34 | |
dac5c838 PP |
35 | #ifdef __cplusplus |
36 | extern "C" { | |
37 | #endif | |
38 | ||
8eee8ea2 | 39 | extern bt_value *bt_value_null; |
dac5c838 | 40 | |
8eee8ea2 | 41 | extern bt_value *bt_value_bool_create(void); |
dac5c838 | 42 | |
8eee8ea2 | 43 | extern bt_value *bt_value_bool_create_init(bt_bool val); |
dac5c838 | 44 | |
8eee8ea2 | 45 | extern void bt_value_bool_set(bt_value *bool_obj, bt_bool val); |
dac5c838 | 46 | |
8eee8ea2 | 47 | extern bt_value *bt_value_integer_create(void); |
dac5c838 | 48 | |
8eee8ea2 | 49 | extern bt_value *bt_value_integer_create_init( |
ce141536 | 50 | int64_t val); |
dac5c838 | 51 | |
8eee8ea2 | 52 | extern void bt_value_integer_set(bt_value *integer_obj, int64_t val); |
de079588 | 53 | |
8eee8ea2 | 54 | extern bt_value *bt_value_real_create(void); |
de079588 | 55 | |
8eee8ea2 | 56 | extern bt_value *bt_value_real_create_init(double val); |
dac5c838 | 57 | |
8eee8ea2 | 58 | extern void bt_value_real_set(bt_value *real_obj, double val); |
dac5c838 | 59 | |
8eee8ea2 | 60 | extern bt_value *bt_value_string_create(void); |
dac5c838 | 61 | |
8eee8ea2 | 62 | extern bt_value *bt_value_string_create_init(const char *val); |
dac5c838 | 63 | |
ee78f405 | 64 | extern bt_value_status bt_value_string_set(bt_value *string_obj, |
ce141536 | 65 | const char *val); |
de079588 | 66 | |
8eee8ea2 | 67 | extern bt_value *bt_value_array_create(void); |
dac5c838 | 68 | |
8eee8ea2 PP |
69 | extern bt_value *bt_value_array_borrow_element_by_index( |
70 | bt_value *array_obj, uint64_t index); | |
dac5c838 | 71 | |
ee78f405 | 72 | extern bt_value_status bt_value_array_append_element( |
8eee8ea2 PP |
73 | bt_value *array_obj, |
74 | bt_value *element_obj); | |
dac5c838 | 75 | |
ee78f405 | 76 | extern bt_value_status bt_value_array_append_bool_element( |
8eee8ea2 | 77 | bt_value *array_obj, bt_bool val); |
ce141536 | 78 | |
ee78f405 | 79 | extern bt_value_status bt_value_array_append_integer_element( |
8eee8ea2 | 80 | bt_value *array_obj, int64_t val); |
ce141536 | 81 | |
ee78f405 | 82 | extern bt_value_status bt_value_array_append_real_element( |
8eee8ea2 | 83 | bt_value *array_obj, double val); |
ce141536 | 84 | |
ee78f405 | 85 | extern bt_value_status bt_value_array_append_string_element( |
8eee8ea2 | 86 | bt_value *array_obj, const char *val); |
ce141536 | 87 | |
ee78f405 | 88 | extern bt_value_status bt_value_array_append_empty_array_element( |
8eee8ea2 | 89 | bt_value *array_obj); |
ce141536 | 90 | |
ee78f405 | 91 | extern bt_value_status bt_value_array_append_empty_map_element( |
8eee8ea2 | 92 | bt_value *array_obj); |
ce141536 | 93 | |
ee78f405 | 94 | extern bt_value_status bt_value_array_set_element_by_index( |
8eee8ea2 PP |
95 | bt_value *array_obj, uint64_t index, |
96 | bt_value *element_obj); | |
ce141536 | 97 | |
8eee8ea2 | 98 | extern bt_value *bt_value_map_create(void); |
dac5c838 | 99 | |
8eee8ea2 PP |
100 | extern bt_value *bt_value_map_borrow_entry_value( |
101 | bt_value *map_obj, const char *key); | |
dac5c838 | 102 | |
78cf9df6 | 103 | typedef bt_bool (* bt_value_map_foreach_entry_func)(const char *key, |
8eee8ea2 | 104 | bt_value *object, void *data); |
de079588 | 105 | |
ee78f405 | 106 | extern bt_value_status bt_value_map_foreach_entry( |
8eee8ea2 | 107 | bt_value *map_obj, |
78cf9df6 | 108 | bt_value_map_foreach_entry_func func, void *data); |
dac5c838 | 109 | |
ee78f405 | 110 | extern bt_value_status bt_value_map_insert_entry( |
8eee8ea2 PP |
111 | bt_value *map_obj, const char *key, |
112 | bt_value *element_obj); | |
ce141536 | 113 | |
ee78f405 | 114 | extern bt_value_status bt_value_map_insert_bool_entry( |
8eee8ea2 | 115 | bt_value *map_obj, const char *key, bt_bool val); |
ce141536 | 116 | |
ee78f405 | 117 | extern bt_value_status bt_value_map_insert_integer_entry( |
8eee8ea2 | 118 | bt_value *map_obj, const char *key, int64_t val); |
ce141536 | 119 | |
ee78f405 | 120 | extern bt_value_status bt_value_map_insert_real_entry( |
8eee8ea2 | 121 | bt_value *map_obj, const char *key, double val); |
ce141536 | 122 | |
ee78f405 | 123 | extern bt_value_status bt_value_map_insert_string_entry( |
8eee8ea2 | 124 | bt_value *map_obj, const char *key, |
ce141536 PP |
125 | const char *val); |
126 | ||
ee78f405 | 127 | extern bt_value_status bt_value_map_insert_empty_array_entry( |
8eee8ea2 | 128 | bt_value *map_obj, const char *key); |
dac5c838 | 129 | |
ee78f405 | 130 | extern bt_value_status bt_value_map_insert_empty_map_entry( |
8eee8ea2 | 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 */ |