Commit | Line | Data |
---|---|---|
da91b29a PP |
1 | #ifndef BABELTRACE_PRIVATE_VALUES_H |
2 | #define BABELTRACE_PRIVATE_VALUES_H | |
3 | ||
4 | /* | |
5 | * Copyright (c) 2015-2016 EfficiOS Inc. and Linux Foundation | |
6 | * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com> | |
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 | ||
27 | #include <stdint.h> | |
28 | #include <stddef.h> | |
29 | ||
30 | /* For enum bt_value_status */ | |
31 | #include <babeltrace/values.h> | |
32 | ||
33 | #ifdef __cplusplus | |
34 | extern "C" { | |
35 | #endif | |
36 | ||
37 | struct bt_value; | |
38 | struct bt_private_value; | |
39 | ||
40 | extern struct bt_private_value *bt_private_value_null; | |
41 | ||
42 | extern struct bt_value *bt_value_borrow_from_private( | |
43 | struct bt_private_value *priv_value); | |
44 | ||
45 | extern struct bt_private_value *bt_private_value_bool_create(void); | |
46 | ||
47 | ||
48 | extern struct bt_private_value *bt_private_value_bool_create_init(bt_bool val); | |
49 | ||
601b0d3c | 50 | extern void bt_private_value_bool_set(struct bt_private_value *bool_obj, |
da91b29a PP |
51 | bt_bool val); |
52 | ||
53 | extern struct bt_private_value *bt_private_value_integer_create(void); | |
54 | ||
601b0d3c PP |
55 | extern struct bt_private_value *bt_private_value_integer_create_init( |
56 | int64_t val); | |
da91b29a | 57 | |
601b0d3c | 58 | extern void bt_private_value_integer_set( |
da91b29a PP |
59 | struct bt_private_value *integer_obj, int64_t val); |
60 | ||
61 | extern struct bt_private_value *bt_private_value_real_create(void); | |
62 | ||
63 | extern struct bt_private_value *bt_private_value_real_create_init(double val); | |
64 | ||
601b0d3c | 65 | extern void bt_private_value_real_set( |
da91b29a PP |
66 | struct bt_private_value *real_obj, double val); |
67 | ||
68 | extern struct bt_private_value *bt_private_value_string_create(void); | |
69 | ||
601b0d3c PP |
70 | extern struct bt_private_value *bt_private_value_string_create_init( |
71 | const char *val); | |
da91b29a | 72 | |
601b0d3c PP |
73 | extern enum bt_value_status bt_private_value_string_set( |
74 | struct bt_private_value *string_obj, | |
da91b29a PP |
75 | const char *val); |
76 | ||
77 | extern struct bt_private_value *bt_private_value_array_create(void); | |
78 | ||
79 | extern struct bt_private_value *bt_private_value_array_borrow_element_by_index( | |
80 | const struct bt_private_value *array_obj, uint64_t index); | |
81 | ||
82 | extern enum bt_value_status bt_private_value_array_append_element( | |
601b0d3c PP |
83 | struct bt_private_value *array_obj, |
84 | struct bt_value *element_obj); | |
da91b29a PP |
85 | |
86 | extern enum bt_value_status bt_private_value_array_append_bool_element( | |
601b0d3c PP |
87 | struct bt_private_value *array_obj, |
88 | bt_bool val); | |
da91b29a PP |
89 | |
90 | extern enum bt_value_status bt_private_value_array_append_integer_element( | |
601b0d3c PP |
91 | struct bt_private_value *array_obj, |
92 | int64_t val); | |
da91b29a PP |
93 | |
94 | extern enum bt_value_status bt_private_value_array_append_real_element( | |
601b0d3c PP |
95 | struct bt_private_value *array_obj, |
96 | double val); | |
da91b29a PP |
97 | |
98 | extern enum bt_value_status bt_private_value_array_append_string_element( | |
99 | struct bt_private_value *array_obj, const char *val); | |
100 | ||
101 | extern enum bt_value_status bt_private_value_array_append_empty_array_element( | |
102 | struct bt_private_value *array_obj); | |
103 | ||
104 | extern enum bt_value_status bt_private_value_array_append_empty_map_element( | |
105 | struct bt_private_value *array_obj); | |
106 | ||
107 | extern enum bt_value_status bt_private_value_array_set_element_by_index( | |
108 | struct bt_private_value *array_obj, uint64_t index, | |
109 | struct bt_value *element_obj); | |
110 | ||
111 | extern struct bt_private_value *bt_private_value_map_create(void); | |
112 | ||
113 | extern struct bt_private_value *bt_private_value_map_borrow_entry_value( | |
114 | const struct bt_private_value *map_obj, const char *key); | |
115 | ||
116 | typedef bt_bool (* bt_private_value_map_foreach_entry_cb)(const char *key, | |
601b0d3c | 117 | struct bt_private_value *object, void *data); |
da91b29a PP |
118 | |
119 | extern enum bt_value_status bt_private_value_map_foreach_entry( | |
120 | const struct bt_private_value *map_obj, | |
121 | bt_private_value_map_foreach_entry_cb cb, void *data); | |
122 | ||
123 | extern enum bt_value_status bt_private_value_map_insert_entry( | |
124 | struct bt_private_value *map_obj, const char *key, | |
125 | struct bt_value *element_obj); | |
126 | ||
127 | extern enum bt_value_status bt_private_value_map_insert_bool_entry( | |
128 | struct bt_private_value *map_obj, const char *key, bt_bool val); | |
129 | ||
130 | extern enum bt_value_status bt_private_value_map_insert_integer_entry( | |
131 | struct bt_private_value *map_obj, const char *key, int64_t val); | |
132 | ||
133 | extern enum bt_value_status bt_private_value_map_insert_real_entry( | |
134 | struct bt_private_value *map_obj, const char *key, double val); | |
135 | ||
136 | extern enum bt_value_status bt_private_value_map_insert_string_entry( | |
601b0d3c PP |
137 | struct bt_private_value *map_obj, const char *key, |
138 | const char *val); | |
da91b29a PP |
139 | |
140 | extern enum bt_value_status bt_private_value_map_insert_empty_array_entry( | |
141 | struct bt_private_value *map_obj, const char *key); | |
142 | ||
143 | extern enum bt_value_status bt_private_value_map_insert_empty_map_entry( | |
144 | struct bt_private_value *map_obj, const char *key); | |
145 | ||
146 | #ifdef __cplusplus | |
147 | } | |
148 | #endif | |
149 | ||
150 | #endif /* BABELTRACE_PRIVATE_VALUES_H */ |