Commit | Line | Data |
---|---|---|
17582c6d 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 | ||
17582c6d PP |
47 | extern struct bt_private_value *bt_private_value_bool_create_init(bt_bool val); |
48 | ||
b5cdc106 | 49 | extern void bt_private_value_bool_set(struct bt_private_value *bool_obj, |
17582c6d PP |
50 | bt_bool val); |
51 | ||
52 | extern struct bt_private_value *bt_private_value_integer_create(void); | |
53 | ||
b5cdc106 PP |
54 | extern struct bt_private_value *bt_private_value_integer_create_init( |
55 | int64_t val); | |
17582c6d | 56 | |
b5cdc106 | 57 | extern void bt_private_value_integer_set( |
17582c6d PP |
58 | struct bt_private_value *integer_obj, int64_t val); |
59 | ||
60 | extern struct bt_private_value *bt_private_value_real_create(void); | |
61 | ||
62 | extern struct bt_private_value *bt_private_value_real_create_init(double val); | |
63 | ||
b5cdc106 | 64 | extern void bt_private_value_real_set( |
17582c6d PP |
65 | struct bt_private_value *real_obj, double val); |
66 | ||
67 | extern struct bt_private_value *bt_private_value_string_create(void); | |
68 | ||
b5cdc106 PP |
69 | extern struct bt_private_value *bt_private_value_string_create_init( |
70 | const char *val); | |
17582c6d | 71 | |
b5cdc106 PP |
72 | extern enum bt_value_status bt_private_value_string_set( |
73 | struct bt_private_value *string_obj, | |
17582c6d PP |
74 | const char *val); |
75 | ||
76 | extern struct bt_private_value *bt_private_value_array_create(void); | |
77 | ||
78 | extern struct bt_private_value *bt_private_value_array_borrow_element_by_index( | |
79 | const struct bt_private_value *array_obj, uint64_t index); | |
80 | ||
81 | extern enum bt_value_status bt_private_value_array_append_element( | |
b5cdc106 PP |
82 | struct bt_private_value *array_obj, |
83 | struct bt_value *element_obj); | |
17582c6d PP |
84 | |
85 | extern enum bt_value_status bt_private_value_array_append_bool_element( | |
b5cdc106 PP |
86 | struct bt_private_value *array_obj, |
87 | bt_bool val); | |
17582c6d PP |
88 | |
89 | extern enum bt_value_status bt_private_value_array_append_integer_element( | |
b5cdc106 PP |
90 | struct bt_private_value *array_obj, |
91 | int64_t val); | |
17582c6d PP |
92 | |
93 | extern enum bt_value_status bt_private_value_array_append_real_element( | |
b5cdc106 PP |
94 | struct bt_private_value *array_obj, |
95 | double val); | |
17582c6d PP |
96 | |
97 | extern enum bt_value_status bt_private_value_array_append_string_element( | |
98 | struct bt_private_value *array_obj, const char *val); | |
99 | ||
100 | extern enum bt_value_status bt_private_value_array_append_empty_array_element( | |
101 | struct bt_private_value *array_obj); | |
102 | ||
103 | extern enum bt_value_status bt_private_value_array_append_empty_map_element( | |
104 | struct bt_private_value *array_obj); | |
105 | ||
106 | extern enum bt_value_status bt_private_value_array_set_element_by_index( | |
107 | struct bt_private_value *array_obj, uint64_t index, | |
108 | struct bt_value *element_obj); | |
109 | ||
110 | extern struct bt_private_value *bt_private_value_map_create(void); | |
111 | ||
112 | extern struct bt_private_value *bt_private_value_map_borrow_entry_value( | |
113 | const struct bt_private_value *map_obj, const char *key); | |
114 | ||
115 | typedef bt_bool (* bt_private_value_map_foreach_entry_cb)(const char *key, | |
b5cdc106 | 116 | struct bt_private_value *object, void *data); |
17582c6d PP |
117 | |
118 | extern enum bt_value_status bt_private_value_map_foreach_entry( | |
119 | const struct bt_private_value *map_obj, | |
120 | bt_private_value_map_foreach_entry_cb cb, void *data); | |
121 | ||
122 | extern enum bt_value_status bt_private_value_map_insert_entry( | |
123 | struct bt_private_value *map_obj, const char *key, | |
124 | struct bt_value *element_obj); | |
125 | ||
126 | extern enum bt_value_status bt_private_value_map_insert_bool_entry( | |
127 | struct bt_private_value *map_obj, const char *key, bt_bool val); | |
128 | ||
129 | extern enum bt_value_status bt_private_value_map_insert_integer_entry( | |
130 | struct bt_private_value *map_obj, const char *key, int64_t val); | |
131 | ||
132 | extern enum bt_value_status bt_private_value_map_insert_real_entry( | |
133 | struct bt_private_value *map_obj, const char *key, double val); | |
134 | ||
135 | extern enum bt_value_status bt_private_value_map_insert_string_entry( | |
b5cdc106 PP |
136 | struct bt_private_value *map_obj, const char *key, |
137 | const char *val); | |
17582c6d PP |
138 | |
139 | extern enum bt_value_status bt_private_value_map_insert_empty_array_entry( | |
140 | struct bt_private_value *map_obj, const char *key); | |
141 | ||
142 | extern enum bt_value_status bt_private_value_map_insert_empty_map_entry( | |
143 | struct bt_private_value *map_obj, const char *key); | |
144 | ||
145 | #ifdef __cplusplus | |
146 | } | |
147 | #endif | |
148 | ||
149 | #endif /* BABELTRACE_PRIVATE_VALUES_H */ |