Make them look more like the rest of the API.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
for (i = 0; i < comps->len; i++) {
struct bt_config_component *comp = g_ptr_array_index(comps, i);
- if (!bt_value_map_has_key(connected_components,
+ if (!bt_value_map_has_entry(connected_components,
comp->instance_name->str)) {
snprintf(error_buf, error_buf_size,
"Component `%s` is not connected\n",
struct bt_config_connection *connection =
g_ptr_array_index(cfg->cmd_data.run.connections, i);
- ret = bt_value_map_insert(connected_components,
+ ret = bt_value_map_insert_entry(connected_components,
connection->upstream_comp_name->str, bt_value_null);
if (ret) {
goto end;
}
- ret = bt_value_map_insert(connected_components,
+ ret = bt_value_map_insert_entry(connected_components,
connection->downstream_comp_name->str, bt_value_null);
if (ret) {
goto end;
connection->downstream_comp_name->str,
connection->downstream_port_glob->str);
- if (bt_value_map_has_key(flat_connection_names,
+ if (bt_value_map_has_entry(flat_connection_names,
flat_connection_name->str)) {
snprintf(error_buf, error_buf_size,
"Duplicate connection:\n %s\n",
goto end;
}
- ret = bt_value_map_insert(flat_connection_names,
+ ret = bt_value_map_insert_entry(flat_connection_names,
flat_connection_name->str, bt_value_null);
if (ret) {
goto end;
goto error;
}
- for (i = 0; i < bt_value_array_size(connection_args); i++) {
+ for (i = 0; i < bt_value_array_get_size(connection_args); i++) {
struct bt_value *arg_value =
- bt_value_array_get(connection_args, i);
+ bt_value_array_borrow_element_by_index(
+ connection_args, i);
const char *arg;
struct bt_config_connection *cfg_connection;
ret = bt_value_string_get(arg_value, &arg);
- BT_PUT(arg_value);
BT_ASSERT(ret == 0);
cfg_connection = cfg_connection_from_arg(arg);
if (!cfg_connection) {
goto error;
}
- if (bt_value_map_has_key(state->params, state->last_map_key)) {
+ if (bt_value_map_has_entry(state->params, state->last_map_key)) {
g_string_append_printf(state->ini_error,
"Duplicate parameter key: `%s`\n",
state->last_map_key);
success:
if (value) {
- if (bt_value_map_insert(state->params,
+ if (bt_value_map_insert_entry(state->params,
state->last_map_key, value)) {
/* Only override return value on error */
ret = -1;
!strcmp(identifier, "args") ||
!strcmp(identifier, "arg")) {
found_item = true;
- if (bt_value_array_append_string(names,
+ if (bt_value_array_append_string_element(names,
"payload")) {
goto error;
}
} else if (!strcmp(identifier, "context") ||
!strcmp(identifier, "ctx")) {
found_item = true;
- if (bt_value_array_append_string(names,
+ if (bt_value_array_append_string_element(names,
"context")) {
goto error;
}
} else if (!strcmp(identifier, "scope") ||
!strcmp(identifier, "header")) {
found_item = true;
- if (bt_value_array_append_string(names,
+ if (bt_value_array_append_string_element(names,
identifier)) {
goto error;
}
} else if (!strcmp(identifier, "all")) {
found_all = true;
- if (bt_value_array_append_string(names,
+ if (bt_value_array_append_string_element(names,
identifier)) {
goto error;
}
} else if (!strcmp(identifier, "none")) {
found_none = true;
- if (bt_value_array_append_string(names,
+ if (bt_value_array_append_string_element(names,
identifier)) {
goto error;
}
* least one item is specified.
*/
if (found_item && !found_none && !found_all) {
- if (bt_value_array_append_string(names, "none")) {
+ if (bt_value_array_append_string_element(names, "none")) {
goto error;
}
}
!strcmp(identifier, "emf") ||
!strcmp(identifier, "callsite") ||
!strcmp(identifier, "all")) {
- if (bt_value_array_append_string(fields,
+ if (bt_value_array_append_string_element(fields,
identifier)) {
goto error;
}
goto end;
}
- for (i = 0; i < bt_value_array_size(names_array); i++) {
- struct bt_value *str_obj = bt_value_array_get(names_array, i);
+ for (i = 0; i < bt_value_array_get_size(names_array); i++) {
+ struct bt_value *str_obj =
+ bt_value_array_borrow_element_by_index(names_array, i);
const char *suffix;
bool is_default = false;
}
ret = bt_value_string_get(str_obj, &suffix);
- BT_PUT(str_obj);
if (ret) {
printf_err("Unexpected error\n");
goto end;
goto end;
}
- if (bt_value_map_has_key(instance_names, cfg_comp->instance_name->str)) {
+ if (bt_value_map_has_entry(instance_names, cfg_comp->instance_name->str)) {
printf_err("Duplicate component instance name:\n %s\n",
cfg_comp->instance_name->str);
ret = -1;
goto end;
}
- if (bt_value_map_insert(instance_names,
+ if (bt_value_map_insert_entry(instance_names,
cfg_comp->instance_name->str, bt_value_null)) {
print_err_oom();
ret = -1;
goto error;
}
- if (bt_value_map_insert_string(cur_cfg_comp->params,
+ if (bt_value_map_insert_string_entry(cur_cfg_comp->params,
cur_param_key->str, arg)) {
print_err_oom();
goto error;
}
break;
case OPT_CONNECT:
- if (bt_value_array_append_string(connection_args,
- arg)) {
+ if (bt_value_array_append_string_element(
+ connection_args, arg)) {
print_err_oom();
goto error;
}
struct bt_config *cfg = NULL;
const char **argv;
int64_t i, len;
- const size_t argc = bt_value_array_size(run_args) + 1;
+ const size_t argc = bt_value_array_get_size(run_args) + 1;
argv = calloc(argc, sizeof(*argv));
if (!argv) {
argv[0] = "run";
- len = bt_value_array_size(run_args);
+ len = bt_value_array_get_size(run_args);
if (len < 0) {
printf_err("Invalid executable arguments\n");
goto end;
}
for (i = 0; i < len; i++) {
int ret;
- struct bt_value *arg_value = bt_value_array_get(run_args, i);
+ struct bt_value *arg_value =
+ bt_value_array_borrow_element_by_index(run_args, i);
const char *arg;
BT_ASSERT(arg_value);
BT_ASSERT(ret == 0);
BT_ASSERT(arg);
argv[i + 1] = arg;
- bt_put(arg_value);
}
cfg = bt_config_run_from_args(argc, argv, retcode,
goto end;
}
- if (!bt_value_map_has_key(existing_names, prefix)) {
+ if (!bt_value_map_has_entry(existing_names, prefix)) {
g_string_assign(auto_name, prefix);
goto end;
}
do {
g_string_printf(auto_name, "%s-%d", prefix, i);
i++;
- } while (bt_value_map_has_key(existing_names, auto_name->str));
+ } while (bt_value_map_has_entry(existing_names, auto_name->str));
end:
return auto_name;
g_string_assign(args->name_arg, name->str);
- if (bt_value_map_insert(existing_names, name->str,
+ if (bt_value_map_insert_entry(existing_names, name->str,
bt_value_null)) {
print_err_oom();
ret = -1;
goto end;
}
- if (bt_value_array_append_string(run_args, "--component")) {
+ if (bt_value_array_append_string_element(run_args, "--component")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, impl_args->comp_arg->str)) {
+ if (bt_value_array_append_string_element(run_args, impl_args->comp_arg->str)) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, "--name")) {
+ if (bt_value_array_append_string_element(run_args, "--name")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, impl_args->name_arg->str)) {
+ if (bt_value_array_append_string_element(run_args, impl_args->name_arg->str)) {
print_err_oom();
goto error;
}
if (impl_args->params_arg->len > 0) {
- if (bt_value_array_append_string(run_args, "--params")) {
+ if (bt_value_array_append_string_element(run_args, "--params")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string_element(run_args,
impl_args->params_arg->str)) {
print_err_oom();
goto error;
}
}
- for (i = 0; i < bt_value_array_size(impl_args->extra_params); i++) {
+ for (i = 0; i < bt_value_array_get_size(impl_args->extra_params); i++) {
struct bt_value *elem;
const char *arg;
- elem = bt_value_array_get(impl_args->extra_params, i);
+ elem = bt_value_array_borrow_element_by_index(
+ impl_args->extra_params, i);
if (!elem) {
goto error;
}
goto error;
}
- ret = bt_value_array_append_string(run_args, arg);
- bt_put(elem);
+ ret = bt_value_array_append_string_element(run_args, arg);
if (ret) {
print_err_oom();
goto error;
BT_ASSERT(key);
BT_ASSERT(value);
- if (bt_value_array_append_string(args->extra_params, "--key")) {
+ if (bt_value_array_append_string_element(args->extra_params, "--key")) {
print_err_oom();
ret = -1;
goto end;
}
- if (bt_value_array_append_string(args->extra_params, key)) {
+ if (bt_value_array_append_string_element(args->extra_params, key)) {
print_err_oom();
ret = -1;
goto end;
}
- if (bt_value_array_append_string(args->extra_params, "--value")) {
+ if (bt_value_array_append_string_element(args->extra_params, "--value")) {
print_err_oom();
ret = -1;
goto end;
}
- if (bt_value_array_append_string(args->extra_params, value)) {
+ if (bt_value_array_append_string_element(args->extra_params, value)) {
print_err_oom();
ret = -1;
goto end;
* An explicit name was provided for the user
* component.
*/
- if (bt_value_map_has_key(all_names,
+ if (bt_value_map_has_entry(all_names,
cur_name->str)) {
printf_err("Duplicate component instance name:\n %s\n",
cur_name->str);
* Remember this name globally, for the uniqueness of
* all component names.
*/
- if (bt_value_map_insert(all_names, name->str, bt_value_null)) {
+ if (bt_value_map_insert_entry(all_names, name->str, bt_value_null)) {
print_err_oom();
goto error;
}
* Append the --name option if necessary.
*/
if (append_name_opt) {
- if (bt_value_array_append_string(run_args, "--name")) {
+ if (bt_value_array_append_string_element(run_args, "--name")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, name->str)) {
+ if (bt_value_array_append_string_element(run_args, name->str)) {
print_err_oom();
goto error;
}
goto end;
}
- ret = bt_value_array_append_string(run_args, "--connect");
+ ret = bt_value_array_append_string_element(run_args, "--connect");
if (ret) {
print_err_oom();
ret = -1;
g_string_append(arg, e_upstream_name->str);
g_string_append_c(arg, ':');
g_string_append(arg, e_downstream_name->str);
- ret = bt_value_array_append_string(run_args, arg->str);
+ ret = bt_value_array_append_string_element(run_args, arg->str);
if (ret) {
print_err_oom();
ret = -1;
abort();
}
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string_element(run_args,
"--component")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string_element(run_args, arg)) {
print_err_oom();
goto error;
}
goto error;
}
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string_element(run_args,
"--params")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string_element(run_args, arg)) {
print_err_oom();
goto error;
}
goto error;
}
- if (bt_value_array_append_string(run_args, "--key")) {
+ if (bt_value_array_append_string_element(run_args, "--key")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, "path")) {
+ if (bt_value_array_append_string_element(run_args, "path")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, "--value")) {
+ if (bt_value_array_append_string_element(run_args, "--value")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string_element(run_args, arg)) {
print_err_oom();
goto error;
}
goto error;
}
- if (bt_value_array_append_string(run_args, "--key")) {
+ if (bt_value_array_append_string_element(run_args, "--key")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, "url")) {
+ if (bt_value_array_append_string_element(run_args, "url")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, "--value")) {
+ if (bt_value_array_append_string_element(run_args, "--value")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string_element(run_args, arg)) {
print_err_oom();
goto error;
}
goto error;
}
- if (bt_value_array_append_string(run_args, "--name")) {
+ if (bt_value_array_append_string_element(run_args, "--name")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string_element(run_args, arg)) {
print_err_oom();
goto error;
}
case OPT_OMIT_HOME_PLUGIN_PATH:
force_omit_home_plugin_path = true;
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string_element(run_args,
"--omit-home-plugin-path")) {
print_err_oom();
goto error;
}
break;
case OPT_RETRY_DURATION:
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string_element(run_args,
"--retry-duration")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string_element(run_args, arg)) {
print_err_oom();
goto error;
}
case OPT_OMIT_SYSTEM_PLUGIN_PATH:
force_omit_system_plugin_path = true;
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string_element(run_args,
"--omit-system-plugin-path")) {
print_err_oom();
goto error;
goto error;
}
- if (bt_value_array_append_string(run_args,
+ if (bt_value_array_append_string_element(run_args,
"--plugin-path")) {
print_err_oom();
goto error;
}
- if (bt_value_array_append_string(run_args, arg)) {
+ if (bt_value_array_append_string_element(run_args, arg)) {
print_err_oom();
goto error;
}
goto error;
}
- for (i = 0; i < bt_value_array_size(run_args); i++) {
+ for (i = 0; i < bt_value_array_get_size(run_args); i++) {
struct bt_value *arg_value =
- bt_value_array_get(run_args, i);
+ bt_value_array_borrow_element_by_index(
+ run_args, i);
const char *arg;
GString *quoted = NULL;
const char *arg_to_print;
BT_ASSERT(arg_value);
ret = bt_value_string_get(arg_value, &arg);
BT_ASSERT(ret == 0);
- BT_PUT(arg_value);
if (print_run_args) {
quoted = bt_common_shell_quote(arg, true);
g_string_free(quoted, TRUE);
}
- if (i < bt_value_array_size(run_args) - 1) {
+ if (i < bt_value_array_get_size(run_args) - 1) {
if (print_run_args) {
putchar(' ');
} else {
for (i = 0; i < dirs->len; i++) {
GString *dir = g_ptr_array_index(dirs, i);
- status = bt_value_array_append_string(plugin_paths, dir->str);
+ status = bt_value_array_append_string_element(plugin_paths, dir->str);
if (status != BT_VALUE_STATUS_OK) {
break;
}
bt_common_color_reset());
break;
case BT_VALUE_TYPE_ARRAY:
- size = bt_value_array_size(value);
+ size = bt_value_array_get_size(value);
if (size < 0) {
goto error;
}
for (i = 0; i < size; i++) {
struct bt_value *element =
- bt_value_array_get(value, i);
+ bt_value_array_borrow_element_by_index(
+ value, i);
if (!element) {
goto error;
}
print_value_rec(fp, element, indent + 2);
- BT_PUT(element);
}
break;
case BT_VALUE_TYPE_MAP:
break;
}
- bt_value_map_foreach(value, print_map_value, &data);
+ bt_value_map_foreach_entry(value, print_map_value, &data);
break;
}
default:
{
int nr_paths, i, ret = 0;
- nr_paths = bt_value_array_size(plugin_paths);
+ nr_paths = bt_value_array_get_size(plugin_paths);
if (nr_paths < 0) {
BT_LOGE_STR("Cannot load dynamic plugins: no plugin path.");
ret = -1;
struct bt_plugin_set *plugin_set;
enum bt_value_status status;
- plugin_path_value = bt_value_array_get(plugin_paths, i);
+ plugin_path_value = bt_value_array_borrow_element_by_index(
+ plugin_paths, i);
status = bt_value_string_get(plugin_path_value, &plugin_path);
if (status != BT_VALUE_STATUS_OK) {
BT_LOGD_STR("Cannot get plugin path string.");
- BT_PUT(plugin_path_value);
continue;
}
if (!g_file_test(plugin_path, G_FILE_TEST_IS_DIR)) {
BT_LOGV("Skipping nonexistent directory path: "
"path=\"%s\"", plugin_path);
- BT_PUT(plugin_path_value);
continue;
}
if (!plugin_set) {
BT_LOGD("Unable to load dynamic plugins: path=\"%s\"",
plugin_path);
- BT_PUT(plugin_path_value);
continue;
}
add_to_loaded_plugins(plugin_set);
bt_put(plugin_set);
- BT_PUT(plugin_path_value);
}
end:
return ret;
goto error;
}
- ret = bt_value_map_insert_string(params, "url",
+ ret = bt_value_map_insert_string_entry(params, "url",
cfg->cmd_data.print_lttng_live_sessions.url->str);
if (ret) {
goto error;
}
}
- array_size = bt_value_array_size(results);
+ array_size = bt_value_array_get_size(results);
for (i = 0; i < array_size; i++) {
const char *url_text;
int64_t timer_us, streams, clients;
- map = bt_value_array_get(results, i);
+ map = bt_value_array_borrow_element_by_index(results, i);
if (!map) {
BT_LOGE_STR("Unexpected empty array entry.");
goto error;
goto error;
}
- v = bt_value_map_get(map, "url");
+ v = bt_value_map_borrow_entry_value(map, "url");
if (!v) {
BT_LOGE_STR("Unexpected empty array \"url\" entry.");
goto error;
ret = bt_value_string_get(v, &url_text);
BT_ASSERT(ret == 0);
fprintf(out_stream, "%s", url_text);
- BT_PUT(v);
-
- v = bt_value_map_get(map, "timer-us");
+ v = bt_value_map_borrow_entry_value(map, "timer-us");
if (!v) {
BT_LOGE_STR("Unexpected empty array \"timer-us\" entry.");
goto error;
ret = bt_value_integer_get(v, &timer_us);
BT_ASSERT(ret == 0);
fprintf(out_stream, " (timer = %" PRIu64 ", ", timer_us);
- BT_PUT(v);
-
- v = bt_value_map_get(map, "stream-count");
+ v = bt_value_map_borrow_entry_value(map, "stream-count");
if (!v) {
BT_LOGE_STR("Unexpected empty array \"stream-count\" entry.");
goto error;
ret = bt_value_integer_get(v, &streams);
BT_ASSERT(ret == 0);
fprintf(out_stream, "%" PRIu64 " stream(s), ", streams);
- BT_PUT(v);
-
- v = bt_value_map_get(map, "client-count");
+ v = bt_value_map_borrow_entry_value(map, "client-count");
if (!v) {
BT_LOGE_STR("Unexpected empty array \"client-count\" entry.");
goto error;
ret = bt_value_integer_get(v, &clients);
BT_ASSERT(ret == 0);
fprintf(out_stream, "%" PRIu64 " client(s) connected)\n", clients);
- BT_PUT(v);
-
- BT_PUT(map);
}
goto end;
ret = -1;
end:
- bt_put(v);
- bt_put(map);
bt_put(results);
bt_put(params);
bt_put(comp_cls);
goto end;
}
- ret = bt_value_map_insert_string(params, "path",
+ ret = bt_value_map_insert_string_entry(params, "path",
cfg->cmd_data.print_ctf_metadata.path->str);
if (ret) {
ret = -1;
goto failed;
}
- metadata_text_value = bt_value_map_get(results, "text");
+ metadata_text_value = bt_value_map_borrow_entry_value(results, "text");
if (!metadata_text_value) {
BT_LOGE_STR("Cannot find `text` string value in the resulting metadata info object.");
ret = -1;
destroy_the_query_executor();
bt_put(results);
bt_put(params);
- bt_put(metadata_text_value);
bt_put(comp_cls);
if (out_stream && out_stream != stdout) {
goto error;
}
- status = bt_value_map_insert_string(trimmer_params,
- "begin", intersection_begin);
+ status = bt_value_map_insert_string_entry(
+ trimmer_params, "begin", intersection_begin);
if (status != BT_VALUE_STATUS_OK) {
goto error;
}
- status = bt_value_map_insert_string(trimmer_params,
+ status = bt_value_map_insert_string_entry(
+ trimmer_params,
"end", intersection_end);
if (status != BT_VALUE_STATUS_OK) {
goto error;
struct trace_range *trace_range = NULL;
const char *fail_reason = NULL;
- component_path_value = bt_value_map_get(cfg_comp->params, "path");
+ component_path_value = bt_value_map_borrow_entry_value(cfg_comp->params,
+ "path");
if (component_path_value && !bt_value_is_string(component_path_value)) {
BT_LOGD("Cannot get path parameter: component-name=%s",
cfg_comp->instance_name->str);
goto error;
}
- value_status = bt_value_map_insert(query_params, "path", component_path_value);
+ value_status = bt_value_map_insert_entry(query_params, "path",
+ component_path_value);
if (value_status != BT_VALUE_STATUS_OK) {
BT_LOGE_STR("Cannot insert path parameter in query parameter map.");
ret = -1;
goto error;
}
- trace_count = bt_value_array_size(query_result);
+ trace_count = bt_value_array_get_size(query_result);
if (trace_count < 0) {
ret = -1;
goto error;
uint64_t stream_idx;
int64_t stream_count;
- trace_info = bt_value_array_get(query_result, trace_idx);
+ trace_info = bt_value_array_borrow_element_by_index(
+ query_result, trace_idx);
if (!trace_info || !bt_value_is_map(trace_info)) {
ret = -1;
BT_LOGD_STR("Cannot retrieve trace from query result.");
goto error;
}
- intersection_range = bt_value_map_get(trace_info,
+ intersection_range = bt_value_map_borrow_entry_value(trace_info,
"intersection-range-ns");
if (!intersection_range) {
ret = -1;
goto error;
}
- intersection_begin = bt_value_map_get(intersection_range,
- "begin");
+ intersection_begin = bt_value_map_borrow_entry_value(
+ intersection_range, "begin");
if (!intersection_begin) {
ret = -1;
BT_LOGD_STR("Cannot retrieve intersection-range-ns \'begin\' field from query result.");
goto error;
}
- intersection_end = bt_value_map_get(intersection_range,
- "end");
+ intersection_end = bt_value_map_borrow_entry_value(
+ intersection_range, "end");
if (!intersection_end) {
ret = -1;
BT_LOGD_STR("Cannot retrieve intersection-range-ns \'end\' field from query result.");
goto error;
}
- stream_infos = bt_value_map_get(trace_info, "streams");
+ stream_infos = bt_value_map_borrow_entry_value(trace_info,
+ "streams");
if (!stream_infos || !bt_value_is_array(stream_infos)) {
ret = -1;
BT_LOGD_STR("Cannot retrieve stream information from trace in query result.");
goto error;
}
- stream_count = bt_value_array_size(stream_infos);
+ stream_count = bt_value_array_get_size(stream_infos);
if (stream_count < 0) {
ret = -1;
goto error;
trace_range->intersection_range_begin_ns = begin;
trace_range->intersection_range_end_ns = end;
- stream_info = bt_value_array_get(stream_infos,
- stream_idx);
+ stream_info = bt_value_array_borrow_element_by_index(
+ stream_infos, stream_idx);
if (!stream_info || !bt_value_is_map(stream_info)) {
ret = -1;
BT_LOGD_STR("Cannot retrieve stream informations from trace in query result.");
goto error;
}
- stream_paths = bt_value_map_get(stream_info, "paths");
+ stream_paths = bt_value_map_borrow_entry_value(
+ stream_info, "paths");
if (!stream_paths || !bt_value_is_array(stream_paths)) {
ret = -1;
BT_LOGD_STR("Cannot retrieve stream paths from trace in query result.");
goto error;
}
- stream_path_value = bt_value_array_get(stream_paths, 0);
+ stream_path_value =
+ bt_value_array_borrow_element_by_index(
+ stream_paths, 0);
if (!stream_path_value ||
!bt_value_is_string(stream_path_value)) {
ret = -1;
port_id = NULL;
trace_range = NULL;
- BT_PUT(stream_info);
- BT_PUT(stream_paths);
- BT_PUT(stream_path_value);
}
-
- BT_PUT(trace_info);
- BT_PUT(stream_paths);
- BT_PUT(stream_path_value);
- BT_PUT(intersection_range);
- BT_PUT(intersection_begin);
- BT_PUT(intersection_end);
- BT_PUT(stream_paths);
- BT_PUT(stream_path_value);
}
goto end;
path ? path : "(unknown)",
bt_common_color_reset());
end:
- bt_put(component_path_value);
bt_put(query_params);
bt_put(query_result);
- bt_put(trace_info);
- bt_put(intersection_range);
- bt_put(intersection_begin);
- bt_put(intersection_end);
- bt_put(stream_infos);
- bt_put(stream_info);
- bt_put(stream_paths);
- bt_put(stream_path_value);
g_free(port_id);
g_free(trace_range);
return ret;
@image html ref-count-callback.png
- For example, see bt_value_map_foreach().
+ For example, see bt_value_map_foreach_entry().
The two macros BT_PUT() and BT_MOVE() operate on \em variables rather
than pointer values. You should use BT_PUT() instead of bt_put() when
As with any Babeltrace object, value objects have
<a href="https://en.wikipedia.org/wiki/Reference_counting">reference
-counts</a>. When you \link bt_value_array_append() append a value object
-to an array value object\endlink, or when you \link bt_value_map_insert()
+counts</a>. When you \link bt_value_array_append_element() append a value object
+to an array value object\endlink, or when you \link bt_value_map_insert_entry()
insert a value object into a map value object\endlink, its reference
count is incremented, as well as when you get a value object back from
those objects. See \ref refs to learn more about the reference counting
<td>bt_value_array_create()
<td>bt_value_is_array()
<td>bt_value_array_get()
- <td>bt_value_array_append()<br>
- bt_value_array_append_bool()<br>
- bt_value_array_append_integer()<br>
- bt_value_array_append_float()<br>
- bt_value_array_append_string()<br>
- bt_value_array_append_empty_array()<br>
- bt_value_array_append_empty_map()<br>
- bt_value_array_set()
+ <td>bt_value_array_append_element()<br>
+ bt_value_array_append_bool_element()<br>
+ bt_value_array_append_integer_element()<br>
+ bt_value_array_append_element_float()<br>
+ bt_value_array_append_string_element()<br>
+ bt_value_array_append_empty_array_element()<br>
+ bt_value_array_append_empty_map_element()<br>
+ bt_value_array_set_element_by_index()
</tr>
<tr>
<th>Map
bt_value_map_extend()
<td>bt_value_is_map()
<td>bt_value_map_get()<br>
- bt_value_map_foreach()
- <td>bt_value_map_insert()<br>
- bt_value_map_insert_bool()<br>
- bt_value_map_insert_integer()<br>
- bt_value_map_insert_float()<br>
- bt_value_map_insert_string()<br>
- bt_value_map_insert_empty_array()<br>
- bt_value_map_insert_empty_map()
+ bt_value_map_foreach_entry()
+ <td>bt_value_map_insert_entry()<br>
+ bt_value_map_insert_bool_entry()<br>
+ bt_value_map_insert_integer_entry()<br>
+ bt_value_map_insert_float_entry()<br>
+ bt_value_map_insert_string_entry()<br>
+ bt_value_map_insert_empty_array_entry()<br>
+ bt_value_map_insert_empty_map_entry()
</tr>
</table>
@sa bt_value_array_is_empty(): Checks whether or not a given array
value object is empty.
*/
-extern int64_t bt_value_array_size(const struct bt_value *array_obj);
+extern int64_t bt_value_array_get_size(const struct bt_value *array_obj);
/**
@brief Checks whether or not the array value object \p array_obj
@pre \p array_obj is an array value object.
@postrefcountsame{array_obj}
-@sa bt_value_array_size(): Returns the size of a given array value
+@sa bt_value_array_get_size(): Returns the size of a given array value
object.
*/
extern bt_bool bt_value_array_is_empty(const struct bt_value *array_obj);
-extern struct bt_value *bt_value_array_borrow(const struct bt_value *array_obj,
- uint64_t index);
-
-/**
-@brief Returns the value object contained in the array value object
- \p array_obj at the index \p index.
-
-@param[in] array_obj Array value object of which to get an element.
-@param[in] index Index of value object to get.
-@returns Value object at index \p index on
- success, or \c NULL on error.
-
-@prenotnull{array_obj}
-@pre \p array_obj is an array value object.
-@pre \p index is lesser than the size of \p array_obj (see
- bt_value_array_size()).
-@post <strong>On success, if the returned value object is not
- \ref bt_value_null</strong>, its reference count is incremented.
-@postrefcountsame{array_obj}
-*/
-static inline
-struct bt_value *bt_value_array_get(const struct bt_value *array_obj,
- uint64_t index)
-{
- return bt_get(bt_value_array_borrow(array_obj, index));
-}
+extern struct bt_value *bt_value_array_borrow_element_by_index(
+ const struct bt_value *array_obj, uint64_t index);
/**
@brief Appends the value object \p element_obj to the array value
\ref bt_value_null</strong>, its reference count is incremented.
@postrefcountsame{array_obj}
-@sa bt_value_array_append_bool(): Appends a boolean raw value to a
+@sa bt_value_array_append_bool_element(): Appends a boolean raw value to a
given array value object.
-@sa bt_value_array_append_integer(): Appends an integer raw value
+@sa bt_value_array_append_integer_element(): Appends an integer raw value
to a given array value object.
-@sa bt_value_array_append_float(): Appends a floating point number
+@sa bt_value_array_append_element_float(): Appends a floating point number
raw value to a given array value object.
-@sa bt_value_array_append_string(): Appends a string raw value to a
+@sa bt_value_array_append_string_element(): Appends a string raw value to a
given array value object.
-@sa bt_value_array_append_empty_array(): Appends an empty array value
+@sa bt_value_array_append_empty_array_element(): Appends an empty array value
object to a given array value object.
-@sa bt_value_array_append_empty_map(): Appends an empty map value
+@sa bt_value_array_append_empty_map_element(): Appends an empty map value
object to a given array value object.
*/
-extern enum bt_value_status bt_value_array_append(struct bt_value *array_obj,
- struct bt_value *element_obj);
+extern enum bt_value_status bt_value_array_append_element(
+ struct bt_value *array_obj, struct bt_value *element_obj);
/**
@brief Appends the boolean raw value \p val to the array value object
@prehot{array_obj}
@postrefcountsame{array_obj}
-@sa bt_value_array_append(): Appends a value object to a given
+@sa bt_value_array_append_element(): Appends a value object to a given
array value object.
*/
-extern enum bt_value_status bt_value_array_append_bool(
+extern enum bt_value_status bt_value_array_append_bool_element(
struct bt_value *array_obj, bt_bool val);
/**
@prehot{array_obj}
@postrefcountsame{array_obj}
-@sa bt_value_array_append(): Appends a value object to a given
+@sa bt_value_array_append_element(): Appends a value object to a given
array value object.
*/
-extern enum bt_value_status bt_value_array_append_integer(
+extern enum bt_value_status bt_value_array_append_integer_element(
struct bt_value *array_obj, int64_t val);
/**
@prehot{array_obj}
@postrefcountsame{array_obj}
-@sa bt_value_array_append(): Appends a value object to a given
+@sa bt_value_array_append_element(): Appends a value object to a given
array value object.
*/
-extern enum bt_value_status bt_value_array_append_real(
+extern enum bt_value_status bt_value_array_append_real_element(
struct bt_value *array_obj, double val);
/**
@prehot{array_obj}
@postrefcountsame{array_obj}
-@sa bt_value_array_append(): Appends a value object to a given
+@sa bt_value_array_append_element(): Appends a value object to a given
array value object.
*/
-extern enum bt_value_status bt_value_array_append_string(
+extern enum bt_value_status bt_value_array_append_string_element(
struct bt_value *array_obj, const char *val);
/**
@prehot{array_obj}
@postrefcountsame{array_obj}
-@sa bt_value_array_append(): Appends a value object to a given
+@sa bt_value_array_append_element(): Appends a value object to a given
array value object.
*/
-extern enum bt_value_status bt_value_array_append_empty_array(
+extern enum bt_value_status bt_value_array_append_empty_array_element(
struct bt_value *array_obj);
/**
@prehot{array_obj}
@postrefcountsame{array_obj}
-@sa bt_value_array_append(): Appends a value object to a given
+@sa bt_value_array_append_element(): Appends a value object to a given
array value object.
*/
-extern enum bt_value_status bt_value_array_append_empty_map(
+extern enum bt_value_status bt_value_array_append_empty_map_element(
struct bt_value *array_obj);
/**
@prenotnull{element_obj}
@pre \p array_obj is an array value object.
@pre \p index is lesser than the size of \p array_obj (see
- bt_value_array_size()).
+ bt_value_array_get_size()).
@prehot{array_obj}
@post <strong>On success, if the replaced value object is not
\ref bt_value_null</strong>, its reference count is decremented.
\ref bt_value_null</strong>, its reference count is incremented.
@postrefcountsame{array_obj}
*/
-extern enum bt_value_status bt_value_array_set(struct bt_value *array_obj,
- uint64_t index, struct bt_value *element_obj);
+extern enum bt_value_status bt_value_array_set_element_by_index(
+ struct bt_value *array_obj, uint64_t index,
+ struct bt_value *element_obj);
/** @} */
@sa bt_value_map_is_empty(): Checks whether or not a given map value
object is empty.
*/
-extern int64_t bt_value_map_size(const struct bt_value *map_obj);
+extern int64_t bt_value_map_get_size(const struct bt_value *map_obj);
/**
@brief Checks whether or not the map value object \p map_obj is empty.
@pre \p map_obj is a map value object.
@postrefcountsame{map_obj}
-@sa bt_value_map_size(): Returns the size of a given map value object.
+@sa bt_value_map_get_size(): Returns the size of a given map value object.
*/
extern bt_bool bt_value_map_is_empty(const struct bt_value *map_obj);
-extern struct bt_value *bt_value_map_borrow(const struct bt_value *map_obj,
- const char *key);
-
-/**
-@brief Returns the value object associated with the key \p key within
- the map value object \p map_obj.
-
-@param[in] map_obj Map value object of which to get an entry.
-@param[in] key Key of the value object to get.
-@returns Value object associated with the key \p key
- on success, or \c NULL on error.
-
-@prenotnull{map_obj}
-@prenotnull{key}
-@pre \p map_obj is a map value object.
-@postrefcountsame{map_obj}
-@post <strong>On success, if the returned value object is not
- \ref bt_value_null</strong>, its reference count is incremented.
-*/
-static inline
-struct bt_value *bt_value_map_get(const struct bt_value *map_obj,
- const char *key)
-{
- return bt_get(bt_value_map_borrow(map_obj, key));
-}
+extern struct bt_value *bt_value_map_borrow_entry_value(
+ const struct bt_value *map_obj, const char *key);
/**
-@brief User function type to use with bt_value_map_foreach().
+@brief User function type to use with bt_value_map_foreach_entry().
\p object is a <em>weak reference</em>: you \em must pass it to bt_get()
if you need to keep a reference after this function returns.
@post The reference count of \p object is not lesser than what it is
when the function is called.
*/
-typedef bt_bool (* bt_value_map_foreach_cb)(const char *key,
+typedef bt_bool (* bt_value_map_foreach_entry_cb)(const char *key,
struct bt_value *object, void *data);
/**
@pre \p map_obj is a map value object.
@postrefcountsame{map_obj}
*/
-extern enum bt_value_status bt_value_map_foreach(
- const struct bt_value *map_obj, bt_value_map_foreach_cb cb,
- void *data);
+extern enum bt_value_status bt_value_map_foreach_entry(
+ const struct bt_value *map_obj,
+ bt_value_map_foreach_entry_cb cb, void *data);
/**
@brief Returns whether or not the map value object \p map_obj contains
@pre \p map_obj is a map value object.
@postrefcountsame{map_obj}
*/
-extern bt_bool bt_value_map_has_key(const struct bt_value *map_obj,
+extern bt_bool bt_value_map_has_entry(const struct bt_value *map_obj,
const char *key);
/**
\ref bt_value_null</strong>, its reference count is incremented.
@postrefcountsame{map_obj}
-@sa bt_value_map_insert_bool(): Inserts a boolean raw value into a
+@sa bt_value_map_insert_bool_entry(): Inserts a boolean raw value into a
given map value object.
-@sa bt_value_map_insert_integer(): Inserts an integer raw value into
+@sa bt_value_map_insert_integer_entry(): Inserts an integer raw value into
a given map value object.
-@sa bt_value_map_insert_float(): Inserts a floating point number raw
+@sa bt_value_map_insert_float_entry(): Inserts a floating point number raw
value into a given map value object.
-@sa bt_value_map_insert_string(): Inserts a string raw value into a
+@sa bt_value_map_insert_string_entry(): Inserts a string raw value into a
given map value object.
-@sa bt_value_map_insert_empty_array(): Inserts an empty array value
+@sa bt_value_map_insert_empty_array_entry(): Inserts an empty array value
object into a given map value object.
-@sa bt_value_map_insert_empty_map(): Inserts an empty map value
+@sa bt_value_map_insert_empty_map_entry(): Inserts an empty map value
object into a given map value object.
*/
-extern enum bt_value_status bt_value_map_insert(
+extern enum bt_value_status bt_value_map_insert_entry(
struct bt_value *map_obj, const char *key,
struct bt_value *element_obj);
@prehot{map_obj}
@postrefcountsame{map_obj}
-@sa bt_value_map_insert(): Inserts a value object into a given map
+@sa bt_value_map_insert_entry(): Inserts a value object into a given map
value object.
*/
-extern enum bt_value_status bt_value_map_insert_bool(
+extern enum bt_value_status bt_value_map_insert_bool_entry(
struct bt_value *map_obj, const char *key, bt_bool val);
/**
@prehot{map_obj}
@postrefcountsame{map_obj}
-@sa bt_value_map_insert(): Inserts a value object into a given map
+@sa bt_value_map_insert_entry(): Inserts a value object into a given map
value object.
*/
-extern enum bt_value_status bt_value_map_insert_integer(
+extern enum bt_value_status bt_value_map_insert_integer_entry(
struct bt_value *map_obj, const char *key, int64_t val);
/**
@prehot{map_obj}
@postrefcountsame{map_obj}
-@sa bt_value_map_insert(): Inserts a value object into a given map
+@sa bt_value_map_insert_entry(): Inserts a value object into a given map
value object.
*/
-extern enum bt_value_status bt_value_map_insert_real(
+extern enum bt_value_status bt_value_map_insert_real_entry(
struct bt_value *map_obj, const char *key, double val);
/**
@prehot{map_obj}
@postrefcountsame{map_obj}
-@sa bt_value_map_insert(): Inserts a value object into a given map
+@sa bt_value_map_insert_entry(): Inserts a value object into a given map
value object.
*/
-extern enum bt_value_status bt_value_map_insert_string(
+extern enum bt_value_status bt_value_map_insert_string_entry(
struct bt_value *map_obj, const char *key, const char *val);
/**
@prehot{map_obj}
@postrefcountsame{map_obj}
-@sa bt_value_map_insert(): Inserts a value object into a given map
+@sa bt_value_map_insert_entry(): Inserts a value object into a given map
value object.
*/
-extern enum bt_value_status bt_value_map_insert_empty_array(
+extern enum bt_value_status bt_value_map_insert_empty_array_entry(
struct bt_value *map_obj, const char *key);
/**
@prehot{map_obj}
@postrefcountsame{map_obj}
-@sa bt_value_map_insert(): Inserts a value object into a given map
+@sa bt_value_map_insert_entry(): Inserts a value object into a given map
value object.
*/
-extern enum bt_value_status bt_value_map_insert_empty_map(
+extern enum bt_value_status bt_value_map_insert_empty_map_entry(
struct bt_value *map_obj, const char *key);
/**
BT_HIDDEN
int64_t bt_ctf_attributes_get_count(struct bt_value *attr_obj)
{
- return bt_value_array_size(attr_obj);
+ return bt_value_array_get_size(attr_obj);
}
BT_HIDDEN
goto end;
}
- if (index >= bt_value_array_size(attr_obj)) {
+ if (index >= bt_value_array_get_size(attr_obj)) {
BT_LOGW("Invalid parameter: index is out of bounds: "
"index=%" PRIu64 ", count=%" PRId64,
- index, bt_value_array_size(attr_obj));
+ index, bt_value_array_get_size(attr_obj));
goto end;
}
- attr_field_obj = bt_value_array_borrow(attr_obj, index);
+ attr_field_obj = bt_value_array_borrow_element_by_index(attr_obj, index);
if (!attr_field_obj) {
BT_LOGE("Cannot get attributes object's array value's element by index: "
"value-addr=%p, index=%" PRIu64, attr_obj, index);
goto end;
}
- attr_field_name_obj = bt_value_array_borrow(attr_field_obj,
+ attr_field_name_obj = bt_value_array_borrow_element_by_index(attr_field_obj,
BT_CTF_ATTR_NAME_INDEX);
if (!attr_field_name_obj) {
BT_LOGE("Cannot get attribute array value's element by index: "
goto end;
}
- if (index >= bt_value_array_size(attr_obj)) {
+ if (index >= bt_value_array_get_size(attr_obj)) {
BT_LOGW("Invalid parameter: index is out of bounds: "
"index=%" PRIu64 ", count=%" PRId64,
- index, bt_value_array_size(attr_obj));
+ index, bt_value_array_get_size(attr_obj));
goto end;
}
- attr_field_obj = bt_value_array_borrow(attr_obj, index);
+ attr_field_obj = bt_value_array_borrow_element_by_index(attr_obj, index);
if (!attr_field_obj) {
BT_LOGE("Cannot get attributes object's array value's element by index: "
"value-addr=%p, index=%" PRIu64, attr_obj, index);
goto end;
}
- value_obj = bt_value_array_borrow(attr_field_obj,
+ value_obj = bt_value_array_borrow_element_by_index(attr_field_obj,
BT_CTF_ATTR_VALUE_INDEX);
if (!value_obj) {
BT_LOGE("Cannot get attribute array value's element by index: "
struct bt_value *value_obj = NULL;
struct bt_value *attr_field_name_obj = NULL;
- attr_size = bt_value_array_size(attr_obj);
+ attr_size = bt_value_array_get_size(attr_obj);
if (attr_size < 0) {
BT_LOGE("Cannot get array value's size: value-addr=%p",
attr_obj);
int ret;
const char *field_name;
- value_obj = bt_value_array_borrow(attr_obj, i);
+ value_obj = bt_value_array_borrow_element_by_index(attr_obj, i);
if (!value_obj) {
BT_LOGE("Cannot get attributes object's array value's element by index: "
"value-addr=%p, index=%" PRIu64, attr_obj, i);
goto error;
}
- attr_field_name_obj = bt_value_array_borrow(value_obj,
+ attr_field_name_obj = bt_value_array_borrow_element_by_index(value_obj,
BT_CTF_ATTR_NAME_INDEX);
if (!attr_field_name_obj) {
BT_LOGE("Cannot get attribute array value's element by index: "
attr_field_obj = bt_ctf_attributes_borrow_field_by_name(attr_obj, name);
if (attr_field_obj) {
- ret = bt_value_array_set(attr_field_obj,
+ ret = bt_value_array_set_element_by_index(attr_field_obj,
BT_CTF_ATTR_VALUE_INDEX, value_obj);
attr_field_obj = NULL;
goto end;
goto end;
}
- ret = bt_value_array_append_string(attr_field_obj, name);
- ret |= bt_value_array_append(attr_field_obj, value_obj);
+ ret = bt_value_array_append_string_element(attr_field_obj, name);
+ ret |= bt_value_array_append_element(attr_field_obj, value_obj);
if (ret) {
BT_LOGE("Cannot append elements to array value: addr=%p",
attr_field_obj);
goto end;
}
- ret = bt_value_array_append(attr_obj, attr_field_obj);
+ ret = bt_value_array_append_element(attr_obj, attr_field_obj);
if (ret) {
BT_LOGE("Cannot append element to array value: "
"array-value-addr=%p, element-value-addr=%p",
goto end;
}
- value_obj = bt_value_array_borrow(attr_field_obj,
+ value_obj = bt_value_array_borrow_element_by_index(attr_field_obj,
BT_CTF_ATTR_VALUE_INDEX);
if (!value_obj) {
BT_LOGE("Cannot get attribute array value's element by index: "
}
BT_LOGD("Freezing attributes object: value-addr=%p", attr_obj);
- count = bt_value_array_size(attr_obj);
+ count = bt_value_array_get_size(attr_obj);
BT_ASSERT(count >= 0);
/*
}
case BT_VALUE_TYPE_ARRAY:
{
- int64_t count = bt_value_array_size(value);
+ int64_t count = bt_value_array_get_size(value);
BT_ASSERT(count >= 0);
BUF_APPEND(", %selement-count=%" PRId64, PRFIELD(count));
}
case BT_VALUE_TYPE_MAP:
{
- int64_t count = bt_value_map_size(value);
+ int64_t count = bt_value_map_get_size(value);
BT_ASSERT(count >= 0);
BUF_APPEND(", %selement-count=%" PRId64, PRFIELD(count));
BT_HIDDEN
int64_t bt_attributes_get_count(struct bt_value *attr_obj)
{
- return bt_value_array_size(attr_obj);
+ return bt_value_array_get_size(attr_obj);
}
BT_HIDDEN
goto end;
}
- if (index >= bt_value_array_size(attr_obj)) {
+ if (index >= bt_value_array_get_size(attr_obj)) {
BT_LOGW("Invalid parameter: index is out of bounds: "
"index=%" PRIu64 ", count=%" PRId64,
- index, bt_value_array_size(attr_obj));
+ index, bt_value_array_get_size(attr_obj));
goto end;
}
- attr_field_obj = bt_value_array_borrow(attr_obj, index);
+ attr_field_obj = bt_value_array_borrow_element_by_index(attr_obj, index);
if (!attr_field_obj) {
BT_LOGE("Cannot get attributes object's array value's element by index: "
"value-addr=%p, index=%" PRIu64, attr_obj, index);
goto end;
}
- attr_field_name_obj = bt_value_array_borrow(attr_field_obj,
+ attr_field_name_obj = bt_value_array_borrow_element_by_index(attr_field_obj,
BT_ATTR_NAME_INDEX);
if (!attr_field_name_obj) {
BT_LOGE("Cannot get attribute array value's element by index: "
goto end;
}
- if (index >= bt_value_array_size(attr_obj)) {
+ if (index >= bt_value_array_get_size(attr_obj)) {
BT_LOGW("Invalid parameter: index is out of bounds: "
"index=%" PRIu64 ", count=%" PRId64,
- index, bt_value_array_size(attr_obj));
+ index, bt_value_array_get_size(attr_obj));
goto end;
}
- attr_field_obj = bt_value_array_borrow(attr_obj, index);
+ attr_field_obj = bt_value_array_borrow_element_by_index(attr_obj, index);
if (!attr_field_obj) {
BT_LOGE("Cannot get attributes object's array value's element by index: "
"value-addr=%p, index=%" PRIu64, attr_obj, index);
goto end;
}
- value_obj = bt_value_array_borrow(attr_field_obj,
+ value_obj = bt_value_array_borrow_element_by_index(attr_field_obj,
BT_ATTR_VALUE_INDEX);
if (!value_obj) {
BT_LOGE("Cannot get attribute array value's element by index: "
struct bt_value *value_obj = NULL;
struct bt_value *attr_field_name_obj = NULL;
- attr_size = bt_value_array_size(attr_obj);
+ attr_size = bt_value_array_get_size(attr_obj);
if (attr_size < 0) {
BT_LOGE("Cannot get array value's size: value-addr=%p",
attr_obj);
int ret;
const char *field_name;
- value_obj = bt_value_array_borrow(attr_obj, i);
+ value_obj = bt_value_array_borrow_element_by_index(attr_obj, i);
if (!value_obj) {
BT_LOGE("Cannot get attributes object's array value's element by index: "
"value-addr=%p, index=%" PRIu64, attr_obj, i);
goto error;
}
- attr_field_name_obj = bt_value_array_borrow(value_obj,
+ attr_field_name_obj = bt_value_array_borrow_element_by_index(value_obj,
BT_ATTR_NAME_INDEX);
if (!attr_field_name_obj) {
BT_LOGE("Cannot get attribute array value's element by index: "
attr_field_obj = bt_attributes_borrow_field_by_name(attr_obj, name);
if (attr_field_obj) {
- ret = bt_value_array_set(attr_field_obj,
+ ret = bt_value_array_set_element_by_index(attr_field_obj,
BT_ATTR_VALUE_INDEX, value_obj);
attr_field_obj = NULL;
goto end;
goto end;
}
- ret = bt_value_array_append_string(attr_field_obj, name);
- ret |= bt_value_array_append(attr_field_obj, value_obj);
+ ret = bt_value_array_append_string_element(attr_field_obj, name);
+ ret |= bt_value_array_append_element(attr_field_obj, value_obj);
if (ret) {
BT_LOGE("Cannot append elements to array value: addr=%p",
attr_field_obj);
goto end;
}
- ret = bt_value_array_append(attr_obj, attr_field_obj);
+ ret = bt_value_array_append_element(attr_obj, attr_field_obj);
if (ret) {
BT_LOGE("Cannot append element to array value: "
"array-value-addr=%p, element-value-addr=%p",
goto end;
}
- value_obj = bt_value_array_borrow(attr_field_obj,
+ value_obj = bt_value_array_borrow_element_by_index(attr_field_obj,
BT_ATTR_VALUE_INDEX);
if (!value_obj) {
BT_LOGE("Cannot get attribute array value's element by index: "
}
BT_LOGD("Freezing attributes object: value-addr=%p", attr_obj);
- count = bt_value_array_size(attr_obj);
+ count = bt_value_array_get_size(attr_obj);
BT_ASSERT(count >= 0);
/*
for (i = 0; i < typed_array_obj->garray->len; ++i) {
struct bt_value *element_obj_copy;
- struct bt_value *element_obj = bt_value_array_borrow(
+ struct bt_value *element_obj = bt_value_array_borrow_element_by_index(
array_obj, i);
BT_ASSERT(element_obj);
goto end;
}
- ret = bt_value_array_append(copy_obj, element_obj_copy);
+ ret = bt_value_array_append_element(copy_obj, element_obj_copy);
BT_PUT(element_obj_copy);
if (ret) {
BT_LOGE("Cannot append to array value: addr=%p",
goto end;
}
- ret = bt_value_map_insert(copy_obj, key_str, element_obj_copy);
+ ret = bt_value_map_insert_entry(copy_obj, key_str, element_obj_copy);
BT_PUT(element_obj_copy);
if (ret) {
BT_LOGE("Cannot insert into map value: addr=%p, key=\"%s\"",
const struct bt_value_array *array_obj_a =
BT_VALUE_TO_ARRAY(object_a);
- if (bt_value_array_size(object_a) != bt_value_array_size(object_b)) {
+ if (bt_value_array_get_size(object_a) != bt_value_array_get_size(object_b)) {
BT_LOGV("Array values are different: size mismatch "
"value-a-addr=%p, value-b-addr=%p, "
"value-a-size=%" PRId64 ", value-b-size=%" PRId64,
object_a, object_b,
- bt_value_array_size(object_a),
- bt_value_array_size(object_b));
+ bt_value_array_get_size(object_a),
+ bt_value_array_get_size(object_b));
ret = BT_FALSE;
goto end;
}
struct bt_value *element_obj_a;
struct bt_value *element_obj_b;
- element_obj_a = bt_value_array_borrow(object_a, i);
- element_obj_b = bt_value_array_borrow(object_b, i);
+ element_obj_a = bt_value_array_borrow_element_by_index(object_a, i);
+ element_obj_b = bt_value_array_borrow_element_by_index(object_b, i);
if (!bt_value_compare(element_obj_a, element_obj_b)) {
BT_LOGV("Array values's elements are different: "
gpointer key, element_obj_a;
const struct bt_value_map *map_obj_a = BT_VALUE_TO_MAP(object_a);
- if (bt_value_map_size(object_a) != bt_value_map_size(object_b)) {
+ if (bt_value_map_get_size(object_a) != bt_value_map_get_size(object_b)) {
BT_LOGV("Map values are different: size mismatch "
"value-a-addr=%p, value-b-addr=%p, "
"value-a-size=%" PRId64 ", value-b-size=%" PRId64,
object_a, object_b,
- bt_value_map_size(object_a),
- bt_value_map_size(object_b));
+ bt_value_map_get_size(object_a),
+ bt_value_map_get_size(object_b));
ret = BT_FALSE;
goto end;
}
struct bt_value *element_obj_b;
const char *key_str = g_quark_to_string(GPOINTER_TO_UINT(key));
- element_obj_b = bt_value_map_borrow(object_b, key_str);
+ element_obj_b = bt_value_map_borrow_entry_value(object_b, key_str);
if (!bt_value_compare(element_obj_a, element_obj_b)) {
BT_LOGV("Map values's elements are different: "
return BT_VALUE_STATUS_OK;
}
-int64_t bt_value_array_size(const struct bt_value *array_obj)
+int64_t bt_value_array_get_size(const struct bt_value *array_obj)
{
BT_ASSERT_PRE_NON_NULL(array_obj, "Value object");
BT_ASSERT_PRE_VALUE_IS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY);
bt_bool bt_value_array_is_empty(const struct bt_value *array_obj)
{
- return bt_value_array_size(array_obj) == 0;
+ return bt_value_array_get_size(array_obj) == 0;
}
-struct bt_value *bt_value_array_borrow(const struct bt_value *array_obj,
+struct bt_value *bt_value_array_borrow_element_by_index(const struct bt_value *array_obj,
uint64_t index)
{
struct bt_value_array *typed_array_obj =
return g_ptr_array_index(typed_array_obj->garray, index);
}
-enum bt_value_status bt_value_array_append(struct bt_value *array_obj,
+enum bt_value_status bt_value_array_append_element(struct bt_value *array_obj,
struct bt_value *element_obj)
{
struct bt_value_array *typed_array_obj =
return BT_VALUE_STATUS_OK;
}
-enum bt_value_status bt_value_array_append_bool(struct bt_value *array_obj,
+enum bt_value_status bt_value_array_append_bool_element(struct bt_value *array_obj,
bt_bool val)
{
enum bt_value_status ret;
struct bt_value *bool_obj = NULL;
bool_obj = bt_value_bool_create_init(val);
- ret = bt_value_array_append(array_obj, bool_obj);
+ ret = bt_value_array_append_element(array_obj, bool_obj);
bt_put(bool_obj);
return ret;
}
-enum bt_value_status bt_value_array_append_integer(
+enum bt_value_status bt_value_array_append_integer_element(
struct bt_value *array_obj, int64_t val)
{
enum bt_value_status ret;
struct bt_value *integer_obj = NULL;
integer_obj = bt_value_integer_create_init(val);
- ret = bt_value_array_append(array_obj, integer_obj);
+ ret = bt_value_array_append_element(array_obj, integer_obj);
bt_put(integer_obj);
return ret;
}
-enum bt_value_status bt_value_array_append_real(struct bt_value *array_obj,
+enum bt_value_status bt_value_array_append_real_element(struct bt_value *array_obj,
double val)
{
enum bt_value_status ret;
struct bt_value *real_obj = NULL;
real_obj = bt_value_real_create_init(val);
- ret = bt_value_array_append(array_obj, real_obj);
+ ret = bt_value_array_append_element(array_obj, real_obj);
bt_put(real_obj);
return ret;
}
-enum bt_value_status bt_value_array_append_string(struct bt_value *array_obj,
+enum bt_value_status bt_value_array_append_string_element(struct bt_value *array_obj,
const char *val)
{
enum bt_value_status ret;
struct bt_value *string_obj = NULL;
string_obj = bt_value_string_create_init(val);
- ret = bt_value_array_append(array_obj, string_obj);
+ ret = bt_value_array_append_element(array_obj, string_obj);
bt_put(string_obj);
return ret;
}
-enum bt_value_status bt_value_array_append_empty_array(
+enum bt_value_status bt_value_array_append_empty_array_element(
struct bt_value *array_obj)
{
enum bt_value_status ret;
struct bt_value *empty_array_obj = NULL;
empty_array_obj = bt_value_array_create();
- ret = bt_value_array_append(array_obj, empty_array_obj);
+ ret = bt_value_array_append_element(array_obj, empty_array_obj);
bt_put(empty_array_obj);
return ret;
}
-enum bt_value_status bt_value_array_append_empty_map(struct bt_value *array_obj)
+enum bt_value_status bt_value_array_append_empty_map_element(struct bt_value *array_obj)
{
enum bt_value_status ret;
struct bt_value *map_obj = NULL;
map_obj = bt_value_map_create();
- ret = bt_value_array_append(array_obj, map_obj);
+ ret = bt_value_array_append_element(array_obj, map_obj);
bt_put(map_obj);
return ret;
}
-enum bt_value_status bt_value_array_set(struct bt_value *array_obj,
+enum bt_value_status bt_value_array_set_element_by_index(struct bt_value *array_obj,
uint64_t index, struct bt_value *element_obj)
{
struct bt_value_array *typed_array_obj =
return BT_VALUE_STATUS_OK;
}
-int64_t bt_value_map_size(const struct bt_value *map_obj)
+int64_t bt_value_map_get_size(const struct bt_value *map_obj)
{
BT_ASSERT_PRE_NON_NULL(map_obj, "Value object");
BT_ASSERT_PRE_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
bt_bool bt_value_map_is_empty(const struct bt_value *map_obj)
{
- return bt_value_map_size(map_obj) == 0;
+ return bt_value_map_get_size(map_obj) == 0;
}
-struct bt_value *bt_value_map_borrow(const struct bt_value *map_obj,
+struct bt_value *bt_value_map_borrow_entry_value(const struct bt_value *map_obj,
const char *key)
{
BT_ASSERT_PRE_NON_NULL(map_obj, "Value object");
GUINT_TO_POINTER(g_quark_from_string(key)));
}
-bt_bool bt_value_map_has_key(const struct bt_value *map_obj, const char *key)
+bt_bool bt_value_map_has_entry(const struct bt_value *map_obj, const char *key)
{
BT_ASSERT_PRE_NON_NULL(map_obj, "Value object");
BT_ASSERT_PRE_NON_NULL(key, "Key");
GUINT_TO_POINTER(g_quark_from_string(key)));
}
-enum bt_value_status bt_value_map_insert(struct bt_value *map_obj,
+enum bt_value_status bt_value_map_insert_entry(struct bt_value *map_obj,
const char *key, struct bt_value *element_obj)
{
BT_ASSERT_PRE_NON_NULL(map_obj, "Map value object");
return BT_VALUE_STATUS_OK;
}
-enum bt_value_status bt_value_map_insert_bool(struct bt_value *map_obj,
+enum bt_value_status bt_value_map_insert_bool_entry(struct bt_value *map_obj,
const char *key, bt_bool val)
{
enum bt_value_status ret;
struct bt_value *bool_obj = NULL;
bool_obj = bt_value_bool_create_init(val);
- ret = bt_value_map_insert(map_obj, key, bool_obj);
+ ret = bt_value_map_insert_entry(map_obj, key, bool_obj);
bt_put(bool_obj);
return ret;
}
-enum bt_value_status bt_value_map_insert_integer(struct bt_value *map_obj,
+enum bt_value_status bt_value_map_insert_integer_entry(struct bt_value *map_obj,
const char *key, int64_t val)
{
enum bt_value_status ret;
struct bt_value *integer_obj = NULL;
integer_obj = bt_value_integer_create_init(val);
- ret = bt_value_map_insert(map_obj, key, integer_obj);
+ ret = bt_value_map_insert_entry(map_obj, key, integer_obj);
bt_put(integer_obj);
return ret;
}
-enum bt_value_status bt_value_map_insert_real(struct bt_value *map_obj,
+enum bt_value_status bt_value_map_insert_real_entry(struct bt_value *map_obj,
const char *key, double val)
{
enum bt_value_status ret;
struct bt_value *real_obj = NULL;
real_obj = bt_value_real_create_init(val);
- ret = bt_value_map_insert(map_obj, key, real_obj);
+ ret = bt_value_map_insert_entry(map_obj, key, real_obj);
bt_put(real_obj);
return ret;
}
-enum bt_value_status bt_value_map_insert_string(struct bt_value *map_obj,
+enum bt_value_status bt_value_map_insert_string_entry(struct bt_value *map_obj,
const char *key, const char *val)
{
enum bt_value_status ret;
struct bt_value *string_obj = NULL;
string_obj = bt_value_string_create_init(val);
- ret = bt_value_map_insert(map_obj, key, string_obj);
+ ret = bt_value_map_insert_entry(map_obj, key, string_obj);
bt_put(string_obj);
return ret;
}
-enum bt_value_status bt_value_map_insert_empty_array(struct bt_value *map_obj,
+enum bt_value_status bt_value_map_insert_empty_array_entry(struct bt_value *map_obj,
const char *key)
{
enum bt_value_status ret;
struct bt_value *array_obj = NULL;
array_obj = bt_value_array_create();
- ret = bt_value_map_insert(map_obj, key, array_obj);
+ ret = bt_value_map_insert_entry(map_obj, key, array_obj);
bt_put(array_obj);
return ret;
}
-enum bt_value_status bt_value_map_insert_empty_map(struct bt_value *map_obj,
+enum bt_value_status bt_value_map_insert_empty_map_entry(struct bt_value *map_obj,
const char *key)
{
enum bt_value_status ret;
struct bt_value *empty_map_obj = NULL;
empty_map_obj = bt_value_map_create();
- ret = bt_value_map_insert(map_obj, key, empty_map_obj);
+ ret = bt_value_map_insert_entry(map_obj, key, empty_map_obj);
bt_put(empty_map_obj);
return ret;
}
-enum bt_value_status bt_value_map_foreach(const struct bt_value *map_obj,
- bt_value_map_foreach_cb cb, void *data)
+enum bt_value_status bt_value_map_foreach_entry(const struct bt_value *map_obj,
+ bt_value_map_foreach_entry_cb cb, void *data)
{
enum bt_value_status ret = BT_VALUE_STATUS_OK;
gpointer key, element_obj;
bt_value_copy(extension_obj_elem);
/* Replace in extended object */
- if (bt_value_map_insert(extend_data->extended_obj, key,
+ if (bt_value_map_insert_entry(extend_data->extended_obj, key,
extension_obj_elem_copy)) {
BT_LOGE("Cannot replace value in extended value: key=\"%s\", "
"extended-value-addr=%p, element-value-addr=%p",
*/
extend_data.extended_obj = extended_obj;
- if (bt_value_map_foreach(extension_obj, extend_map_element,
+ if (bt_value_map_foreach_entry(extension_obj, extend_map_element,
&extend_data)) {
BT_LOGE("Cannot iterate on the extension object's elements: "
"extension-value-addr=%p", extension_obj);
* private component should also exist.
*/
ctf_fs->priv_comp = priv_comp;
- value = bt_value_map_borrow(params, "path");
+ value = bt_value_map_borrow_entry_value(params, "path");
if (value && !bt_value_is_string(value)) {
goto error;
}
value_ret = bt_value_string_get(value, &path_param);
BT_ASSERT(value_ret == BT_VALUE_STATUS_OK);
- value = bt_value_map_borrow(params, "clock-class-offset-s");
+ value = bt_value_map_borrow_entry_value(params, "clock-class-offset-s");
if (value) {
if (!bt_value_is_integer(value)) {
BT_LOGE("clock-class-offset-s should be an integer");
BT_ASSERT(value_ret == BT_VALUE_STATUS_OK);
}
- value = bt_value_map_borrow(params, "clock-class-offset-ns");
+ value = bt_value_map_borrow_entry_value(params, "clock-class-offset-ns");
if (value) {
if (!bt_value_is_integer(value)) {
BT_LOGE("clock-class-offset-ns should be an integer");
goto error;
}
- path_value = bt_value_map_borrow(params, "path");
+ path_value = bt_value_map_borrow_entry_value(params, "path");
ret = bt_value_string_get(path_value, &path);
if (ret) {
BT_LOGE_STR("Cannot get `path` string parameter.");
g_string_append(g_metadata_text, metadata_text);
- ret = bt_value_map_insert_string(query_ret.result, "text",
+ ret = bt_value_map_insert_string_entry(query_ret.result, "text",
g_metadata_text->str);
if (ret) {
BT_LOGE_STR("Cannot insert metadata text into query result.");
goto error;
}
- ret = bt_value_map_insert_bool(query_ret.result, "is-packetized",
+ ret = bt_value_map_insert_bool_entry(query_ret.result, "is-packetized",
is_packetized);
if (ret) {
BT_LOGE_STR("Cannot insert \"is-packetized\" attribute into query result.");
goto end;
}
- status = bt_value_map_insert_integer(range_map, "begin",
+ status = bt_value_map_insert_integer_entry(range_map, "begin",
range->begin_ns);
if (status != BT_VALUE_STATUS_OK) {
ret = -1;
goto end;
}
- status = bt_value_map_insert_integer(range_map, "end",
+ status = bt_value_map_insert_integer_entry(range_map, "end",
range->end_ns);
if (status != BT_VALUE_STATUS_OK) {
ret = -1;
goto end;
}
- status = bt_value_map_insert(info, range_name, range_map);
+ status = bt_value_map_insert_entry(info, range_name, range_map);
if (status != BT_VALUE_STATUS_OK) {
ret = -1;
goto end;
stream_instance_id = bt_stream_get_id(stream);
if (stream_instance_id != -1) {
- status = bt_value_map_insert_integer(info, "id",
+ status = bt_value_map_insert_integer_entry(info, "id",
stream_instance_id);
if (status != BT_VALUE_STATUS_OK) {
ret = -1;
goto end;
}
- status = bt_value_map_insert_integer(info, "class-id", stream_class_id);
+ status = bt_value_map_insert_integer_entry(info, "class-id", stream_class_id);
if (status != BT_VALUE_STATUS_OK) {
ret = -1;
goto end;
goto end;
}
- status = bt_value_array_append_string(file_paths,
+ status = bt_value_array_append_string_element(file_paths,
info->path->str);
if (status != BT_VALUE_STATUS_OK) {
ret = -1;
}
}
- status = bt_value_map_insert(group_info, "paths", file_paths);
+ status = bt_value_map_insert_entry(group_info, "paths", file_paths);
if (status != BT_VALUE_STATUS_OK) {
ret = -1;
goto end;
goto end;
}
- status = bt_value_map_insert_string(trace_info, "name",
+ status = bt_value_map_insert_string_entry(trace_info, "name",
trace_name);
if (status != BT_VALUE_STATUS_OK) {
ret = -1;
goto end;
}
- status = bt_value_map_insert_string(trace_info, "path",
+ status = bt_value_map_insert_string_entry(trace_info, "path",
trace_path);
if (status != BT_VALUE_STATUS_OK) {
ret = -1;
trace_intersection.end_ns = min(trace_intersection.end_ns,
group_range.end_ns);
trace_intersection.set = true;
- status = bt_value_array_append(file_groups, group_info);
+ status = bt_value_array_append_element(file_groups, group_info);
bt_put(group_info);
if (status != BT_VALUE_STATUS_OK) {
goto end;
}
}
- status = bt_value_map_insert(trace_info, "streams", file_groups);
+ status = bt_value_map_insert_entry(trace_info, "streams", file_groups);
BT_PUT(file_groups);
if (status != BT_VALUE_STATUS_OK) {
ret = -1;
goto error;
}
- path_value = bt_value_map_borrow(params, "path");
+ path_value = bt_value_map_borrow_entry_value(params, "path");
ret = bt_value_string_get(path_value, &path);
if (ret) {
BT_LOGE("Cannot get `path` string parameter.");
goto error;
}
- status = bt_value_array_append(query_ret.result, trace_info);
+ status = bt_value_array_append_element(query_ret.result, trace_info);
bt_put(trace_info);
if (status != BT_VALUE_STATUS_OK) {
goto error;
int i, len;
bool found = false;
- len = bt_value_array_size(results);
+ len = bt_value_array_get_size(results);
if (len < 0) {
ret = BT_VALUE_STATUS_ERROR;
goto end;
g_string_append_c(url, '/');
g_string_append(url, session->session_name);
- ret = bt_value_map_insert_string(map, "url", url->str);
+ ret = bt_value_map_insert_string_entry(map, "url", url->str);
if (ret != BT_VALUE_STATUS_OK) {
goto end;
}
* key = "target-hostname",
* value = <string>,
*/
- ret = bt_value_map_insert_string(map, "target-hostname",
+ ret = bt_value_map_insert_string_entry(map, "target-hostname",
session->hostname);
if (ret != BT_VALUE_STATUS_OK) {
goto end;
* key = "session-name",
* value = <string>,
*/
- ret = bt_value_map_insert_string(map, "session-name",
+ ret = bt_value_map_insert_string_entry(map, "session-name",
session->session_name);
if (ret != BT_VALUE_STATUS_OK) {
goto end;
{
uint32_t live_timer = be32toh(session->live_timer);
- ret = bt_value_map_insert_integer(map, "timer-us",
+ ret = bt_value_map_insert_integer_entry(map, "timer-us",
live_timer);
if (ret != BT_VALUE_STATUS_OK) {
goto end;
{
uint32_t streams = be32toh(session->streams);
- ret = bt_value_map_insert_integer(map, "stream-count",
+ ret = bt_value_map_insert_integer_entry(map, "stream-count",
streams);
if (ret != BT_VALUE_STATUS_OK) {
goto end;
{
uint32_t clients = be32toh(session->clients);
- ret = bt_value_map_insert_integer(map, "client-count",
+ ret = bt_value_map_insert_integer_entry(map, "client-count",
clients);
if (ret != BT_VALUE_STATUS_OK) {
goto end;
}
}
- ret = bt_value_array_append(results, map);
+ ret = bt_value_array_append_element(results, map);
end:
if (url) {
g_string_free(url, TRUE);
static
int handle_params(struct dmesg_component *dmesg_comp, struct bt_value *params)
{
- struct bt_value *read_from_stdin = NULL;
struct bt_value *no_timestamp = NULL;
struct bt_value *path = NULL;
const char *path_str;
int ret = 0;
- no_timestamp = bt_value_map_get(params, "no-extract-timestamp");
+ no_timestamp = bt_value_map_borrow_entry_value(params,
+ "no-extract-timestamp");
if (no_timestamp) {
if (!bt_value_is_bool(no_timestamp)) {
BT_LOGE("Expecting a boolean value for the `no-extract-timestamp` parameter: "
BT_ASSERT(ret == 0);
}
- path = bt_value_map_get(params, "path");
+ path = bt_value_map_borrow_entry_value(params, "path");
if (path) {
if (dmesg_comp->params.read_from_stdin) {
BT_LOGE_STR("Cannot specify both `read-from-stdin` and `path` parameters.");
ret = -1;
end:
- bt_put(read_from_stdin);
- bt_put(path);
- bt_put(no_timestamp);
return ret;
}
const char *key = plugin_options[i];
enum bt_value_status status;
- status = bt_value_map_insert(plugin_opt_map, key, bt_value_null);
+ status = bt_value_map_insert_entry(plugin_opt_map, key, bt_value_null);
switch (status) {
case BT_VALUE_STATUS_OK:
break;
struct pretty_component *pretty = data;
struct bt_value *plugin_opt_map = pretty->plugin_opt_map;
- if (!bt_value_map_has_key(plugin_opt_map, key)) {
+ if (!bt_value_map_has_entry(plugin_opt_map, key)) {
fprintf(pretty->err,
"[warning] Parameter \"%s\" unknown to \"text.pretty\" sink component\n", key);
}
enum bt_value_status status;
const char *str;
- value = bt_value_map_borrow(params, key);
+ value = bt_value_map_borrow_entry_value(params, key);
if (!value) {
goto end;
}
enum bt_value_status status;
bt_bool bool_val;
- value = bt_value_map_borrow(params, key);
+ value = bt_value_map_borrow_entry_value(params, key);
if (!value) {
goto end;
}
goto end;
}
/* Report unknown parameters. */
- status = bt_value_map_foreach(params, check_param_exists, pretty);
+ status = bt_value_map_foreach_entry(params, check_param_exists, pretty);
switch (status) {
case BT_VALUE_STATUS_OK:
break;
}
/* Known parameters. */
pretty->options.color = PRETTY_COLOR_OPT_AUTO;
- if (bt_value_map_has_key(params, "color")) {
+ if (bt_value_map_has_entry(params, "color")) {
struct bt_value *color_value;
const char *color;
- color_value = bt_value_map_borrow(params, "color");
+ color_value = bt_value_map_borrow_entry_value(params, "color");
if (!color_value) {
goto end;
}
counter->last_printed_total = -1ULL;
counter->step = 1000;
- step = bt_value_map_borrow(params, "step");
+ step = bt_value_map_borrow_entry_value(params, "step");
if (step && bt_value_is_integer(step)) {
int64_t val;
}
}
- hide_zero = bt_value_map_borrow(params, "hide-zero");
+ hide_zero = bt_value_map_borrow_entry_value(params, "hide-zero");
if (hide_zero && bt_value_is_bool(hide_zero)) {
bt_bool val;
goto error;
}
- ret = bt_value_map_insert_bool(params,
+ ret = bt_value_map_insert_bool_entry(params,
ASSUME_ABSOLUTE_CLOCK_CLASSES_PARAM_NAME, false);
if (ret) {
BT_LOGE_STR("Cannot add boolean value to map value object.");
goto error;
}
- assume_absolute_clock_classes = bt_value_map_borrow(real_params,
+ assume_absolute_clock_classes = bt_value_map_borrow_entry_value(real_params,
ASSUME_ABSOLUTE_CLOCK_CLASSES_PARAM_NAME);
if (assume_absolute_clock_classes &&
!bt_value_is_bool(assume_absolute_clock_classes)) {
int iret;
BT_ASSERT(ret.result);
- iret = bt_value_array_append_string(ret.result, object);
+ iret = bt_value_array_append_string_element(ret.result, object);
BT_ASSERT(iret == 0);
- iret = bt_value_array_append(ret.result, params);
+ iret = bt_value_array_append_element(ret.result, params);
BT_ASSERT(iret == 0);
return ret;
}
"initial array value object size is 0");
obj = bt_value_integer_create_init(345);
- ret = bt_value_array_append(array_obj, obj);
+ ret = bt_value_array_append_element(array_obj, obj);
BT_PUT(obj);
obj = bt_value_real_create_init(-17.45);
- ret |= bt_value_array_append(array_obj, obj);
+ ret |= bt_value_array_append_element(array_obj, obj);
BT_PUT(obj);
obj = bt_value_bool_create_init(BT_TRUE);
- ret |= bt_value_array_append(array_obj, obj);
+ ret |= bt_value_array_append_element(array_obj, obj);
BT_PUT(obj);
- ret |= bt_value_array_append(array_obj, bt_value_null);
- ok(!ret, "bt_value_array_append() succeeds");
- ok(bt_value_array_size(array_obj) == 4,
+ ret |= bt_value_array_append_element(array_obj, bt_value_null);
+ ok(!ret, "bt_value_array_append_element() succeeds");
+ ok(bt_value_array_get_size(array_obj) == 4,
"appending an element to an array value object increment its size");
- obj = bt_value_array_get(array_obj, 0);
+ obj = bt_value_array_borrow_element_by_index(array_obj, 0);
ok(obj && bt_value_is_integer(obj),
- "bt_value_array_get() returns an value object with the appropriate type (integer)");
+ "bt_value_array_borrow_element_by_index() returns an value object with the appropriate type (integer)");
ret = bt_value_integer_get(obj, &int_value);
ok(!ret && int_value == 345,
- "bt_value_array_get() returns an value object with the appropriate value (integer)");
- BT_PUT(obj);
- obj = bt_value_array_get(array_obj, 1);
+ "bt_value_array_borrow_element_by_index() returns an value object with the appropriate value (integer)");
+ obj = bt_value_array_borrow_element_by_index(array_obj, 1);
ok(obj && bt_value_is_real(obj),
- "bt_value_array_get() returns an value object with the appropriate type (real number)");
+ "bt_value_array_borrow_element_by_index() returns an value object with the appropriate type (real number)");
ret = bt_value_real_get(obj, &real_value);
ok(!ret && real_value == -17.45,
- "bt_value_array_get() returns an value object with the appropriate value (real number)");
- BT_PUT(obj);
- obj = bt_value_array_get(array_obj, 2);
+ "bt_value_array_borrow_element_by_index() returns an value object with the appropriate value (real number)");
+ obj = bt_value_array_borrow_element_by_index(array_obj, 2);
ok(obj && bt_value_is_bool(obj),
- "bt_value_array_get() returns an value object with the appropriate type (boolean)");
+ "bt_value_array_borrow_element_by_index() returns an value object with the appropriate type (boolean)");
ret = bt_value_bool_get(obj, &bool_value);
ok(!ret && bool_value,
- "bt_value_array_get() returns an value object with the appropriate value (boolean)");
- BT_PUT(obj);
- obj = bt_value_array_get(array_obj, 3);
+ "bt_value_array_borrow_element_by_index() returns an value object with the appropriate value (boolean)");
+ obj = bt_value_array_borrow_element_by_index(array_obj, 3);
ok(obj == bt_value_null,
- "bt_value_array_get() returns an value object with the appropriate type (null)");
+ "bt_value_array_borrow_element_by_index() returns an value object with the appropriate type (null)");
obj = bt_value_integer_create_init(1001);
BT_ASSERT(obj);
- ok(!bt_value_array_set(array_obj, 2, obj),
- "bt_value_array_set() succeeds");
+ ok(!bt_value_array_set_element_by_index(array_obj, 2, obj),
+ "bt_value_array_set_element_by_index() succeeds");
BT_PUT(obj);
- obj = bt_value_array_get(array_obj, 2);
+ obj = bt_value_array_borrow_element_by_index(array_obj, 2);
ok(obj && bt_value_is_integer(obj),
- "bt_value_array_set() inserts an value object with the appropriate type");
+ "bt_value_array_set_element_by_index() inserts an value object with the appropriate type");
ret = bt_value_integer_get(obj, &int_value);
BT_ASSERT(!ret);
ok(int_value == 1001,
- "bt_value_array_set() inserts an value object with the appropriate value");
- BT_PUT(obj);
-
- ret = bt_value_array_append_bool(array_obj, BT_FALSE);
- ok(!ret, "bt_value_array_append_bool() succeeds");
- ret = bt_value_array_append_integer(array_obj, 98765);
- ok(!ret, "bt_value_array_append_integer() succeeds");
- ret = bt_value_array_append_real(array_obj, 2.49578);
- ok(!ret, "bt_value_array_append_real() succeeds");
- ret = bt_value_array_append_string(array_obj, "bt_value");
- ok(!ret, "bt_value_array_append_string() succeeds");
- ret = bt_value_array_append_empty_array(array_obj);
- ok(!ret, "bt_value_array_append_empty_array() succeeds");
- ret = bt_value_array_append_empty_map(array_obj);
- ok(!ret, "bt_value_array_append_empty_map() succeeds");
-
- ok(bt_value_array_size(array_obj) == 10,
- "the bt_value_array_append_*() functions increment the array value object's size");
+ "bt_value_array_set_element_by_index() inserts an value object with the appropriate value");
+
+ ret = bt_value_array_append_bool_element(array_obj, BT_FALSE);
+ ok(!ret, "bt_value_array_append_bool_element() succeeds");
+ ret = bt_value_array_append_integer_element(array_obj, 98765);
+ ok(!ret, "bt_value_array_append_integer_element() succeeds");
+ ret = bt_value_array_append_real_element(array_obj, 2.49578);
+ ok(!ret, "bt_value_array_append_real_element() succeeds");
+ ret = bt_value_array_append_string_element(array_obj, "bt_value");
+ ok(!ret, "bt_value_array_append_string_element() succeeds");
+ ret = bt_value_array_append_empty_array_element(array_obj);
+ ok(!ret, "bt_value_array_append_empty_array_element() succeeds");
+ ret = bt_value_array_append_empty_map_element(array_obj);
+ ok(!ret, "bt_value_array_append_empty_map_element() succeeds");
+
+ ok(bt_value_array_get_size(array_obj) == 10,
+ "the bt_value_array_append_element_*() functions increment the array value object's size");
ok(!bt_value_array_is_empty(array_obj),
"map value object is not empty");
- obj = bt_value_array_get(array_obj, 4);
+ obj = bt_value_array_borrow_element_by_index(array_obj, 4);
ok(obj && bt_value_is_bool(obj),
- "bt_value_array_append_bool() appends a boolean value object");
+ "bt_value_array_append_bool_element() appends a boolean value object");
ret = bt_value_bool_get(obj, &bool_value);
ok(!ret && !bool_value,
- "bt_value_array_append_bool() appends the appropriate value");
- BT_PUT(obj);
- obj = bt_value_array_get(array_obj, 5);
+ "bt_value_array_append_bool_element() appends the appropriate value");
+ obj = bt_value_array_borrow_element_by_index(array_obj, 5);
ok(obj && bt_value_is_integer(obj),
- "bt_value_array_append_integer() appends an integer value object");
+ "bt_value_array_append_integer_element() appends an integer value object");
ret = bt_value_integer_get(obj, &int_value);
ok(!ret && int_value == 98765,
- "bt_value_array_append_integer() appends the appropriate value");
- BT_PUT(obj);
- obj = bt_value_array_get(array_obj, 6);
+ "bt_value_array_append_integer_element() appends the appropriate value");
+ obj = bt_value_array_borrow_element_by_index(array_obj, 6);
ok(obj && bt_value_is_real(obj),
- "bt_value_array_append_real() appends a real number value object");
+ "bt_value_array_append_real_element() appends a real number value object");
ret = bt_value_real_get(obj, &real_value);
ok(!ret && real_value == 2.49578,
- "bt_value_array_append_real() appends the appropriate value");
- BT_PUT(obj);
- obj = bt_value_array_get(array_obj, 7);
+ "bt_value_array_append_real_element() appends the appropriate value");
+ obj = bt_value_array_borrow_element_by_index(array_obj, 7);
ok(obj && bt_value_is_string(obj),
- "bt_value_array_append_string() appends a string value object");
+ "bt_value_array_append_string_element() appends a string value object");
ret = bt_value_string_get(obj, &string_value);
ok(!ret && string_value && !strcmp(string_value, "bt_value"),
- "bt_value_array_append_string() appends the appropriate value");
- BT_PUT(obj);
- obj = bt_value_array_get(array_obj, 8);
+ "bt_value_array_append_string_element() appends the appropriate value");
+ obj = bt_value_array_borrow_element_by_index(array_obj, 8);
ok(obj && bt_value_is_array(obj),
- "bt_value_array_append_empty_array() appends an array value object");
+ "bt_value_array_append_empty_array_element() appends an array value object");
ok(bt_value_array_is_empty(obj),
- "bt_value_array_append_empty_array() an empty array value object");
- BT_PUT(obj);
- obj = bt_value_array_get(array_obj, 9);
+ "bt_value_array_append_empty_array_element() an empty array value object");
+ obj = bt_value_array_borrow_element_by_index(array_obj, 9);
ok(obj && bt_value_is_map(obj),
- "bt_value_array_append_empty_map() appends a map value object");
+ "bt_value_array_append_empty_map_element() appends a map value object");
ok(bt_value_map_is_empty(obj),
- "bt_value_array_append_empty_map() an empty map value object");
- BT_PUT(obj);
+ "bt_value_array_append_empty_map_element() an empty map value object");
BT_PUT(array_obj);
pass("putting an existing array value object does not cause a crash")
map_obj = bt_value_map_create();
ok(map_obj && bt_value_is_map(map_obj),
"bt_value_map_create() returns a map value object");
- ok(bt_value_map_size(map_obj) == 0,
+ ok(bt_value_map_get_size(map_obj) == 0,
"initial map value object size is 0");
obj = bt_value_integer_create_init(19457);
- ret = bt_value_map_insert(map_obj, "int", obj);
+ ret = bt_value_map_insert_entry(map_obj, "int", obj);
BT_PUT(obj);
obj = bt_value_real_create_init(5.444);
- ret |= bt_value_map_insert(map_obj, "real", obj);
+ ret |= bt_value_map_insert_entry(map_obj, "real", obj);
BT_PUT(obj);
obj = bt_value_bool_create();
- ret |= bt_value_map_insert(map_obj, "bt_bool", obj);
+ ret |= bt_value_map_insert_entry(map_obj, "bt_bool", obj);
BT_PUT(obj);
- ret |= bt_value_map_insert(map_obj, "null", bt_value_null);
- ok(!ret, "bt_value_map_insert() succeeds");
- ok(bt_value_map_size(map_obj) == 4,
+ ret |= bt_value_map_insert_entry(map_obj, "null", bt_value_null);
+ ok(!ret, "bt_value_map_insert_entry() succeeds");
+ ok(bt_value_map_get_size(map_obj) == 4,
"inserting an element into a map value object increment its size");
obj = bt_value_bool_create_init(BT_TRUE);
- ret = bt_value_map_insert(map_obj, "bt_bool", obj);
+ ret = bt_value_map_insert_entry(map_obj, "bt_bool", obj);
BT_PUT(obj);
- ok(!ret, "bt_value_map_insert() accepts an existing key");
+ ok(!ret, "bt_value_map_insert_entry() accepts an existing key");
- obj = bt_value_map_get(map_obj, "life");
- ok(!obj, "bt_value_map_get() returns NULL with an non existing key");
- obj = bt_value_map_get(map_obj, "real");
+ obj = bt_value_map_borrow_entry_value(map_obj, "life");
+ ok(!obj, "bt_value_map_borrow_entry_value() returns NULL with an non existing key");
+ obj = bt_value_map_borrow_entry_value(map_obj, "real");
ok(obj && bt_value_is_real(obj),
- "bt_value_map_get() returns an value object with the appropriate type (real)");
+ "bt_value_map_borrow_entry_value() returns an value object with the appropriate type (real)");
ret = bt_value_real_get(obj, &real_value);
ok(!ret && real_value == 5.444,
- "bt_value_map_get() returns an value object with the appropriate value (real)");
- BT_PUT(obj);
- obj = bt_value_map_get(map_obj, "int");
+ "bt_value_map_borrow_entry_value() returns an value object with the appropriate value (real)");
+ obj = bt_value_map_borrow_entry_value(map_obj, "int");
ok(obj && bt_value_is_integer(obj),
- "bt_value_map_get() returns an value object with the appropriate type (integer)");
+ "bt_value_map_borrow_entry_value() returns an value object with the appropriate type (integer)");
ret = bt_value_integer_get(obj, &int_value);
ok(!ret && int_value == 19457,
- "bt_value_map_get() returns an value object with the appropriate value (integer)");
- BT_PUT(obj);
- obj = bt_value_map_get(map_obj, "null");
+ "bt_value_map_borrow_entry_value() returns an value object with the appropriate value (integer)");
+ obj = bt_value_map_borrow_entry_value(map_obj, "null");
ok(obj && bt_value_is_null(obj),
- "bt_value_map_get() returns an value object with the appropriate type (null)");
- obj = bt_value_map_get(map_obj, "bt_bool");
+ "bt_value_map_borrow_entry_value() returns an value object with the appropriate type (null)");
+ obj = bt_value_map_borrow_entry_value(map_obj, "bt_bool");
ok(obj && bt_value_is_bool(obj),
- "bt_value_map_get() returns an value object with the appropriate type (boolean)");
+ "bt_value_map_borrow_entry_value() returns an value object with the appropriate type (boolean)");
ret = bt_value_bool_get(obj, &bool_value);
ok(!ret && bool_value,
- "bt_value_map_get() returns an value object with the appropriate value (boolean)");
- BT_PUT(obj);
-
- ret = bt_value_map_insert_bool(map_obj, "bool2", BT_TRUE);
- ok(!ret, "bt_value_map_insert_bool() succeeds");
- ret = bt_value_map_insert_integer(map_obj, "int2", 98765);
- ok(!ret, "bt_value_map_insert_integer() succeeds");
- ret = bt_value_map_insert_real(map_obj, "real2", -49.0001);
- ok(!ret, "bt_value_map_insert_real() succeeds");
- ret = bt_value_map_insert_string(map_obj, "string2", "bt_value");
- ok(!ret, "bt_value_map_insert_string() succeeds");
- ret = bt_value_map_insert_empty_array(map_obj, "array2");
- ok(!ret, "bt_value_map_insert_empty_array() succeeds");
- ret = bt_value_map_insert_empty_map(map_obj, "map2");
- ok(!ret, "bt_value_map_insert_empty_map() succeeds");
-
- ok(bt_value_map_size(map_obj) == 10,
+ "bt_value_map_borrow_entry_value() returns an value object with the appropriate value (boolean)");
+
+ ret = bt_value_map_insert_bool_entry(map_obj, "bool2", BT_TRUE);
+ ok(!ret, "bt_value_map_insert_bool_entry() succeeds");
+ ret = bt_value_map_insert_integer_entry(map_obj, "int2", 98765);
+ ok(!ret, "bt_value_map_insert_integer_entry() succeeds");
+ ret = bt_value_map_insert_real_entry(map_obj, "real2", -49.0001);
+ ok(!ret, "bt_value_map_insert_real_entry() succeeds");
+ ret = bt_value_map_insert_string_entry(map_obj, "string2", "bt_value");
+ ok(!ret, "bt_value_map_insert_string_entry() succeeds");
+ ret = bt_value_map_insert_empty_array_entry(map_obj, "array2");
+ ok(!ret, "bt_value_map_insert_empty_array_entry() succeeds");
+ ret = bt_value_map_insert_empty_map_entry(map_obj, "map2");
+ ok(!ret, "bt_value_map_insert_empty_map_entry() succeeds");
+
+ ok(bt_value_map_get_size(map_obj) == 10,
"the bt_value_map_insert*() functions increment the map value object's size");
- ok(!bt_value_map_has_key(map_obj, "hello"),
+ ok(!bt_value_map_has_entry(map_obj, "hello"),
"map value object does not have key \"hello\"");
- ok(bt_value_map_has_key(map_obj, "bt_bool"),
+ ok(bt_value_map_has_entry(map_obj, "bt_bool"),
"map value object has key \"bt_bool\"");
- ok(bt_value_map_has_key(map_obj, "int"),
+ ok(bt_value_map_has_entry(map_obj, "int"),
"map value object has key \"int\"");
- ok(bt_value_map_has_key(map_obj, "real"),
+ ok(bt_value_map_has_entry(map_obj, "real"),
"map value object has key \"real\"");
- ok(bt_value_map_has_key(map_obj, "null"),
+ ok(bt_value_map_has_entry(map_obj, "null"),
"map value object has key \"null\"");
- ok(bt_value_map_has_key(map_obj, "bool2"),
+ ok(bt_value_map_has_entry(map_obj, "bool2"),
"map value object has key \"bool2\"");
- ok(bt_value_map_has_key(map_obj, "int2"),
+ ok(bt_value_map_has_entry(map_obj, "int2"),
"map value object has key \"int2\"");
- ok(bt_value_map_has_key(map_obj, "real2"),
+ ok(bt_value_map_has_entry(map_obj, "real2"),
"map value object has key \"real2\"");
- ok(bt_value_map_has_key(map_obj, "string2"),
+ ok(bt_value_map_has_entry(map_obj, "string2"),
"map value object has key \"string2\"");
- ok(bt_value_map_has_key(map_obj, "array2"),
+ ok(bt_value_map_has_entry(map_obj, "array2"),
"map value object has key \"array2\"");
- ok(bt_value_map_has_key(map_obj, "map2"),
+ ok(bt_value_map_has_entry(map_obj, "map2"),
"map value object has key \"map2\"");
- ret = bt_value_map_foreach(map_obj, test_map_foreach_cb_count, &count);
+ ret = bt_value_map_foreach_entry(map_obj, test_map_foreach_cb_count, &count);
ok(ret == BT_VALUE_STATUS_CANCELED && count == 3,
- "bt_value_map_foreach() breaks the loop when the user function returns BT_FALSE");
+ "bt_value_map_foreach_entry() breaks the loop when the user function returns BT_FALSE");
memset(&checklist, 0, sizeof(checklist));
- ret = bt_value_map_foreach(map_obj, test_map_foreach_cb_check,
+ ret = bt_value_map_foreach_entry(map_obj, test_map_foreach_cb_check,
&checklist);
ok(ret == BT_VALUE_STATUS_OK,
- "bt_value_map_foreach() succeeds with test_map_foreach_cb_check()");
+ "bt_value_map_foreach_entry() succeeds with test_map_foreach_cb_check()");
ok(checklist.bool1 && checklist.int1 && checklist.real1 &&
checklist.null1 && checklist.bool2 && checklist.int2 &&
checklist.real2 && checklist.string2 &&
checklist.array2 && checklist.map2,
- "bt_value_map_foreach() iterates over all the map value object's elements");
+ "bt_value_map_foreach_entry() iterates over all the map value object's elements");
BT_PUT(map_obj);
pass("putting an existing map value object does not cause a crash")
ok(bt_value_compare(array1, array2),
"empty array value objects are equivalent");
- BT_ASSERT(!bt_value_array_append_integer(array1, 23));
- BT_ASSERT(!bt_value_array_append_real(array1, 14.2));
- BT_ASSERT(!bt_value_array_append_bool(array1, BT_FALSE));
- BT_ASSERT(!bt_value_array_append_real(array2, 14.2));
- BT_ASSERT(!bt_value_array_append_integer(array2, 23));
- BT_ASSERT(!bt_value_array_append_bool(array2, BT_FALSE));
- BT_ASSERT(!bt_value_array_append_integer(array3, 23));
- BT_ASSERT(!bt_value_array_append_real(array3, 14.2));
- BT_ASSERT(!bt_value_array_append_bool(array3, BT_FALSE));
- BT_ASSERT(bt_value_array_size(array1) == 3);
- BT_ASSERT(bt_value_array_size(array2) == 3);
- BT_ASSERT(bt_value_array_size(array3) == 3);
+ BT_ASSERT(!bt_value_array_append_integer_element(array1, 23));
+ BT_ASSERT(!bt_value_array_append_real_element(array1, 14.2));
+ BT_ASSERT(!bt_value_array_append_bool_element(array1, BT_FALSE));
+ BT_ASSERT(!bt_value_array_append_real_element(array2, 14.2));
+ BT_ASSERT(!bt_value_array_append_integer_element(array2, 23));
+ BT_ASSERT(!bt_value_array_append_bool_element(array2, BT_FALSE));
+ BT_ASSERT(!bt_value_array_append_integer_element(array3, 23));
+ BT_ASSERT(!bt_value_array_append_real_element(array3, 14.2));
+ BT_ASSERT(!bt_value_array_append_bool_element(array3, BT_FALSE));
+ BT_ASSERT(bt_value_array_get_size(array1) == 3);
+ BT_ASSERT(bt_value_array_get_size(array2) == 3);
+ BT_ASSERT(bt_value_array_get_size(array3) == 3);
ok(!bt_value_compare(bt_value_null, array1),
"cannot compare null value object and array value object");
ok(bt_value_compare(map1, map2),
"empty map value objects are equivalent");
- BT_ASSERT(!bt_value_map_insert_integer(map1, "one", 23));
- BT_ASSERT(!bt_value_map_insert_real(map1, "two", 14.2));
- BT_ASSERT(!bt_value_map_insert_bool(map1, "three", BT_FALSE));
- BT_ASSERT(!bt_value_map_insert_real(map2, "one", 14.2));
- BT_ASSERT(!bt_value_map_insert_integer(map2, "two", 23));
- BT_ASSERT(!bt_value_map_insert_bool(map2, "three", BT_FALSE));
- BT_ASSERT(!bt_value_map_insert_bool(map3, "three", BT_FALSE));
- BT_ASSERT(!bt_value_map_insert_integer(map3, "one", 23));
- BT_ASSERT(!bt_value_map_insert_real(map3, "two", 14.2));
- BT_ASSERT(bt_value_map_size(map1) == 3);
- BT_ASSERT(bt_value_map_size(map2) == 3);
- BT_ASSERT(bt_value_map_size(map3) == 3);
+ BT_ASSERT(!bt_value_map_insert_integer_entry(map1, "one", 23));
+ BT_ASSERT(!bt_value_map_insert_real_entry(map1, "two", 14.2));
+ BT_ASSERT(!bt_value_map_insert_bool_entry(map1, "three", BT_FALSE));
+ BT_ASSERT(!bt_value_map_insert_real_entry(map2, "one", 14.2));
+ BT_ASSERT(!bt_value_map_insert_integer_entry(map2, "two", 23));
+ BT_ASSERT(!bt_value_map_insert_bool_entry(map2, "three", BT_FALSE));
+ BT_ASSERT(!bt_value_map_insert_bool_entry(map3, "three", BT_FALSE));
+ BT_ASSERT(!bt_value_map_insert_integer_entry(map3, "one", 23));
+ BT_ASSERT(!bt_value_map_insert_real_entry(map3, "two", 14.2));
+ BT_ASSERT(bt_value_map_get_size(map1) == 3);
+ BT_ASSERT(bt_value_map_get_size(map2) == 3);
+ BT_ASSERT(bt_value_map_get_size(map3) == 3);
ok(!bt_value_compare(bt_value_null, map1),
"cannot compare null value object and map value object");
BT_ASSERT(bool_obj && integer_obj && real_obj && string_obj &&
array_obj && map_obj);
- BT_ASSERT(!bt_value_array_append(array_obj, bool_obj));
- BT_ASSERT(!bt_value_array_append(array_obj, integer_obj));
- BT_ASSERT(!bt_value_array_append(array_obj, real_obj));
- BT_ASSERT(!bt_value_array_append(array_obj, bt_value_null));
- BT_ASSERT(!bt_value_map_insert(map_obj, "array", array_obj));
- BT_ASSERT(!bt_value_map_insert(map_obj, "string", string_obj));
+ BT_ASSERT(!bt_value_array_append_element(array_obj, bool_obj));
+ BT_ASSERT(!bt_value_array_append_element(array_obj, integer_obj));
+ BT_ASSERT(!bt_value_array_append_element(array_obj, real_obj));
+ BT_ASSERT(!bt_value_array_append_element(array_obj, bt_value_null));
+ BT_ASSERT(!bt_value_map_insert_entry(map_obj, "array", array_obj));
+ BT_ASSERT(!bt_value_map_insert_entry(map_obj, "string", string_obj));
map_copy_obj = bt_value_copy(map_obj);
ok(map_copy_obj,
ok(map_obj != map_copy_obj,
"bt_value_copy() returns a different pointer (map)");
- string_copy_obj = bt_value_map_get(map_copy_obj, "string");
+ string_copy_obj = bt_value_map_borrow_entry_value(map_copy_obj, "string");
ok(string_copy_obj != string_obj,
"bt_value_copy() returns a different pointer (string)");
- array_copy_obj = bt_value_map_get(map_copy_obj, "array");
+ array_copy_obj = bt_value_map_borrow_entry_value(map_copy_obj, "array");
ok(array_copy_obj != array_obj,
"bt_value_copy() returns a different pointer (array)");
- bool_copy_obj = bt_value_array_get(array_copy_obj, 0);
+ bool_copy_obj = bt_value_array_borrow_element_by_index(array_copy_obj, 0);
ok(bool_copy_obj != bool_obj,
"bt_value_copy() returns a different pointer (bt_bool)");
- integer_copy_obj = bt_value_array_get(array_copy_obj, 1);
+ integer_copy_obj = bt_value_array_borrow_element_by_index(array_copy_obj, 1);
ok(integer_copy_obj != integer_obj,
"bt_value_copy() returns a different pointer (integer)");
- real_copy_obj = bt_value_array_get(array_copy_obj, 2);
+ real_copy_obj = bt_value_array_borrow_element_by_index(array_copy_obj, 2);
ok(real_copy_obj != real_obj,
"bt_value_copy() returns a different pointer (real)");
- null_copy_obj = bt_value_array_get(array_copy_obj, 3);
+ null_copy_obj = bt_value_array_borrow_element_by_index(array_copy_obj, 3);
ok(null_copy_obj == bt_value_null,
"bt_value_copy() returns the same pointer (null)");
ok(bt_value_compare(map_obj, map_copy_obj),
"source and destination value objects have the same content");
- BT_PUT(bool_copy_obj);
- BT_PUT(integer_copy_obj);
- BT_PUT(real_copy_obj);
- BT_PUT(string_copy_obj);
- BT_PUT(array_copy_obj);
BT_PUT(map_copy_obj);
BT_PUT(bool_obj);
BT_PUT(integer_obj);
struct bt_value *elem_b = NULL;
bt_bool equal;
- elem_a = bt_value_map_get(map_a, key);
- elem_b = bt_value_map_get(map_b, key);
+ elem_a = bt_value_map_borrow_entry_value(map_a, key);
+ elem_b = bt_value_map_borrow_entry_value(map_b, key);
equal = bt_value_compare(elem_a, elem_b);
- BT_PUT(elem_a);
- BT_PUT(elem_b);
-
return equal;
}
BT_ASSERT(base_map);
BT_ASSERT(extension_map);
BT_ASSERT(array);
- status = bt_value_map_insert_bool(base_map, "file", BT_TRUE);
+ status = bt_value_map_insert_bool_entry(base_map, "file", BT_TRUE);
BT_ASSERT(status == BT_VALUE_STATUS_OK);
- status = bt_value_map_insert_bool(base_map, "edit", BT_FALSE);
+ status = bt_value_map_insert_bool_entry(base_map, "edit", BT_FALSE);
BT_ASSERT(status == BT_VALUE_STATUS_OK);
- status = bt_value_map_insert_integer(base_map, "selection", 17);
+ status = bt_value_map_insert_integer_entry(base_map, "selection", 17);
BT_ASSERT(status == BT_VALUE_STATUS_OK);
- status = bt_value_map_insert_integer(base_map, "find", -34);
+ status = bt_value_map_insert_integer_entry(base_map, "find", -34);
BT_ASSERT(status == BT_VALUE_STATUS_OK);
- status = bt_value_map_insert_bool(extension_map, "edit", BT_TRUE);
+ status = bt_value_map_insert_bool_entry(extension_map, "edit", BT_TRUE);
BT_ASSERT(status == BT_VALUE_STATUS_OK);
- status = bt_value_map_insert_integer(extension_map, "find", 101);
+ status = bt_value_map_insert_integer_entry(extension_map, "find", 101);
BT_ASSERT(status == BT_VALUE_STATUS_OK);
- status = bt_value_map_insert_real(extension_map, "project", -404);
+ status = bt_value_map_insert_real_entry(extension_map, "project", -404);
BT_ASSERT(status == BT_VALUE_STATUS_OK);
extended_map = bt_value_map_extend(base_map, extension_map);
ok(extended_map, "bt_value_map_extend() succeeds");
- ok(bt_value_map_size(extended_map) == 5,
+ ok(bt_value_map_get_size(extended_map) == 5,
"bt_value_map_extend() returns a map object with the correct size");
ok(compare_map_elements(base_map, extended_map, "file"),
"bt_value_map_extend() picks the appropriate element (file)");
ret = bt_query_executor_query(query_exec, filter_comp_class,
"get-something", params, &results);
ok(ret == 0 && results, "bt_query_executor_query() succeeds");
- BT_ASSERT(bt_value_is_array(results) && bt_value_array_size(results) == 2);
- object = bt_value_array_get(results, 0);
+ BT_ASSERT(bt_value_is_array(results) && bt_value_array_get_size(results) == 2);
+ object = bt_value_array_borrow_element_by_index(results, 0);
BT_ASSERT(object && bt_value_is_string(object));
value_ret = bt_value_string_get(object, &object_str);
BT_ASSERT(value_ret == BT_VALUE_STATUS_OK);
ok(strcmp(object_str, "get-something") == 0,
"bt_component_class_query() receives the expected object name");
- res_params = bt_value_array_get(results, 1);
+ res_params = bt_value_array_borrow_element_by_index(results, 1);
ok(res_params == params,
"bt_component_class_query() receives the expected parameters");
free(sfs_path);
bt_put(graph);
bt_put(plugin_set);
- bt_put(object);
- bt_put(res_params);
bt_put(results);
bt_put(params);
bt_put(query_exec);