1 #ifndef BABELTRACE_PRIVATE_VALUES_H
2 #define BABELTRACE_PRIVATE_VALUES_H
5 * Copyright (c) 2015-2016 EfficiOS Inc. and Linux Foundation
6 * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com>
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:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
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
30 /* For enum bt_value_status */
31 #include <babeltrace/values.h>
38 struct bt_private_value
;
40 extern struct bt_private_value
*bt_private_value_null
;
43 struct bt_value
*bt_private_value_borrow_value(
44 struct bt_private_value
*priv_value
)
46 return (void *) priv_value
;
49 extern struct bt_private_value
*bt_private_value_bool_create(void);
51 extern struct bt_private_value
*bt_private_value_bool_create_init(bt_bool val
);
53 extern void bt_private_value_bool_set(struct bt_private_value
*bool_obj
,
56 extern struct bt_private_value
*bt_private_value_integer_create(void);
58 extern struct bt_private_value
*bt_private_value_integer_create_init(
61 extern void bt_private_value_integer_set(
62 struct bt_private_value
*integer_obj
, int64_t val
);
64 extern struct bt_private_value
*bt_private_value_real_create(void);
66 extern struct bt_private_value
*bt_private_value_real_create_init(double val
);
68 extern void bt_private_value_real_set(
69 struct bt_private_value
*real_obj
, double val
);
71 extern struct bt_private_value
*bt_private_value_string_create(void);
73 extern struct bt_private_value
*bt_private_value_string_create_init(
76 extern enum bt_value_status
bt_private_value_string_set(
77 struct bt_private_value
*string_obj
,
80 extern struct bt_private_value
*bt_private_value_array_create(void);
82 extern struct bt_private_value
*bt_private_value_array_borrow_element_by_index(
83 const struct bt_private_value
*array_obj
, uint64_t index
);
85 extern enum bt_value_status
bt_private_value_array_append_element(
86 struct bt_private_value
*array_obj
,
87 struct bt_value
*element_obj
);
89 extern enum bt_value_status
bt_private_value_array_append_bool_element(
90 struct bt_private_value
*array_obj
,
93 extern enum bt_value_status
bt_private_value_array_append_integer_element(
94 struct bt_private_value
*array_obj
,
97 extern enum bt_value_status
bt_private_value_array_append_real_element(
98 struct bt_private_value
*array_obj
,
101 extern enum bt_value_status
bt_private_value_array_append_string_element(
102 struct bt_private_value
*array_obj
, const char *val
);
104 extern enum bt_value_status
bt_private_value_array_append_empty_array_element(
105 struct bt_private_value
*array_obj
);
107 extern enum bt_value_status
bt_private_value_array_append_empty_map_element(
108 struct bt_private_value
*array_obj
);
110 extern enum bt_value_status
bt_private_value_array_set_element_by_index(
111 struct bt_private_value
*array_obj
, uint64_t index
,
112 struct bt_value
*element_obj
);
114 extern struct bt_private_value
*bt_private_value_map_create(void);
116 extern struct bt_private_value
*bt_private_value_map_borrow_entry_value(
117 const struct bt_private_value
*map_obj
, const char *key
);
119 typedef bt_bool (* bt_private_value_map_foreach_entry_cb
)(const char *key
,
120 struct bt_private_value
*object
, void *data
);
122 extern enum bt_value_status
bt_private_value_map_foreach_entry(
123 const struct bt_private_value
*map_obj
,
124 bt_private_value_map_foreach_entry_cb cb
, void *data
);
126 extern enum bt_value_status
bt_private_value_map_insert_entry(
127 struct bt_private_value
*map_obj
, const char *key
,
128 struct bt_value
*element_obj
);
130 extern enum bt_value_status
bt_private_value_map_insert_bool_entry(
131 struct bt_private_value
*map_obj
, const char *key
, bt_bool val
);
133 extern enum bt_value_status
bt_private_value_map_insert_integer_entry(
134 struct bt_private_value
*map_obj
, const char *key
, int64_t val
);
136 extern enum bt_value_status
bt_private_value_map_insert_real_entry(
137 struct bt_private_value
*map_obj
, const char *key
, double val
);
139 extern enum bt_value_status
bt_private_value_map_insert_string_entry(
140 struct bt_private_value
*map_obj
, const char *key
,
143 extern enum bt_value_status
bt_private_value_map_insert_empty_array_entry(
144 struct bt_private_value
*map_obj
, const char *key
);
146 extern enum bt_value_status
bt_private_value_map_insert_empty_map_entry(
147 struct bt_private_value
*map_obj
, const char *key
);
153 #endif /* BABELTRACE_PRIVATE_VALUES_H */