lib: make values API const-correct
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 3 Dec 2018 23:39:58 +0000 (18:39 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
This patch sets out the ground for subsequent const-correctness patches.
The rules are:

* Convert private API to non-const API, without any `private` prefix,
  including in the file name. A non-const API function accept a
  non-const object.

  Put common enumerations in this header.

* Convert public API to const API:

  * Use `-const.h` suffix in file name.

  * Use `_const` suffix to borrowing functions and callback type
    definitions.

In this particular patch, the `bt_value_null` singleton object is
non-const because you can use it with bt_value_array_append_element()
and bt_value_map_insert_entry().

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
51 files changed:
cli/babeltrace-cfg-cli-args-connect.c
cli/babeltrace-cfg-cli-args-connect.h
cli/babeltrace-cfg-cli-args-default.c
cli/babeltrace-cfg-cli-args.c
cli/babeltrace-cfg-cli-args.h
cli/babeltrace-cfg.c
cli/babeltrace-cfg.h
cli/babeltrace.c
include/Makefile.am
include/babeltrace/babeltrace.h
include/babeltrace/graph/private-component-class-filter.h
include/babeltrace/graph/private-component-class-sink.h
include/babeltrace/graph/private-component-class-source.h
include/babeltrace/graph/private-graph.h
include/babeltrace/graph/private-query-executor.h
include/babeltrace/private-values.h [deleted file]
include/babeltrace/trace-ir/attributes-internal.h
include/babeltrace/trace-ir/private-trace.h
include/babeltrace/trace-ir/trace-internal.h
include/babeltrace/trace-ir/trace.h
include/babeltrace/values-const.h [new file with mode: 0644]
include/babeltrace/values-internal.h
include/babeltrace/values.h
lib/graph/component-class-sink-colander.c
lib/graph/graph.c
lib/graph/query-executor.c
lib/lib-logging.c
lib/trace-ir/attributes.c
lib/trace-ir/trace.c
lib/values.c
plugins/ctf/fs-src/fs.c
plugins/ctf/fs-src/fs.h
plugins/ctf/fs-src/query.c
plugins/ctf/fs-src/query.h
plugins/text/dmesg/dmesg.c
plugins/text/dmesg/dmesg.h
plugins/text/pretty/pretty.c
plugins/text/pretty/pretty.h
plugins/text/pretty/print.c
plugins/utils/counter/counter.c
plugins/utils/counter/counter.h
plugins/utils/dummy/dummy.c
plugins/utils/dummy/dummy.h
plugins/utils/muxer/muxer.c
plugins/utils/muxer/muxer.h
tests/lib/test-plugin-plugins/minimal.c
tests/lib/test-plugin-plugins/sfs.c
tests/lib/test_bt_notification_iterator.c
tests/lib/test_bt_values.c
tests/lib/test_graph_topo.c
tests/lib/test_plugin.c

index 7b4961652b7c532dc7fc97debd5ab4a94c71b883..e72ff30e9701715a7dfb7bf4db49ad17bc1ca15e 100644 (file)
@@ -21,8 +21,7 @@
  */
 
 #include <stdlib.h>
-#include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
+#include <babeltrace/babeltrace.h>
 #include <babeltrace/common-internal.h>
 #include "babeltrace-cfg.h"
 #include "babeltrace-cfg-cli-args-connect.h"
@@ -508,7 +507,7 @@ end:
 }
 
 static int validate_all_components_connected_in_array(GPtrArray *comps,
-               struct bt_value *connected_components,
+               const struct bt_value *connected_components,
                char *error_buf, size_t error_buf_size)
 {
        int ret = 0;
@@ -536,8 +535,7 @@ static int validate_all_components_connected(struct bt_config *cfg,
 {
        size_t i;
        int ret = 0;
-       struct bt_private_value *connected_components =
-               bt_private_value_map_create();
+       struct bt_value *connected_components = bt_value_map_create();
 
        if (!connected_components) {
                ret = -1;
@@ -548,13 +546,13 @@ static int validate_all_components_connected(struct bt_config *cfg,
                struct bt_config_connection *connection =
                        g_ptr_array_index(cfg->cmd_data.run.connections, i);
 
-               ret = bt_private_value_map_insert_entry(connected_components,
+               ret = bt_value_map_insert_entry(connected_components,
                        connection->upstream_comp_name->str, bt_value_null);
                if (ret) {
                        goto end;
                }
 
-               ret = bt_private_value_map_insert_entry(connected_components,
+               ret = bt_value_map_insert_entry(connected_components,
                        connection->downstream_comp_name->str, bt_value_null);
                if (ret) {
                        goto end;
@@ -563,7 +561,7 @@ static int validate_all_components_connected(struct bt_config *cfg,
 
        ret = validate_all_components_connected_in_array(
                cfg->cmd_data.run.sources,
-               bt_private_value_as_value(connected_components),
+               connected_components,
                error_buf, error_buf_size);
        if (ret) {
                goto end;
@@ -571,7 +569,7 @@ static int validate_all_components_connected(struct bt_config *cfg,
 
        ret = validate_all_components_connected_in_array(
                cfg->cmd_data.run.filters,
-               bt_private_value_as_value(connected_components),
+               connected_components,
                error_buf, error_buf_size);
        if (ret) {
                goto end;
@@ -579,7 +577,7 @@ static int validate_all_components_connected(struct bt_config *cfg,
 
        ret = validate_all_components_connected_in_array(
                cfg->cmd_data.run.sinks,
-               bt_private_value_as_value(connected_components),
+               connected_components,
                error_buf, error_buf_size);
        if (ret) {
                goto end;
@@ -595,8 +593,8 @@ static int validate_no_duplicate_connection(struct bt_config *cfg,
 {
        size_t i;
        int ret = 0;
-       struct bt_private_value *flat_connection_names =
-               bt_private_value_map_create();
+       struct bt_value *flat_connection_names =
+               bt_value_map_create();
        GString *flat_connection_name = NULL;
 
        if (!flat_connection_names) {
@@ -620,9 +618,8 @@ static int validate_no_duplicate_connection(struct bt_config *cfg,
                        connection->downstream_comp_name->str,
                        connection->downstream_port_glob->str);
 
-               if (bt_value_map_has_entry(bt_private_value_as_value(
-                               flat_connection_names),
-                               flat_connection_name->str)) {
+               if (bt_value_map_has_entry(flat_connection_names,
+                                          flat_connection_name->str)) {
                        snprintf(error_buf, error_buf_size,
                                "Duplicate connection:\n    %s\n",
                                connection->arg->str);
@@ -630,7 +627,7 @@ static int validate_no_duplicate_connection(struct bt_config *cfg,
                        goto end;
                }
 
-               ret = bt_private_value_map_insert_entry(flat_connection_names,
+               ret = bt_value_map_insert_entry(flat_connection_names,
                        flat_connection_name->str, bt_value_null);
                if (ret) {
                        goto end;
@@ -682,7 +679,7 @@ end:
 }
 
 int bt_config_cli_args_create_connections(struct bt_config *cfg,
-               struct bt_value *connection_args,
+               const struct bt_value *connection_args,
                char *error_buf, size_t error_buf_size)
 {
        int ret;
@@ -695,8 +692,8 @@ int bt_config_cli_args_create_connections(struct bt_config *cfg,
        }
 
        for (i = 0; i < bt_value_array_get_size(connection_args); i++) {
-               struct bt_value *arg_value =
-                       bt_value_array_borrow_element_by_index(
+               const struct bt_value *arg_value =
+                       bt_value_array_borrow_element_by_index_const(
                                connection_args, i);
                const char *arg;
                struct bt_config_connection *cfg_connection;
index de138665da258acd7c6089dc78f711b8145e1087..5c5f1ff589b226261527353c41fbebc9caaf4831 100644 (file)
@@ -30,7 +30,7 @@
 #include "babeltrace-cfg.h"
 
 int bt_config_cli_args_create_connections(struct bt_config *cfg,
-               struct bt_value *connection_args,
+               const struct bt_value *connection_args,
                char *error_buf, size_t error_buf_size);
 
 #endif /* CLI_BABELTRACE_CFG_CLI_ARGS_CONNECT_H */
index 612517268de52d7d3654238ac365ffacd5316547..d0bfe1e59f557758c3087e52dd24a0649c4699a7 100644 (file)
@@ -21,8 +21,7 @@
  * SOFTWARE.
  */
 
-#include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
+#include <babeltrace/babeltrace.h>
 #include "babeltrace-cfg.h"
 #include "babeltrace-cfg-cli-args.h"
 #include "babeltrace-cfg-cli-args-default.h"
 struct bt_config *bt_config_cli_args_create_with_default(int argc,
                const char *argv[], int *retcode)
 {
-       struct bt_private_value *initial_plugin_paths;
+       struct bt_value *initial_plugin_paths;
        struct bt_config *cfg = NULL;
        int ret;
 
-       initial_plugin_paths = bt_private_value_array_create();
+       initial_plugin_paths = bt_value_array_create();
        if (!initial_plugin_paths) {
                goto error;
        }
index 784cd5fde70be99d171c590cc76d1e9f42f488ab..f8c751045f019517dfcad75202ba9e3504c63f7c 100644 (file)
@@ -34,8 +34,6 @@
 #include <inttypes.h>
 #include <babeltrace/babeltrace.h>
 #include <babeltrace/common-internal.h>
-#include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
 #include <popt.h>
 #include <glib.h>
 #include <sys/types.h>
@@ -85,7 +83,7 @@ struct ini_parsing_state {
        GScanner *scanner;
 
        /* Output map value object being filled (owned by this) */
-       struct bt_private_value *params;
+       struct bt_value *params;
 
        /* Next expected FSM state */
        enum ini_parsing_fsm_state expecting;
@@ -122,8 +120,8 @@ struct text_legacy_opts {
        GString *output;
        GString *dbg_info_dir;
        GString *dbg_info_target_prefix;
-       struct bt_value *names;
-       struct bt_value *fields;
+       const struct bt_value *names;
+       const struct bt_value *fields;
 
        /* Flags */
        bool no_delta;
@@ -242,9 +240,8 @@ int ini_handle_state(struct ini_parsing_state *state)
                        goto error;
                }
 
-               if (bt_value_map_has_entry(
-                               bt_private_value_as_value(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);
@@ -295,22 +292,16 @@ int ini_handle_state(struct ini_parsing_state *state)
                                goto error;
                        }
 
-                       value = bt_private_value_as_value(
-                               bt_private_value_integer_create_init(
-                                       (int64_t) int_val));
+                       value = bt_value_integer_create_init((int64_t)int_val);
                        break;
                }
                case G_TOKEN_FLOAT:
                        /* Positive floating point number */
-                       value = bt_private_value_as_value(
-                               bt_private_value_real_create_init(
-                                       state->scanner->value.v_float));
+                       value = bt_value_real_create_init(state->scanner->value.v_float);
                        break;
                case G_TOKEN_STRING:
                        /* Quoted string */
-                       value = bt_private_value_as_value(
-                               bt_private_value_string_create_init(
-                                       state->scanner->value.v_string));
+                       value = bt_value_string_create_init(state->scanner->value.v_string);
                        break;
                case G_TOKEN_IDENTIFIER:
                {
@@ -332,17 +323,14 @@ int ini_handle_state(struct ini_parsing_state *state)
                        } else if (!strcmp(id, "true") || !strcmp(id, "TRUE") ||
                                        !strcmp(id, "yes") ||
                                        !strcmp(id, "YES")) {
-                               value = bt_private_value_as_value(
-                                       bt_private_value_bool_create_init(true));
+                               value = bt_value_bool_create_init(true);
                        } else if (!strcmp(id, "false") ||
                                        !strcmp(id, "FALSE") ||
                                        !strcmp(id, "no") ||
                                        !strcmp(id, "NO")) {
-                               value = bt_private_value_as_value(
-                                       bt_private_value_bool_create_init(false));
+                               value = bt_value_bool_create_init(false);
                        } else {
-                               value = bt_private_value_as_value(
-                                       bt_private_value_string_create_init(id));
+                               value = bt_value_string_create_init(id);
                        }
                        break;
                }
@@ -375,16 +363,12 @@ int ini_handle_state(struct ini_parsing_state *state)
                                goto error;
                        }
 
-                       value = bt_private_value_as_value(
-                               bt_private_value_integer_create_init(
-                                       -((int64_t) int_val)));
+                       value = bt_value_integer_create_init(-((int64_t)int_val));
                        break;
                }
                case G_TOKEN_FLOAT:
                        /* Negative floating point number */
-                       value = bt_private_value_as_value(
-                               bt_private_value_real_create_init(
-                                       -state->scanner->value.v_float));
+                       value = bt_value_real_create_init(-state->scanner->value.v_float);
                        break;
                default:
                        /* Unset value variable will trigger the error */
@@ -425,7 +409,7 @@ error:
 
 success:
        if (value) {
-               if (bt_private_value_map_insert_entry(state->params,
+               if (bt_value_map_insert_entry(state->params,
                                state->last_map_key, value)) {
                        /* Only override return value on error */
                        ret = -1;
@@ -443,7 +427,7 @@ end:
  * Return value is owned by the caller.
  */
 static
-struct bt_private_value *bt_private_value_from_ini(const char *arg,
+struct bt_value *bt_value_from_ini(const char *arg,
                GString *ini_error)
 {
        /* Lexical scanner configuration */
@@ -523,7 +507,7 @@ struct bt_private_value *bt_private_value_from_ini(const char *arg,
                .ini_error = ini_error,
        };
 
-       state.params = bt_private_value_map_create();
+       state.params = bt_value_map_create();
        if (!state.params) {
                goto error;
        }
@@ -569,9 +553,9 @@ end:
  * Return value is owned by the caller.
  */
 static
-struct bt_private_value *bt_private_value_from_arg(const char *arg)
+struct bt_value *bt_value_from_arg(const char *arg)
 {
-       struct bt_private_value *params = NULL;
+       struct bt_value *params = NULL;
        GString *ini_error = NULL;
 
        ini_error = g_string_new(NULL);
@@ -581,7 +565,7 @@ struct bt_private_value *bt_private_value_from_arg(const char *arg)
        }
 
        /* Try INI-style parsing */
-       params = bt_private_value_from_ini(arg, ini_error);
+       params = bt_value_from_ini(arg, ini_error);
        if (!params) {
                printf_err("%s", ini_error->str);
                goto end;
@@ -824,7 +808,7 @@ struct bt_config_component *bt_config_component_create(
        }
 
        /* Start with empty parameters */
-       cfg_component->params = bt_private_value_map_create();
+       cfg_component->params = bt_value_map_create();
        if (!cfg_component->params) {
                print_err_oom();
                goto error;
@@ -1023,13 +1007,13 @@ GScanner *create_csv_identifiers_scanner(void)
  * Return value is owned by the caller.
  */
 static
-struct bt_private_value *names_from_arg(const char *arg)
+struct bt_value *names_from_arg(const char *arg)
 {
        GScanner *scanner = NULL;
-       struct bt_private_value *names = NULL;
+       struct bt_value *names = NULL;
        bool found_all = false, found_none = false, found_item = false;
 
-       names = bt_private_value_array_create();
+       names = bt_value_array_create();
        if (!names) {
                print_err_oom();
                goto error;
@@ -1054,33 +1038,33 @@ struct bt_private_value *names_from_arg(const char *arg)
                                        !strcmp(identifier, "args") ||
                                        !strcmp(identifier, "arg")) {
                                found_item = true;
-                               if (bt_private_value_array_append_string_element(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_private_value_array_append_string_element(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_private_value_array_append_string_element(names,
+                               if (bt_value_array_append_string_element(names,
                                                identifier)) {
                                        goto error;
                                }
                        } else if (!strcmp(identifier, "all")) {
                                found_all = true;
-                               if (bt_private_value_array_append_string_element(names,
+                               if (bt_value_array_append_string_element(names,
                                                identifier)) {
                                        goto error;
                                }
                        } else if (!strcmp(identifier, "none")) {
                                found_none = true;
-                               if (bt_private_value_array_append_string_element(names,
+                               if (bt_value_array_append_string_element(names,
                                                identifier)) {
                                        goto error;
                                }
@@ -1110,7 +1094,7 @@ end:
         * least one item is specified.
         */
        if (found_item && !found_none && !found_all) {
-               if (bt_private_value_array_append_string_element(names, "none")) {
+               if (bt_value_array_append_string_element(names, "none")) {
                        goto error;
                }
        }
@@ -1135,12 +1119,12 @@ error:
  * Return value is owned by the caller.
  */
 static
-struct bt_private_value *fields_from_arg(const char *arg)
+struct bt_value *fields_from_arg(const char *arg)
 {
        GScanner *scanner = NULL;
-       struct bt_private_value *fields;
+       struct bt_value *fields;
 
-       fields = bt_private_value_array_create();
+       fields = bt_value_array_create();
        if (!fields) {
                print_err_oom();
                goto error;
@@ -1170,7 +1154,7 @@ struct bt_private_value *fields_from_arg(const char *arg)
                                        !strcmp(identifier, "emf") ||
                                        !strcmp(identifier, "callsite") ||
                                        !strcmp(identifier, "all")) {
-                               if (bt_private_value_array_append_string_element(fields,
+                               if (bt_value_array_append_string_element(fields,
                                                identifier)) {
                                        goto error;
                                }
@@ -1224,7 +1208,7 @@ void append_param_arg(GString *params_arg, const char *key, const char *value)
  */
 static
 int insert_flat_params_from_array(GString *params_arg,
-               struct bt_value *names_array, const char *prefix)
+               const struct bt_value *names_array, const char *prefix)
 {
        int ret = 0;
        int i;
@@ -1254,8 +1238,9 @@ int insert_flat_params_from_array(GString *params_arg,
        }
 
        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 struct bt_value *str_obj =
+                       bt_value_array_borrow_element_by_index_const(names_array,
+                                                                    i);
                const char *suffix;
                bool is_default = false;
 
@@ -1394,7 +1379,7 @@ static
 int add_run_cfg_comp_check_name(struct bt_config *cfg,
                struct bt_config_component *cfg_comp,
                enum bt_config_component_dest dest,
-               struct bt_private_value *instance_names)
+               struct bt_value *instance_names)
 {
        int ret = 0;
 
@@ -1404,15 +1389,15 @@ int add_run_cfg_comp_check_name(struct bt_config *cfg,
                goto end;
        }
 
-       if (bt_value_map_has_entry(bt_private_value_as_value(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_private_value_map_insert_entry(instance_names,
+       if (bt_value_map_insert_entry(instance_names,
                        cfg_comp->instance_name->str, bt_value_null)) {
                print_err_oom();
                ret = -1;
@@ -1426,7 +1411,7 @@ end:
 }
 
 static
-int append_env_var_plugin_paths(struct bt_private_value *plugin_paths)
+int append_env_var_plugin_paths(struct bt_value *plugin_paths)
 {
        int ret = 0;
        const char *envvar;
@@ -1452,7 +1437,7 @@ end:
 }
 
 static
-int append_home_and_system_plugin_paths(struct bt_private_value *plugin_paths,
+int append_home_and_system_plugin_paths(struct bt_value *plugin_paths,
                bool omit_system_plugin_path, bool omit_home_plugin_path)
 {
        int ret;
@@ -1499,7 +1484,7 @@ int append_home_and_system_plugin_paths_cfg(struct bt_config *cfg)
 
 static
 struct bt_config *bt_config_base_create(enum bt_config_command command,
-               struct bt_private_value *initial_plugin_paths,
+               const struct bt_value *initial_plugin_paths,
                bool needs_plugins)
 {
        struct bt_config *cfg;
@@ -1516,10 +1501,13 @@ struct bt_config *bt_config_base_create(enum bt_config_command command,
        cfg->command_needs_plugins = needs_plugins;
 
        if (initial_plugin_paths) {
-               cfg->plugin_paths = initial_plugin_paths;
-               bt_object_get_ref(cfg->plugin_paths);
+               struct bt_value *initial_plugin_paths_copy;
+
+               (void) bt_value_copy(&initial_plugin_paths_copy,
+                       initial_plugin_paths);
+               cfg->plugin_paths = initial_plugin_paths_copy;
        } else {
-               cfg->plugin_paths = bt_private_value_array_create();
+               cfg->plugin_paths = bt_value_array_create();
                if (!cfg->plugin_paths) {
                        print_err_oom();
                        goto error;
@@ -1537,7 +1525,7 @@ end:
 
 static
 struct bt_config *bt_config_run_create(
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        struct bt_config *cfg;
 
@@ -1587,7 +1575,7 @@ end:
 
 static
 struct bt_config *bt_config_list_plugins_create(
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        struct bt_config *cfg;
 
@@ -1609,7 +1597,7 @@ end:
 
 static
 struct bt_config *bt_config_help_create(
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        struct bt_config *cfg;
 
@@ -1637,7 +1625,7 @@ end:
 
 static
 struct bt_config *bt_config_query_create(
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        struct bt_config *cfg;
 
@@ -1665,7 +1653,7 @@ end:
 
 static
 struct bt_config *bt_config_print_ctf_metadata_create(
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        struct bt_config *cfg;
 
@@ -1699,7 +1687,7 @@ end:
 
 static
 struct bt_config *bt_config_print_lttng_live_sessions_create(
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        struct bt_config *cfg;
 
@@ -1734,7 +1722,7 @@ end:
 
 static
 int bt_config_append_plugin_paths_check_setuid_setgid(
-               struct bt_private_value *plugin_paths, const char *arg)
+               struct bt_value *plugin_paths, const char *arg)
 {
        int ret = 0;
 
@@ -1835,7 +1823,7 @@ static
 struct bt_config *bt_config_help_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        poptContext pc = NULL;
        char *arg = NULL;
@@ -1997,7 +1985,7 @@ static
 struct bt_config *bt_config_query_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        poptContext pc = NULL;
        char *arg = NULL;
@@ -2005,7 +1993,7 @@ struct bt_config *bt_config_query_from_args(int argc, const char *argv[],
        int ret;
        struct bt_config *cfg = NULL;
        const char *leftover;
-       struct bt_private_value *params = bt_private_value_null;
+       struct bt_value *params = bt_value_null;
 
        *retcode = 0;
        cfg = bt_config_query_create(initial_plugin_paths);
@@ -2049,7 +2037,7 @@ struct bt_config *bt_config_query_from_args(int argc, const char *argv[],
                case OPT_PARAMS:
                {
                        bt_object_put_ref(params);
-                       params = bt_private_value_from_arg(arg);
+                       params = bt_value_from_arg(arg);
                        if (!params) {
                                printf_err("Invalid format for --params option's argument:\n    %s\n",
                                        arg);
@@ -2186,7 +2174,7 @@ static
 struct bt_config *bt_config_list_plugins_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        poptContext pc = NULL;
        char *arg = NULL;
@@ -2376,18 +2364,18 @@ static
 struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        poptContext pc = NULL;
        char *arg = NULL;
        struct bt_config_component *cur_cfg_comp = NULL;
        enum bt_config_component_dest cur_cfg_comp_dest =
                        BT_CONFIG_COMPONENT_DEST_UNKNOWN;
-       struct bt_private_value *cur_base_params = NULL;
+       struct bt_value *cur_base_params = NULL;
        int opt, ret = 0;
        struct bt_config *cfg = NULL;
-       struct bt_private_value *instance_names = NULL;
-       struct bt_private_value *connection_args = NULL;
+       struct bt_value *instance_names = NULL;
+       struct bt_value *connection_args = NULL;
        GString *cur_param_key = NULL;
        char error_buf[256] = { 0 };
        long retry_duration = -1;
@@ -2430,19 +2418,19 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
        cfg->cmd_data.run.retry_duration_us = 100000;
        cfg->omit_system_plugin_path = force_omit_system_plugin_path;
        cfg->omit_home_plugin_path = force_omit_home_plugin_path;
-       cur_base_params = bt_private_value_map_create();
+       cur_base_params = bt_value_map_create();
        if (!cur_base_params) {
                print_err_oom();
                goto error;
        }
 
-       instance_names = bt_private_value_map_create();
+       instance_names = bt_value_map_create();
        if (!instance_names) {
                print_err_oom();
                goto error;
        }
 
-       connection_args = bt_private_value_array_create();
+       connection_args = bt_value_array_create();
        if (!connection_args) {
                print_err_oom();
                goto error;
@@ -2518,7 +2506,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                        bt_object_put_ref(cur_cfg_comp->params);
                        status = bt_value_copy(
                                &cur_cfg_comp->params,
-                               bt_private_value_as_value(cur_base_params));
+                               cur_base_params);
                        if (status != BT_VALUE_STATUS_OK) {
                                print_err_oom();
                                goto error;
@@ -2529,8 +2517,8 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                }
                case OPT_PARAMS:
                {
-                       struct bt_private_value *params;
-                       struct bt_private_value *params_to_set;
+                       struct bt_value *params;
+                       struct bt_value *params_to_set;
 
                        if (!cur_cfg_comp) {
                                printf_err("Cannot add parameters to unavailable component:\n    %s\n",
@@ -2538,7 +2526,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                                goto error;
                        }
 
-                       params = bt_private_value_from_arg(arg);
+                       params = bt_value_from_arg(arg);
                        if (!params) {
                                printf_err("Invalid format for --params option's argument:\n    %s\n",
                                        arg);
@@ -2546,8 +2534,8 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                        }
 
                        status = bt_value_map_extend(&params_to_set,
-                               bt_private_value_as_value(cur_cfg_comp->params),
-                               bt_private_value_as_value(params));
+                               cur_cfg_comp->params,
+                               params);
                        BT_OBJECT_PUT_REF_AND_RESET(params);
                        if (status != BT_VALUE_STATUS_OK) {
                                printf_err("Cannot extend current component parameters with --params option's argument:\n    %s\n",
@@ -2579,7 +2567,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                                goto error;
                        }
 
-                       if (bt_private_value_map_insert_string_entry(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;
@@ -2596,8 +2584,8 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                        break;
                case OPT_BASE_PARAMS:
                {
-                       struct bt_private_value *params =
-                               bt_private_value_from_arg(arg);
+                       struct bt_value *params =
+                               bt_value_from_arg(arg);
 
                        if (!params) {
                                printf_err("Invalid format for --base-params option's argument:\n    %s\n",
@@ -2610,14 +2598,14 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                }
                case OPT_RESET_BASE_PARAMS:
                        BT_OBJECT_PUT_REF_AND_RESET(cur_base_params);
-                       cur_base_params = bt_private_value_map_create();
+                       cur_base_params = bt_value_map_create();
                        if (!cur_base_params) {
                                print_err_oom();
                                goto error;
                        }
                        break;
                case OPT_CONNECT:
-                       if (bt_private_value_array_append_string_element(
+                       if (bt_value_array_append_string_element(
                                        connection_args, arg)) {
                                print_err_oom();
                                goto error;
@@ -2686,7 +2674,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
        }
 
        ret = bt_config_cli_args_create_connections(cfg,
-               bt_private_value_as_value(connection_args),
+               connection_args,
                error_buf, 256);
        if (ret) {
                printf_err("Cannot creation connections:\n%s", error_buf);
@@ -2717,10 +2705,10 @@ end:
 }
 
 static
-struct bt_config *bt_config_run_from_args_array(struct bt_value *run_args,
+struct bt_config *bt_config_run_from_args_array(const struct bt_value *run_args,
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        struct bt_config *cfg = NULL;
        const char **argv;
@@ -2741,8 +2729,9 @@ struct bt_config *bt_config_run_from_args_array(struct bt_value *run_args,
                goto end;
        }
        for (i = 0; i < len; i++) {
-               struct bt_value *arg_value =
-                       bt_value_array_borrow_element_by_index(run_args, i);
+               const struct bt_value *arg_value =
+                       bt_value_array_borrow_element_by_index_const(run_args,
+                                                                    i);
                const char *arg;
 
                BT_ASSERT(arg_value);
@@ -2940,7 +2929,7 @@ struct poptOption convert_long_options[] = {
 
 static
 GString *get_component_auto_name(const char *prefix,
-               struct bt_value *existing_names)
+               const struct bt_value *existing_names)
 {
        unsigned int i = 0;
        GString *auto_name = g_string_new(NULL);
@@ -2969,12 +2958,12 @@ struct implicit_component_args {
        GString *comp_arg;
        GString *name_arg;
        GString *params_arg;
-       struct bt_private_value *extra_params;
+       struct bt_value *extra_params;
 };
 
 static
 int assign_name_to_implicit_component(struct implicit_component_args *args,
-               const char *prefix, struct bt_private_value *existing_names,
+               const char *prefix, struct bt_value *existing_names,
                GList **comp_names, bool append_to_comp_names)
 {
        int ret = 0;
@@ -2985,7 +2974,7 @@ int assign_name_to_implicit_component(struct implicit_component_args *args,
        }
 
        name = get_component_auto_name(prefix,
-               bt_private_value_as_value(existing_names));
+               existing_names);
 
        if (!name) {
                ret = -1;
@@ -2994,7 +2983,7 @@ int assign_name_to_implicit_component(struct implicit_component_args *args,
 
        g_string_assign(args->name_arg, name->str);
 
-       if (bt_private_value_map_insert_entry(existing_names, name->str,
+       if (bt_value_map_insert_entry(existing_names, name->str,
                        bt_value_null)) {
                print_err_oom();
                ret = -1;
@@ -3017,7 +3006,7 @@ end:
 static
 int append_run_args_for_implicit_component(
                struct implicit_component_args *impl_args,
-               struct bt_private_value *run_args)
+               struct bt_value *run_args)
 {
        int ret = 0;
        size_t i;
@@ -3026,55 +3015,53 @@ int append_run_args_for_implicit_component(
                goto end;
        }
 
-       if (bt_private_value_array_append_string_element(run_args, "--component")) {
+       if (bt_value_array_append_string_element(run_args, "--component")) {
                print_err_oom();
                goto error;
        }
 
-       if (bt_private_value_array_append_string_element(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_private_value_array_append_string_element(run_args, "--name")) {
+       if (bt_value_array_append_string_element(run_args, "--name")) {
                print_err_oom();
                goto error;
        }
 
-       if (bt_private_value_array_append_string_element(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_private_value_array_append_string_element(run_args, "--params")) {
+               if (bt_value_array_append_string_element(run_args, "--params")) {
                        print_err_oom();
                        goto error;
                }
 
-               if (bt_private_value_array_append_string_element(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_get_size(
-                       bt_private_value_as_value(impl_args->extra_params));
+       for (i = 0; i < bt_value_array_get_size(impl_args->extra_params);
                        i++) {
-               struct bt_value *elem;
+               const struct bt_value *elem;
                const char *arg;
 
-               elem = bt_value_array_borrow_element_by_index(
-                       bt_private_value_as_value(impl_args->extra_params),
-                       i);
+               elem = bt_value_array_borrow_element_by_index(impl_args->extra_params,
+                                                             i);
                if (!elem) {
                        goto error;
                }
 
                BT_ASSERT(bt_value_is_string(elem));
                arg = bt_value_string_get(elem);
-               ret = bt_private_value_array_append_string_element(run_args, arg);
+               ret = bt_value_array_append_string_element(run_args, arg);
                if (ret) {
                        print_err_oom();
                        goto error;
@@ -3131,7 +3118,7 @@ int init_implicit_component_args(struct implicit_component_args *args,
        args->comp_arg = g_string_new(comp_arg);
        args->name_arg = g_string_new(NULL);
        args->params_arg = g_string_new(NULL);
-       args->extra_params = bt_private_value_array_create();
+       args->extra_params = bt_value_array_create();
 
        if (!args->comp_arg || !args->name_arg ||
                        !args->params_arg || !args->extra_params) {
@@ -3165,25 +3152,25 @@ int append_implicit_component_extra_param(struct implicit_component_args *args,
        BT_ASSERT(key);
        BT_ASSERT(value);
 
-       if (bt_private_value_array_append_string_element(args->extra_params, "--key")) {
+       if (bt_value_array_append_string_element(args->extra_params, "--key")) {
                print_err_oom();
                ret = -1;
                goto end;
        }
 
-       if (bt_private_value_array_append_string_element(args->extra_params, key)) {
+       if (bt_value_array_append_string_element(args->extra_params, key)) {
                print_err_oom();
                ret = -1;
                goto end;
        }
 
-       if (bt_private_value_array_append_string_element(args->extra_params, "--value")) {
+       if (bt_value_array_append_string_element(args->extra_params, "--value")) {
                print_err_oom();
                ret = -1;
                goto end;
        }
 
-       if (bt_private_value_array_append_string_element(args->extra_params, value)) {
+       if (bt_value_array_append_string_element(args->extra_params, value)) {
                print_err_oom();
                ret = -1;
                goto end;
@@ -3196,8 +3183,8 @@ end:
 static
 int convert_append_name_param(enum bt_config_component_dest dest,
                GString *cur_name, GString *cur_name_prefix,
-               struct bt_private_value *run_args,
-               struct bt_private_value *all_names,
+               struct bt_value *run_args,
+               struct bt_value *all_names,
                GList **source_names, GList **filter_names,
                GList **sink_names)
 {
@@ -3214,16 +3201,15 @@ int convert_append_name_param(enum bt_config_component_dest dest,
                         * component.
                         */
                        name = get_component_auto_name(cur_name_prefix->str,
-                               bt_private_value_as_value(all_names));
+                               all_names);
                        append_name_opt = true;
                } else {
                        /*
                         * An explicit name was provided for the user
                         * component.
                         */
-                       if (bt_value_map_has_entry(
-                                       bt_private_value_as_value(all_names),
-                                       cur_name->str)) {
+                       if (bt_value_map_has_entry(all_names,
+                                                  cur_name->str)) {
                                printf_err("Duplicate component instance name:\n    %s\n",
                                        cur_name->str);
                                goto error;
@@ -3241,7 +3227,7 @@ int convert_append_name_param(enum bt_config_component_dest dest,
                 * Remember this name globally, for the uniqueness of
                 * all component names.
                 */
-               if (bt_private_value_map_insert_entry(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;
                }
@@ -3250,12 +3236,12 @@ int convert_append_name_param(enum bt_config_component_dest dest,
                 * Append the --name option if necessary.
                 */
                if (append_name_opt) {
-                       if (bt_private_value_array_append_string_element(run_args, "--name")) {
+                       if (bt_value_array_append_string_element(run_args, "--name")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, name->str)) {
+                       if (bt_value_array_append_string_element(run_args, name->str)) {
                                print_err_oom();
                                goto error;
                        }
@@ -3323,7 +3309,7 @@ end:
  * function.
  */
 static
-int append_connect_arg(struct bt_private_value *run_args,
+int append_connect_arg(struct bt_value *run_args,
                const char *upstream_name, const char *downstream_name)
 {
        int ret = 0;
@@ -3337,7 +3323,7 @@ int append_connect_arg(struct bt_private_value *run_args,
                goto end;
        }
 
-       ret = bt_private_value_array_append_string_element(run_args, "--connect");
+       ret = bt_value_array_append_string_element(run_args, "--connect");
        if (ret) {
                print_err_oom();
                ret = -1;
@@ -3347,7 +3333,7 @@ int append_connect_arg(struct bt_private_value *run_args,
        g_string_append(arg, e_upstream_name->str);
        g_string_append_c(arg, ':');
        g_string_append(arg, e_downstream_name->str);
-       ret = bt_private_value_array_append_string_element(run_args, arg->str);
+       ret = bt_value_array_append_string_element(run_args, arg->str);
        if (ret) {
                print_err_oom();
                ret = -1;
@@ -3374,7 +3360,7 @@ end:
  * Appends the run command's --connect options for the convert command.
  */
 static
-int convert_auto_connect(struct bt_private_value *run_args,
+int convert_auto_connect(struct bt_value *run_args,
                GList *source_names, GList *filter_names,
                GList *sink_names)
 {
@@ -3559,8 +3545,7 @@ int fill_implicit_ctf_inputs_args(GPtrArray *implicit_ctf_inputs_args,
                 */
                BT_OBJECT_PUT_REF_AND_RESET(impl_args->extra_params);
                status = bt_value_copy(&impl_args->extra_params,
-                               bt_private_value_as_value(
-                               base_implicit_ctf_input_args->extra_params));
+                               base_implicit_ctf_input_args->extra_params);
                if (status != BT_VALUE_STATUS_OK) {
                        print_err_oom();
                        destroy_implicit_component_args(impl_args);
@@ -3597,7 +3582,7 @@ static
 struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               struct bt_private_value *initial_plugin_paths, char *log_level)
+               const struct bt_value *initial_plugin_paths, char *log_level)
 {
        poptContext pc = NULL;
        char *arg = NULL;
@@ -3616,8 +3601,8 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
        bool print_run_args = false;
        bool print_run_args_0 = false;
        bool print_ctf_metadata = false;
-       struct bt_private_value *run_args = NULL;
-       struct bt_private_value *all_names = NULL;
+       struct bt_value *run_args = NULL;
+       struct bt_value *all_names = NULL;
        GList *source_names = NULL;
        GList *filter_names = NULL;
        GList *sink_names = NULL;
@@ -3631,14 +3616,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
        struct implicit_component_args implicit_debug_info_args = { 0 };
        struct implicit_component_args implicit_muxer_args = { 0 };
        struct implicit_component_args implicit_trimmer_args = { 0 };
-       struct bt_private_value *plugin_paths;
+       struct bt_value *plugin_paths;
        char error_buf[256] = { 0 };
        size_t i;
        struct bt_common_lttng_live_url_parts lttng_live_url_parts = { 0 };
        char *output = NULL;
 
-       plugin_paths = initial_plugin_paths;
-       bt_object_get_ref(plugin_paths);
+       (void) bt_value_copy(&plugin_paths, initial_plugin_paths);
 
        *retcode = 0;
 
@@ -3695,13 +3679,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                goto error;
        }
 
-       all_names = bt_private_value_map_create();
+       all_names = bt_value_map_create();
        if (!all_names) {
                print_err_oom();
                goto error;
        }
 
-       run_args = bt_private_value_array_create();
+       run_args = bt_value_array_create();
        if (!run_args) {
                print_err_oom();
                goto error;
@@ -3798,13 +3782,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                                abort();
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args,
+                       if (bt_value_array_append_string_element(run_args,
                                        "--component")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, arg)) {
+                       if (bt_value_array_append_string_element(run_args, arg)) {
                                print_err_oom();
                                goto error;
                        }
@@ -3827,13 +3811,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args,
+                       if (bt_value_array_append_string_element(run_args,
                                        "--params")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, arg)) {
+                       if (bt_value_array_append_string_element(run_args, arg)) {
                                print_err_oom();
                                goto error;
                        }
@@ -3845,22 +3829,22 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, "--key")) {
+                       if (bt_value_array_append_string_element(run_args, "--key")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, "path")) {
+                       if (bt_value_array_append_string_element(run_args, "path")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, "--value")) {
+                       if (bt_value_array_append_string_element(run_args, "--value")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, arg)) {
+                       if (bt_value_array_append_string_element(run_args, arg)) {
                                print_err_oom();
                                goto error;
                        }
@@ -3872,22 +3856,22 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, "--key")) {
+                       if (bt_value_array_append_string_element(run_args, "--key")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, "url")) {
+                       if (bt_value_array_append_string_element(run_args, "url")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, "--value")) {
+                       if (bt_value_array_append_string_element(run_args, "--value")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, arg)) {
+                       if (bt_value_array_append_string_element(run_args, arg)) {
                                print_err_oom();
                                goto error;
                        }
@@ -3899,12 +3883,12 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, "--name")) {
+                       if (bt_value_array_append_string_element(run_args, "--name")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, arg)) {
+                       if (bt_value_array_append_string_element(run_args, arg)) {
                                print_err_oom();
                                goto error;
                        }
@@ -3914,20 +3898,20 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                case OPT_OMIT_HOME_PLUGIN_PATH:
                        force_omit_home_plugin_path = true;
 
-                       if (bt_private_value_array_append_string_element(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_private_value_array_append_string_element(run_args,
+                       if (bt_value_array_append_string_element(run_args,
                                        "--retry-duration")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, arg)) {
+                       if (bt_value_array_append_string_element(run_args, arg)) {
                                print_err_oom();
                                goto error;
                        }
@@ -3935,7 +3919,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                case OPT_OMIT_SYSTEM_PLUGIN_PATH:
                        force_omit_system_plugin_path = true;
 
-                       if (bt_private_value_array_append_string_element(run_args,
+                       if (bt_value_array_append_string_element(run_args,
                                        "--omit-system-plugin-path")) {
                                print_err_oom();
                                goto error;
@@ -3947,13 +3931,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args,
+                       if (bt_value_array_append_string_element(run_args,
                                        "--plugin-path")) {
                                print_err_oom();
                                goto error;
                        }
 
-                       if (bt_private_value_array_append_string_element(run_args, arg)) {
+                       if (bt_value_array_append_string_element(run_args, arg)) {
                                print_err_oom();
                                goto error;
                        }
@@ -4172,7 +4156,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        break;
                case OPT_FIELDS:
                {
-                       struct bt_private_value *fields = fields_from_arg(arg);
+                       struct bt_value *fields = fields_from_arg(arg);
 
                        if (!fields) {
                                goto error;
@@ -4181,7 +4165,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        implicit_text_args.exists = true;
                        ret = insert_flat_params_from_array(
                                implicit_text_args.params_arg,
-                               bt_private_value_as_value(fields), "field");
+                               fields, "field");
                        bt_object_put_ref(fields);
                        if (ret) {
                                goto error;
@@ -4190,7 +4174,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                }
                case OPT_NAMES:
                {
-                       struct bt_private_value *names = names_from_arg(arg);
+                       struct bt_value *names = names_from_arg(arg);
 
                        if (!names) {
                                goto error;
@@ -4199,7 +4183,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        implicit_text_args.exists = true;
                        ret = insert_flat_params_from_array(
                                implicit_text_args.params_arg,
-                               bt_private_value_as_value(names), "name");
+                               names, "name");
                        bt_object_put_ref(names);
                        if (ret) {
                                goto error;
@@ -4689,12 +4673,10 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        goto error;
                }
 
-               for (i = 0; i < bt_value_array_get_size(
-                               bt_private_value_as_value(run_args)); i++) {
-                       struct bt_value *arg_value =
-                               bt_value_array_borrow_element_by_index(
-                                       bt_private_value_as_value(run_args),
-                                       i);
+               for (i = 0; i < bt_value_array_get_size(run_args); i++) {
+                       const struct bt_value *arg_value =
+                               bt_value_array_borrow_element_by_index(run_args,
+                                                                      i);
                        const char *arg;
                        GString *quoted = NULL;
                        const char *arg_to_print;
@@ -4719,8 +4701,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                                g_string_free(quoted, TRUE);
                        }
 
-                       if (i < bt_value_array_get_size(
-                                       bt_private_value_as_value(run_args)) - 1) {
+                       if (i < bt_value_array_get_size(run_args) - 1) {
                                if (print_run_args) {
                                        putchar(' ');
                                } else {
@@ -4734,10 +4715,10 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                goto end;
        }
 
-       cfg = bt_config_run_from_args_array(
-               bt_private_value_as_value(run_args), retcode,
-               force_omit_system_plugin_path, force_omit_home_plugin_path,
-               initial_plugin_paths);
+       cfg = bt_config_run_from_args_array(run_args, retcode,
+                                           force_omit_system_plugin_path,
+                                           force_omit_home_plugin_path,
+                                           initial_plugin_paths);
        if (!cfg) {
                goto error;
        }
@@ -4851,7 +4832,7 @@ char log_level_from_arg(const char *arg)
 struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               struct bt_private_value *initial_plugin_paths)
+               const struct bt_value *initial_plugin_paths)
 {
        struct bt_config *config = NULL;
        int i;
@@ -4872,7 +4853,7 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
        *retcode = -1;
 
        if (!initial_plugin_paths) {
-               initial_plugin_paths = bt_private_value_array_create();
+               initial_plugin_paths = bt_value_array_create();
                if (!initial_plugin_paths) {
                        *retcode = 1;
                        goto end;
index 4878dcbb7285b50ef1dab71ef02d2b80ee5b9a6f..e6afb3756b5e354650c9c640b000d1c1bd03c6a0 100644 (file)
@@ -37,6 +37,6 @@
 struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
                bool force_omit_home_plugin_path,
-               struct bt_private_value *initial_plugin_paths);
+               const struct bt_value *initial_plugin_paths);
 
 #endif /* CLI_BABELTRACE_CFG_CLI_ARGS_H */
index d96fd5cee7470ba0aff1c267ca5ab03d278d005d..f4d836ae2858bfbb98538d8a83f31988b5d84101 100644 (file)
@@ -23,8 +23,7 @@
  */
 
 #include <babeltrace/common-internal.h>
-#include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
+#include <babeltrace/babeltrace.h>
 #include <glib.h>
 #include "babeltrace-cfg.h"
 
@@ -39,7 +38,7 @@ void destroy_gstring(void *data)
  * and appends them to the array value object plugin_paths.
  */
 int bt_config_append_plugin_paths(
-               struct bt_private_value *plugin_paths, const char *arg)
+               struct bt_value *plugin_paths, const char *arg)
 {
        int ret = 0;
        GPtrArray *dirs = g_ptr_array_new_with_free_func(destroy_gstring);
@@ -59,7 +58,7 @@ int bt_config_append_plugin_paths(
        for (i = 0; i < dirs->len; i++) {
                GString *dir = g_ptr_array_index(dirs, i);
 
-               ret = bt_private_value_array_append_string_element(
+               ret = bt_value_array_append_string_element(
                        plugin_paths, dir->str);
                if (ret != BT_VALUE_STATUS_OK) {
                        ret = -1;
index d72348d38da2a5b9b070937874d55e1156f032f2..9bcc185878fc5b5ddba92ba884e0fd10c992c71a 100644 (file)
@@ -49,7 +49,7 @@ struct bt_config_component {
        enum bt_component_class_type type;
        GString *plugin_name;
        GString *comp_cls_name;
-       struct bt_private_value *params;
+       struct bt_value *params;
        GString *instance_name;
 };
 
@@ -65,7 +65,7 @@ struct bt_config {
        struct bt_object base;
        bool debug;
        bool verbose;
-       struct bt_private_value *plugin_paths;
+       struct bt_value *plugin_paths;
        bool omit_system_plugin_path;
        bool omit_home_plugin_path;
        bool command_needs_plugins;
@@ -135,7 +135,7 @@ struct bt_config_component *bt_config_get_component(GPtrArray *array,
        return comp;
 }
 
-int bt_config_append_plugin_paths(struct bt_private_value *plugin_paths,
+int bt_config_append_plugin_paths(struct bt_value *plugin_paths,
                const char *arg);
 
 void bt_config_connection_destroy(struct bt_config_connection *connection);
index 71e5baf9bae93999ed4860883094d41ca7db3715..06f124615dd0621e2c4871c1946a13b109e138fe 100644 (file)
@@ -170,10 +170,10 @@ void destroy_the_query_executor(void)
 
 static
 int query(struct bt_component_class *comp_cls, const char *obj,
-               struct bt_value *params, struct bt_value **user_result,
+               const struct bt_value *params, const struct bt_value **user_result,
                const char **fail_reason)
 {
-       struct bt_value *result = NULL;
+       const struct bt_value *result = NULL;
        enum bt_query_executor_status status;
        *fail_reason = "unknown error";
        int ret = 0;
@@ -453,10 +453,10 @@ end:
 }
 
 static
-void print_value(FILE *, struct bt_value *, size_t);
+void print_value(FILE *, const struct bt_value *, size_t);
 
 static
-void print_value_rec(FILE *, struct bt_value *, size_t);
+void print_value_rec(FILE *, const struct bt_value *, size_t);
 
 struct print_map_value_data {
        size_t indent;
@@ -464,7 +464,8 @@ struct print_map_value_data {
 };
 
 static
-bt_bool print_map_value(const char *key, struct bt_value *object, void *data)
+bt_bool print_map_value(const char *key, const struct bt_value *object,
+               void *data)
 {
        struct print_map_value_data *print_map_value_data = data;
 
@@ -495,7 +496,7 @@ bt_bool print_map_value(const char *key, struct bt_value *object, void *data)
 }
 
 static
-void print_value_rec(FILE *fp, struct bt_value *value, size_t indent)
+void print_value_rec(FILE *fp, const struct bt_value *value, size_t indent)
 {
        bt_bool bool_val;
        int64_t int_val;
@@ -550,8 +551,8 @@ void print_value_rec(FILE *fp, struct bt_value *value, size_t indent)
                }
 
                for (i = 0; i < size; i++) {
-                       struct bt_value *element =
-                               bt_value_array_borrow_element_by_index(
+                       const struct bt_value *element =
+                               bt_value_array_borrow_element_by_index_const(
                                        value, i);
 
                        if (!element) {
@@ -593,7 +594,7 @@ void print_value_rec(FILE *fp, struct bt_value *value, size_t indent)
                        break;
                }
 
-               bt_value_map_foreach_entry(value, print_map_value, &data);
+               bt_value_map_foreach_entry_const(value, print_map_value, &data);
                break;
        }
        default:
@@ -607,7 +608,7 @@ error:
 }
 
 static
-void print_value(FILE *fp, struct bt_value *value, size_t indent)
+void print_value(FILE *fp, const struct bt_value *value, size_t indent)
 {
        if (!bt_value_is_array(value) && !bt_value_is_map(value)) {
                print_indent(fp, indent);
@@ -631,8 +632,7 @@ void print_bt_config_component(struct bt_config_component *bt_config_component)
        }
 
        fprintf(stderr, "      Parameters:\n");
-       print_value(stderr,
-               bt_private_value_as_value(bt_config_component->params), 8);
+       print_value(stderr, bt_config_component->params, 8);
 }
 
 static
@@ -649,7 +649,7 @@ void print_bt_config_components(GPtrArray *array)
 }
 
 static
-void print_plugin_paths(struct bt_value *plugin_paths)
+void print_plugin_paths(const struct bt_value *plugin_paths)
 {
        fprintf(stderr, "  Plugin paths:\n");
        print_value(stderr, plugin_paths, 4);
@@ -660,7 +660,7 @@ void print_cfg_run(struct bt_config *cfg)
 {
        size_t i;
 
-       print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths));
+       print_plugin_paths(cfg->plugin_paths);
        fprintf(stderr, "  Source component instances:\n");
        print_bt_config_components(cfg->cmd_data.run.sources);
 
@@ -691,19 +691,19 @@ void print_cfg_run(struct bt_config *cfg)
 static
 void print_cfg_list_plugins(struct bt_config *cfg)
 {
-       print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths));
+       print_plugin_paths(cfg->plugin_paths);
 }
 
 static
 void print_cfg_help(struct bt_config *cfg)
 {
-       print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths));
+       print_plugin_paths(cfg->plugin_paths);
 }
 
 static
 void print_cfg_print_ctf_metadata(struct bt_config *cfg)
 {
-       print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths));
+       print_plugin_paths(cfg->plugin_paths);
        fprintf(stderr, "  Path: %s\n",
                cfg->cmd_data.print_ctf_metadata.path->str);
 }
@@ -711,7 +711,7 @@ void print_cfg_print_ctf_metadata(struct bt_config *cfg)
 static
 void print_cfg_print_lttng_live_sessions(struct bt_config *cfg)
 {
-       print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths));
+       print_plugin_paths(cfg->plugin_paths);
        fprintf(stderr, "  URL: %s\n",
                cfg->cmd_data.print_lttng_live_sessions.url->str);
 }
@@ -719,7 +719,7 @@ void print_cfg_print_lttng_live_sessions(struct bt_config *cfg)
 static
 void print_cfg_query(struct bt_config *cfg)
 {
-       print_plugin_paths(bt_private_value_as_value(cfg->plugin_paths));
+       print_plugin_paths(cfg->plugin_paths);
        fprintf(stderr, "  Object: `%s`\n", cfg->cmd_data.query.object->str);
        fprintf(stderr, "  Component class:\n");
        print_bt_config_component(cfg->cmd_data.query.cfg_component);
@@ -796,7 +796,7 @@ void add_to_loaded_plugins(struct bt_plugin_set *plugin_set)
 }
 
 static
-int load_dynamic_plugins(struct bt_value *plugin_paths)
+int load_dynamic_plugins(const struct bt_value *plugin_paths)
 {
        int nr_paths, i, ret = 0;
 
@@ -810,12 +810,13 @@ int load_dynamic_plugins(struct bt_value *plugin_paths)
        BT_LOGI("Loading dynamic plugins.");
 
        for (i = 0; i < nr_paths; i++) {
-               struct bt_value *plugin_path_value = NULL;
+               const struct bt_value *plugin_path_value = NULL;
                const char *plugin_path;
                struct bt_plugin_set *plugin_set;
 
-               plugin_path_value = bt_value_array_borrow_element_by_index(
-                       plugin_paths, i);
+               plugin_path_value =
+                       bt_value_array_borrow_element_by_index_const(
+                               plugin_paths, i);
                plugin_path = bt_value_string_get(plugin_path_value);
 
                /*
@@ -864,7 +865,7 @@ end:
 }
 
 static
-int load_all_plugins(struct bt_value *plugin_paths)
+int load_all_plugins(const struct bt_value *plugin_paths)
 {
        int ret = 0;
 
@@ -940,7 +941,7 @@ int cmd_query(struct bt_config *cfg)
 {
        int ret = 0;
        struct bt_component_class *comp_cls = NULL;
-       struct bt_value *results = NULL;
+       const struct bt_value *results = NULL;
        const char *fail_reason = NULL;
 
        comp_cls = find_component_class(
@@ -967,8 +968,7 @@ int cmd_query(struct bt_config *cfg)
        }
 
        ret = query(comp_cls, cfg->cmd_data.query.object->str,
-               bt_private_value_as_value(
-                       cfg->cmd_data.query.cfg_component->params),
+               cfg->cmd_data.query.cfg_component->params,
                &results, &fail_reason);
        if (ret) {
                goto failed;
@@ -1161,7 +1161,7 @@ int cmd_list_plugins(struct bt_config *cfg)
        int plugins_count, component_classes_count = 0, i;
 
        printf("From the following plugin paths:\n\n");
-       print_value(stdout, bt_private_value_as_value(cfg->plugin_paths), 2);
+       print_value(stdout, cfg->plugin_paths, 2);
        printf("\n");
        plugins_count = loaded_plugins->len;
        if (plugins_count == 0) {
@@ -1220,10 +1220,10 @@ int cmd_print_lttng_live_sessions(struct bt_config *cfg)
 {
        int ret = 0;
        struct bt_component_class *comp_cls = NULL;
-       struct bt_value *results = NULL;
-       struct bt_private_value *params = NULL;
-       struct bt_value *map = NULL;
-       struct bt_value *v = NULL;
+       const struct bt_value *results = NULL;
+       struct bt_value *params = NULL;
+       const struct bt_value *map = NULL;
+       const struct bt_value *v = NULL;
        static const char * const plugin_name = "ctf";
        static const char * const comp_cls_name = "lttng-live";
        static const enum bt_component_class_type comp_cls_type =
@@ -1250,19 +1250,19 @@ int cmd_print_lttng_live_sessions(struct bt_config *cfg)
                goto error;
        }
 
-       params = bt_private_value_map_create();
+       params = bt_value_map_create();
        if (!params) {
                goto error;
        }
 
-       ret = bt_private_value_map_insert_string_entry(params, "url",
+       ret = bt_value_map_insert_string_entry(params, "url",
                cfg->cmd_data.print_lttng_live_sessions.url->str);
        if (ret) {
                goto error;
        }
 
-       ret = query(comp_cls, "sessions", bt_private_value_as_value(params),
-               &results, &fail_reason);
+       ret = query(comp_cls, "sessions", params,
+                   &results, &fail_reason);
        if (ret) {
                goto failed;
        }
@@ -1296,7 +1296,7 @@ int cmd_print_lttng_live_sessions(struct bt_config *cfg)
                const char *url_text;
                int64_t timer_us, streams, clients;
 
-               map = bt_value_array_borrow_element_by_index(results, i);
+               map = bt_value_array_borrow_element_by_index_const(results, i);
                if (!map) {
                        BT_LOGE_STR("Unexpected empty array entry.");
                        goto error;
@@ -1306,28 +1306,28 @@ int cmd_print_lttng_live_sessions(struct bt_config *cfg)
                        goto error;
                }
 
-               v = bt_value_map_borrow_entry_value(map, "url");
+               v = bt_value_map_borrow_entry_value_const(map, "url");
                if (!v) {
                        BT_LOGE_STR("Unexpected empty array \"url\" entry.");
                        goto error;
                }
                url_text = bt_value_string_get(v);
                fprintf(out_stream, "%s", url_text);
-               v = bt_value_map_borrow_entry_value(map, "timer-us");
+               v = bt_value_map_borrow_entry_value_const(map, "timer-us");
                if (!v) {
                        BT_LOGE_STR("Unexpected empty array \"timer-us\" entry.");
                        goto error;
                }
                timer_us = bt_value_integer_get(v);
                fprintf(out_stream, " (timer = %" PRIu64 ", ", timer_us);
-               v = bt_value_map_borrow_entry_value(map, "stream-count");
+               v = bt_value_map_borrow_entry_value_const(map, "stream-count");
                if (!v) {
                        BT_LOGE_STR("Unexpected empty array \"stream-count\" entry.");
                        goto error;
                }
                streams = bt_value_integer_get(v);
                fprintf(out_stream, "%" PRIu64 " stream(s), ", streams);
-               v = bt_value_map_borrow_entry_value(map, "client-count");
+               v = bt_value_map_borrow_entry_value_const(map, "client-count");
                if (!v) {
                        BT_LOGE_STR("Unexpected empty array \"client-count\" entry.");
                        goto error;
@@ -1372,9 +1372,9 @@ int cmd_print_ctf_metadata(struct bt_config *cfg)
 {
        int ret = 0;
        struct bt_component_class *comp_cls = NULL;
-       struct bt_value *results = NULL;
-       struct bt_private_value *params = NULL;
-       struct bt_value *metadata_text_value = NULL;
+       const struct bt_value *results = NULL;
+       struct bt_value *params = NULL;
+       const struct bt_value *metadata_text_value = NULL;
        const char *metadata_text = NULL;
        static const char * const plugin_name = "ctf";
        static const char * const comp_cls_name = "fs";
@@ -1402,13 +1402,13 @@ int cmd_print_ctf_metadata(struct bt_config *cfg)
                goto end;
        }
 
-       params = bt_private_value_map_create();
+       params = bt_value_map_create();
        if (!params) {
                ret = -1;
                goto end;
        }
 
-       ret = bt_private_value_map_insert_string_entry(params, "path",
+       ret = bt_value_map_insert_string_entry(params, "path",
                cfg->cmd_data.print_ctf_metadata.path->str);
        if (ret) {
                ret = -1;
@@ -1416,12 +1416,13 @@ int cmd_print_ctf_metadata(struct bt_config *cfg)
        }
 
        ret = query(comp_cls, "metadata-info",
-               bt_private_value_as_value(params), &results, &fail_reason);
+               params, &results, &fail_reason);
        if (ret) {
                goto failed;
        }
 
-       metadata_text_value = bt_value_map_borrow_entry_value(results, "text");
+       metadata_text_value = bt_value_map_borrow_entry_value_const(results,
+                                                                   "text");
        if (!metadata_text_value) {
                BT_LOGE_STR("Cannot find `text` string value in the resulting metadata info object.");
                ret = -1;
@@ -1618,7 +1619,7 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component(
        borrow_input_port_by_index_func_t port_by_index_fn;
        enum bt_graph_status status = BT_GRAPH_STATUS_ERROR;
        bool insert_trimmer = false;
-       struct bt_private_value *trimmer_params = NULL;
+       struct bt_value *trimmer_params = NULL;
        char *intersection_begin = NULL;
        char *intersection_end = NULL;
        struct bt_component_filter *trimmer = NULL;
@@ -1654,17 +1655,17 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component(
                        }
 
                        insert_trimmer = true;
-                       trimmer_params = bt_private_value_map_create();
+                       trimmer_params = bt_value_map_create();
                        if (!trimmer_params) {
                                goto error;
                        }
 
-                       status = bt_private_value_map_insert_string_entry(
+                       status = bt_value_map_insert_string_entry(
                                trimmer_params, "begin", intersection_begin);
                        if (status != BT_VALUE_STATUS_OK) {
                                goto error;
                        }
-                       status = bt_private_value_map_insert_string_entry(
+                       status = bt_value_map_insert_string_entry(
                                trimmer_params,
                                "end", intersection_end);
                        if (status != BT_VALUE_STATUS_OK) {
@@ -1775,7 +1776,7 @@ int cmd_run_ctx_connect_upstream_port_to_downstream_component(
                        ctx->connect_ports = false;
                        graph_status = bt_private_graph_add_filter_component(
                                ctx->graph, trimmer_class, trimmer_name,
-                               bt_private_value_as_value(trimmer_params),
+                               trimmer_params,
                                &trimmer);
                        free(trimmer_name);
                        if (graph_status != BT_GRAPH_STATUS_OK) {
@@ -2156,26 +2157,25 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
        int64_t trace_count;
        enum bt_value_status value_status;
        const char *path = NULL;
-       struct bt_value *component_path_value = NULL;
-       struct bt_private_value *query_params = NULL;
-       struct bt_value *query_result = NULL;
-       struct bt_value *trace_info = NULL;
-       struct bt_value *intersection_range = NULL;
-       struct bt_value *intersection_begin = NULL;
-       struct bt_value *intersection_end = NULL;
-       struct bt_value *stream_path_value = NULL;
-       struct bt_value *stream_paths = NULL;
-       struct bt_value *stream_infos = NULL;
-       struct bt_value *stream_info = NULL;
+       const struct bt_value *component_path_value = NULL;
+       struct bt_value *query_params = NULL;
+       const struct bt_value *query_result = NULL;
+       const struct bt_value *trace_info = NULL;
+       const struct bt_value *intersection_range = NULL;
+       const struct bt_value *intersection_begin = NULL;
+       const struct bt_value *intersection_end = NULL;
+       const struct bt_value *stream_path_value = NULL;
+       const struct bt_value *stream_paths = NULL;
+       const struct bt_value *stream_infos = NULL;
+       const struct bt_value *stream_info = NULL;
        struct port_id *port_id = NULL;
        struct trace_range *trace_range = NULL;
        const char *fail_reason = NULL;
        struct bt_component_class *comp_cls =
                bt_component_class_source_as_component_class(src_comp_cls);
 
-       component_path_value = bt_value_map_borrow_entry_value(
-               bt_private_value_as_value(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);
@@ -2184,15 +2184,15 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
        }
 
        path = bt_value_string_get(component_path_value);
-       query_params = bt_private_value_map_create();
+       query_params = bt_value_map_create();
        if (!query_params) {
                BT_LOGE_STR("Cannot create query parameters.");
                ret = -1;
                goto error;
        }
 
-       value_status = bt_private_value_map_insert_entry(query_params, "path",
-               component_path_value);
+       value_status = bt_value_map_insert_string_entry(query_params, "path",
+               path);
        if (value_status != BT_VALUE_STATUS_OK) {
                BT_LOGE_STR("Cannot insert path parameter in query parameter map.");
                ret = -1;
@@ -2200,7 +2200,7 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
        }
 
        ret = query(comp_cls, "trace-info",
-               bt_private_value_as_value(query_params), &query_result,
+               query_params, &query_result,
                &fail_reason);
        if (ret) {
                BT_LOGD("Component class does not support the `trace-info` query: %s: "
@@ -2231,7 +2231,7 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
                uint64_t stream_idx;
                int64_t stream_count;
 
-               trace_info = bt_value_array_borrow_element_by_index(
+               trace_info = bt_value_array_borrow_element_by_index_const(
                        query_result, trace_idx);
                if (!trace_info || !bt_value_is_map(trace_info)) {
                        ret = -1;
@@ -2239,24 +2239,24 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
                        goto error;
                }
 
-               intersection_range = bt_value_map_borrow_entry_value(trace_info,
-                       "intersection-range-ns");
+               intersection_range = bt_value_map_borrow_entry_value_const(
+                       trace_info, "intersection-range-ns");
                if (!intersection_range) {
                        ret = -1;
                        BT_LOGD_STR("Cannot retrieve \'intersetion-range-ns\' field from query result.");
                        goto error;
                }
 
-               intersection_begin = bt_value_map_borrow_entry_value(
-                       intersection_range, "begin");
+               intersection_begin = bt_value_map_borrow_entry_value_const(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_borrow_entry_value(
-                       intersection_range, "end");
+               intersection_end = bt_value_map_borrow_entry_value_const(intersection_range,
+                                                                        "end");
                if (!intersection_end) {
                        ret = -1;
                        BT_LOGD_STR("Cannot retrieve intersection-range-ns \'end\' field from query result.");
@@ -2275,8 +2275,8 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
                        goto error;
                }
 
-               stream_infos = bt_value_map_borrow_entry_value(trace_info,
-                       "streams");
+               stream_infos = bt_value_map_borrow_entry_value_const(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.");
@@ -2326,7 +2326,7 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
                        trace_range->intersection_range_begin_ns = begin;
                        trace_range->intersection_range_end_ns = end;
 
-                       stream_info = bt_value_array_borrow_element_by_index(
+                       stream_info = bt_value_array_borrow_element_by_index_const(
                                stream_infos, stream_idx);
                        if (!stream_info || !bt_value_is_map(stream_info)) {
                                ret = -1;
@@ -2334,8 +2334,8 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
                                goto error;
                        }
 
-                       stream_paths = bt_value_map_borrow_entry_value(
-                               stream_info, "paths");
+                       stream_paths = bt_value_map_borrow_entry_value_const(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.");
@@ -2343,7 +2343,7 @@ int set_stream_intersections(struct cmd_run_ctx *ctx,
                        }
 
                        stream_path_value =
-                               bt_value_array_borrow_element_by_index(
+                               bt_value_array_borrow_element_by_index_const(
                                        stream_paths, 0);
                        if (!stream_path_value ||
                                !bt_value_is_string(stream_path_value)) {
@@ -2441,19 +2441,19 @@ int cmd_run_ctx_create_components_from_config_components(
                case BT_COMPONENT_CLASS_TYPE_SOURCE:
                        ret = bt_private_graph_add_source_component(ctx->graph,
                                comp_cls, cfg_comp->instance_name->str,
-                               bt_private_value_as_value(cfg_comp->params),
+                               cfg_comp->params,
                                (void *) &comp);
                        break;
                case BT_COMPONENT_CLASS_TYPE_FILTER:
                        ret = bt_private_graph_add_filter_component(ctx->graph,
                                comp_cls, cfg_comp->instance_name->str,
-                               bt_private_value_as_value(cfg_comp->params),
+                               cfg_comp->params,
                                (void *) &comp);
                        break;
                case BT_COMPONENT_CLASS_TYPE_SINK:
                        ret = bt_private_graph_add_sink_component(ctx->graph,
                                comp_cls, cfg_comp->instance_name->str,
-                               bt_private_value_as_value(cfg_comp->params),
+                               cfg_comp->params,
                                (void *) &comp);
                        break;
                default:
@@ -2955,8 +2955,7 @@ int main(int argc, const char **argv)
        print_cfg(cfg);
 
        if (cfg->command_needs_plugins) {
-               ret = load_all_plugins(
-                       bt_private_value_as_value(cfg->plugin_paths));
+               ret = load_all_plugins(cfg->plugin_paths);
                if (ret) {
                        BT_LOGE("Failed to load plugins: ret=%d", ret);
                        retcode = 1;
index a84dfbba480dd3357ca114948aa6529da7551f62..0d8802d9d46e6886e54becd197eff050fbd8c370 100644 (file)
@@ -74,9 +74,9 @@ babeltraceinclude_HEADERS = \
        babeltrace/babeltrace.h \
        babeltrace/logging.h \
        babeltrace/object.h \
-       babeltrace/private-values.h \
        babeltrace/property.h \
        babeltrace/types.h \
+       babeltrace/values-const.h \
        babeltrace/values.h \
        babeltrace/version.h
 
index e50ec20318a08c022d1a207e2acc6783d40f8b2d..5ea9f23c891c193d30abec77e06f2a278d114285 100644 (file)
@@ -28,9 +28,9 @@
 /* Core API */
 #include <babeltrace/logging.h>
 #include <babeltrace/object.h>
-#include <babeltrace/private-values.h>
 #include <babeltrace/property.h>
 #include <babeltrace/types.h>
+#include <babeltrace/values-const.h>
 #include <babeltrace/values.h>
 #include <babeltrace/version.h>
 
index 2e09c120fc0d389ab69b74e7544f5831335171d4..01e6cc8fa9c9b24ec195353edb6834ba0b615d4c 100644 (file)
@@ -57,7 +57,7 @@ struct bt_value;
 typedef enum bt_self_component_status
 (*bt_private_component_class_filter_init_method)(
                struct bt_self_component_filter *self_component,
-               struct bt_value *params, void *init_method_data);
+               const struct bt_value *params, void *init_method_data);
 
 typedef void (*bt_private_component_class_filter_finalize_method)(
                struct bt_self_component_filter *self_component);
@@ -82,8 +82,8 @@ typedef enum bt_query_status
 (*bt_private_component_class_filter_query_method)(
                struct bt_self_component_class_filter *comp_class,
                struct bt_query_executor *query_executor,
-               const char *object, struct bt_value *params,
-               struct bt_value **result);
+               const char *object, const struct bt_value *params,
+               const struct bt_value **result);
 
 typedef enum bt_self_component_status
 (*bt_private_component_class_filter_accept_input_port_connection_method)(
index c347ac4757813d6d0c833f533cb2cbde89760100..02bc66c8ef9207d9f26242133c859a77deb52fbb 100644 (file)
@@ -51,7 +51,7 @@ struct bt_value;
 typedef enum bt_self_component_status
 (*bt_private_component_class_sink_init_method)(
                struct bt_self_component_sink *self_component,
-               struct bt_value *params, void *init_method_data);
+               const struct bt_value *params, void *init_method_data);
 
 typedef void (*bt_private_component_class_sink_finalize_method)(
                struct bt_self_component_sink *self_component);
@@ -60,8 +60,8 @@ typedef enum bt_query_status
 (*bt_private_component_class_sink_query_method)(
                struct bt_self_component_class_sink *comp_class,
                struct bt_query_executor *query_executor,
-               const char *object, struct bt_value *params,
-               struct bt_value **result);
+               const char *object, const struct bt_value *params,
+               const struct bt_value **result);
 
 typedef enum bt_self_component_status
 (*bt_private_component_class_sink_accept_input_port_connection_method)(
index c9d495b844504017cb8df3fd1a208614501b7b38..8fdaa3f277fa90898b1b47db09ed65e62994a861 100644 (file)
@@ -54,7 +54,7 @@ struct bt_value;
 typedef enum bt_self_component_status
 (*bt_private_component_class_source_init_method)(
                struct bt_self_component_source *self_component,
-               struct bt_value *params, void *init_method_data);
+               const struct bt_value *params, void *init_method_data);
 
 typedef void (*bt_private_component_class_source_finalize_method)(
                struct bt_self_component_source *self_component);
@@ -79,8 +79,8 @@ typedef enum bt_query_status
 (*bt_private_component_class_source_query_method)(
                struct bt_self_component_class_source *comp_class,
                struct bt_query_executor *query_executor,
-               const char *object, struct bt_value *params,
-               struct bt_value **result);
+               const char *object, const struct bt_value *params,
+               const struct bt_value **result);
 
 typedef enum bt_self_component_status
 (*bt_private_component_class_source_accept_output_port_connection_method)(
index 542304c1871324252219ec14e54443c08ef7613d..8d2866e1f445a7346f99cfa4dfb99e9351c91c30 100644 (file)
@@ -131,40 +131,40 @@ extern struct bt_private_graph *bt_private_graph_create(void);
 extern enum bt_graph_status bt_private_graph_add_source_component(
                struct bt_private_graph *graph,
                struct bt_component_class_source *component_class,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                struct bt_component_source **component);
 
 extern enum bt_graph_status
 bt_private_graph_add_source_component_with_init_method_data(
                struct bt_private_graph *graph,
                struct bt_component_class_source *component_class,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                void *init_method_data, struct bt_component_source **component);
 
 extern enum bt_graph_status bt_private_graph_add_filter_component(
                struct bt_private_graph *graph,
                struct bt_component_class_filter *component_class,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                struct bt_component_filter **component);
 
 extern enum bt_graph_status
 bt_private_graph_add_filter_component_with_init_method_data(
                struct bt_private_graph *graph,
                struct bt_component_class_filter *component_class,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                void *init_method_data, struct bt_component_filter **component);
 
 extern enum bt_graph_status bt_private_graph_add_sink_component(
                struct bt_private_graph *graph,
                struct bt_component_class_sink *component_class,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                struct bt_component_sink **component);
 
 extern enum bt_graph_status
 bt_private_graph_add_sink_component_with_init_method_data(
                struct bt_private_graph *graph,
                struct bt_component_class_sink *component_class,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                void *init_method_data, struct bt_component_sink **component);
 
 extern enum bt_graph_status bt_private_graph_connect_ports(
index 2a2058c28b27d6ae2d3ea9250ca828d6b525988c..a57302008b71ed612eed80d4381cb5b1bbdda3f3 100644 (file)
@@ -49,8 +49,8 @@ extern
 enum bt_query_executor_status bt_private_query_executor_query(
                struct bt_private_query_executor *query_executor,
                struct bt_component_class *component_class,
-               const char *object, struct bt_value *params,
-               struct bt_value **result);
+               const char *object, const struct bt_value *params,
+               const struct bt_value **result);
 
 extern
 enum bt_query_executor_status bt_private_query_executor_cancel(
diff --git a/include/babeltrace/private-values.h b/include/babeltrace/private-values.h
deleted file mode 100644 (file)
index a6ebc68..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-#ifndef BABELTRACE_PRIVATE_VALUES_H
-#define BABELTRACE_PRIVATE_VALUES_H
-
-/*
- * Copyright (c) 2015-2016 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stddef.h>
-
-/* For enum bt_value_status */
-#include <babeltrace/values.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_value;
-struct bt_private_value;
-
-extern struct bt_private_value *bt_private_value_null;
-
-static inline
-struct bt_value *bt_private_value_as_value(
-               struct bt_private_value *priv_value)
-{
-       return (void *) priv_value;
-}
-
-extern struct bt_private_value *bt_private_value_bool_create(void);
-
-extern struct bt_private_value *bt_private_value_bool_create_init(bt_bool val);
-
-extern void bt_private_value_bool_set(struct bt_private_value *bool_obj,
-               bt_bool val);
-
-extern struct bt_private_value *bt_private_value_integer_create(void);
-
-extern struct bt_private_value *bt_private_value_integer_create_init(
-               int64_t val);
-
-extern void bt_private_value_integer_set(
-               struct bt_private_value *integer_obj, int64_t val);
-
-extern struct bt_private_value *bt_private_value_real_create(void);
-
-extern struct bt_private_value *bt_private_value_real_create_init(double val);
-
-extern void bt_private_value_real_set(
-               struct bt_private_value *real_obj, double val);
-
-extern struct bt_private_value *bt_private_value_string_create(void);
-
-extern struct bt_private_value *bt_private_value_string_create_init(
-               const char *val);
-
-extern enum bt_value_status bt_private_value_string_set(
-               struct bt_private_value *string_obj,
-               const char *val);
-
-extern struct bt_private_value *bt_private_value_array_create(void);
-
-extern struct bt_private_value *bt_private_value_array_borrow_element_by_index(
-               const struct bt_private_value *array_obj, uint64_t index);
-
-extern enum bt_value_status bt_private_value_array_append_element(
-               struct bt_private_value *array_obj,
-               struct bt_value *element_obj);
-
-extern enum bt_value_status bt_private_value_array_append_bool_element(
-               struct bt_private_value *array_obj,
-               bt_bool val);
-
-extern enum bt_value_status bt_private_value_array_append_integer_element(
-               struct bt_private_value *array_obj,
-               int64_t val);
-
-extern enum bt_value_status bt_private_value_array_append_real_element(
-               struct bt_private_value *array_obj,
-               double val);
-
-extern enum bt_value_status bt_private_value_array_append_string_element(
-               struct bt_private_value *array_obj, const char *val);
-
-extern enum bt_value_status bt_private_value_array_append_empty_array_element(
-               struct bt_private_value *array_obj);
-
-extern enum bt_value_status bt_private_value_array_append_empty_map_element(
-               struct bt_private_value *array_obj);
-
-extern enum bt_value_status bt_private_value_array_set_element_by_index(
-               struct bt_private_value *array_obj, uint64_t index,
-               struct bt_value *element_obj);
-
-extern struct bt_private_value *bt_private_value_map_create(void);
-
-extern struct bt_private_value *bt_private_value_map_borrow_entry_value(
-               const struct bt_private_value *map_obj, const char *key);
-
-typedef bt_bool (* bt_private_value_map_foreach_entry_cb)(const char *key,
-               struct bt_private_value *object, void *data);
-
-extern enum bt_value_status bt_private_value_map_foreach_entry(
-               const struct bt_private_value *map_obj,
-               bt_private_value_map_foreach_entry_cb cb, void *data);
-
-extern enum bt_value_status bt_private_value_map_insert_entry(
-               struct bt_private_value *map_obj, const char *key,
-               struct bt_value *element_obj);
-
-extern enum bt_value_status bt_private_value_map_insert_bool_entry(
-               struct bt_private_value *map_obj, const char *key, bt_bool val);
-
-extern enum bt_value_status bt_private_value_map_insert_integer_entry(
-               struct bt_private_value *map_obj, const char *key, int64_t val);
-
-extern enum bt_value_status bt_private_value_map_insert_real_entry(
-               struct bt_private_value *map_obj, const char *key, double val);
-
-extern enum bt_value_status bt_private_value_map_insert_string_entry(
-               struct bt_private_value *map_obj, const char *key,
-               const char *val);
-
-extern enum bt_value_status bt_private_value_map_insert_empty_array_entry(
-               struct bt_private_value *map_obj, const char *key);
-
-extern enum bt_value_status bt_private_value_map_insert_empty_map_entry(
-               struct bt_private_value *map_obj, const char *key);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_PRIVATE_VALUES_H */
index 43c07c02f1b62a69dd7ed18026bffa0b88c8b0ab..a0d7d3586044da8d0c27c06a1188bcf855bbc37c 100644 (file)
@@ -2,8 +2,6 @@
 #define BABELTRACE_TRACE_IR_ATTRIBUTES_H
 
 /*
- * Babeltrace - Trace IR: Attributes internal
- *
  * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
  * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
  *
@@ -35,33 +33,33 @@ extern "C" {
 #include <babeltrace/values.h>
 
 BT_HIDDEN
-struct bt_private_value *bt_attributes_create(void);
+struct bt_value *bt_attributes_create(void);
 
 BT_HIDDEN
-void bt_attributes_destroy(struct bt_private_value *attr_obj);
+void bt_attributes_destroy(struct bt_value *attr_obj);
 
 BT_HIDDEN
-int64_t bt_attributes_get_count(struct bt_private_value *attr_obj);
+int64_t bt_attributes_get_count(const struct bt_value *attr_obj);
 
 BT_HIDDEN
-const char *bt_attributes_get_field_name(struct bt_private_value *attr_obj,
+const char *bt_attributes_get_field_name(const struct bt_value *attr_obj,
                uint64_t index);
 
 BT_HIDDEN
-struct bt_private_value *bt_attributes_borrow_field_value(
-               struct bt_private_value *attr_obj,
+struct bt_value *bt_attributes_borrow_field_value(
+               struct bt_value *attr_obj,
                uint64_t index);
 
 BT_HIDDEN
-int bt_attributes_set_field_value(struct bt_private_value *attr_obj,
-               const char *name, struct bt_private_value *value_obj);
+int bt_attributes_set_field_value(struct bt_value *attr_obj,
+               const char *name, struct bt_value *value_obj);
 
 BT_HIDDEN
-struct bt_private_value *bt_attributes_borrow_field_value_by_name(
-               struct bt_private_value *attr_obj, const char *name);
+struct bt_value *bt_attributes_borrow_field_value_by_name(
+               struct bt_value *attr_obj, const char *name);
 
 BT_HIDDEN
-int bt_attributes_freeze(struct bt_private_value *attr_obj);
+int bt_attributes_freeze(const struct bt_value *attr_obj);
 
 #ifdef __cplusplus
 }
index 8dfba8e86145b37711b4eceb6ebfeebdbfa3fe8c..1336082e0294985690cdc5c044a3115a7b2a3739 100644 (file)
@@ -42,7 +42,7 @@ struct bt_private_trace;
 struct bt_private_stream;
 struct bt_private_stream_class;
 struct bt_private_field_class;
-struct bt_private_value;
+struct bt_value;
 struct bt_private_packet_header_field;
 
 typedef void (* bt_private_trace_is_static_listener)(
@@ -71,9 +71,9 @@ extern void bt_private_trace_set_uuid(struct bt_private_trace *trace,
 
 extern void bt_private_trace_borrow_environment_entry_by_index(
                struct bt_private_trace *trace, uint64_t index,
-               const char **name, struct bt_private_value **value);
+               const char **name, const struct bt_value **value);
 
-extern struct bt_private_value *
+extern const struct bt_value *
 bt_private_trace_borrow_environment_entry_value_by_name(
                struct bt_private_trace *trace, const char *name);
 
index 8e8bfa0a7b3dd66ed44e4db3d33d01ff07488dc0..06653092ca95d40259cb877c3ab02bc3fe245e26 100644 (file)
@@ -58,7 +58,7 @@ struct bt_trace {
                bt_uuid value;
        } uuid;
 
-       struct bt_private_value *environment;
+       struct bt_value *environment;
 
        /* Array of `struct bt_stream_class *` */
        GPtrArray *stream_classes;
index a2a05202eaea791e639ee1f024155ba2d5ea3a0f..9a1115cb797fc913a974314f40fc7e16d3dcd177 100644 (file)
@@ -54,9 +54,9 @@ extern uint64_t bt_trace_get_environment_entry_count(struct bt_trace *trace);
 
 extern void bt_trace_borrow_environment_entry_by_index(
                struct bt_trace *trace, uint64_t index,
-               const char **name, struct bt_value **value);
+               const char **name, const struct bt_value **value);
 
-extern struct bt_value *bt_trace_borrow_environment_entry_value_by_name(
+extern const struct bt_value *bt_trace_borrow_environment_entry_value_by_name(
                struct bt_trace *trace, const char *name);
 
 extern struct bt_field_class *bt_trace_borrow_packet_header_field_class(
diff --git a/include/babeltrace/values-const.h b/include/babeltrace/values-const.h
new file mode 100644 (file)
index 0000000..12e8020
--- /dev/null
@@ -0,0 +1,141 @@
+#ifndef BABELTRACE_VALUES_CONST_H
+#define BABELTRACE_VALUES_CONST_H
+
+/*
+ * Copyright (c) 2015-2016 EfficiOS Inc. and Linux Foundation
+ * Copyright (c) 2015-2016 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <stdint.h>
+#include <stddef.h>
+
+/* For bt_bool */
+#include <babeltrace/types.h>
+
+/* For enum bt_value_status, enum bt_value_type */
+#include <babeltrace/values.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_value;
+
+extern enum bt_value_type bt_value_get_type(const struct bt_value *object);
+
+static inline
+bt_bool bt_value_is_null(const struct bt_value *object)
+{
+       return bt_value_get_type(object) == BT_VALUE_TYPE_NULL;
+}
+
+static inline
+bt_bool bt_value_is_bool(const struct bt_value *object)
+{
+       return bt_value_get_type(object) == BT_VALUE_TYPE_BOOL;
+}
+
+static inline
+bt_bool bt_value_is_integer(const struct bt_value *object)
+{
+       return bt_value_get_type(object) == BT_VALUE_TYPE_INTEGER;
+}
+
+static inline
+bt_bool bt_value_is_real(const struct bt_value *object)
+{
+       return bt_value_get_type(object) == BT_VALUE_TYPE_REAL;
+}
+
+static inline
+bt_bool bt_value_is_string(const struct bt_value *object)
+{
+       return bt_value_get_type(object) == BT_VALUE_TYPE_STRING;
+}
+
+static inline
+bt_bool bt_value_is_array(const struct bt_value *object)
+{
+       return bt_value_get_type(object) == BT_VALUE_TYPE_ARRAY;
+}
+
+static inline
+bt_bool bt_value_is_map(const struct bt_value *object)
+{
+       return bt_value_get_type(object) == BT_VALUE_TYPE_MAP;
+}
+
+extern enum bt_value_status bt_value_copy(struct bt_value **copy,
+               const struct bt_value *object);
+
+extern bt_bool bt_value_compare(const struct bt_value *object_a,
+               const struct bt_value *object_b);
+
+extern bt_bool bt_value_bool_get(const struct bt_value *bool_obj);
+
+extern int64_t bt_value_integer_get(const struct bt_value *integer_obj);
+
+extern double bt_value_real_get(const struct bt_value *real_obj);
+
+extern const char *bt_value_string_get(const struct bt_value *string_obj);
+
+extern uint64_t bt_value_array_get_size(const struct bt_value *array_obj);
+
+static inline
+bt_bool bt_value_array_is_empty(const struct bt_value *array_obj)
+{
+       return bt_value_array_get_size(array_obj) == 0;
+}
+
+extern const struct bt_value *bt_value_array_borrow_element_by_index_const(
+               const struct bt_value *array_obj, uint64_t index);
+
+extern uint64_t bt_value_map_get_size(const struct bt_value *map_obj);
+
+static inline
+bt_bool bt_value_map_is_empty(const struct bt_value *map_obj)
+{
+       return bt_value_map_get_size(map_obj) == 0;
+}
+
+extern const struct bt_value *bt_value_map_borrow_entry_value_const(
+               const struct bt_value *map_obj, const char *key);
+
+typedef bt_bool (* bt_value_map_foreach_entry_const_cb)(const char *key,
+               const struct bt_value *object, void *data);
+
+extern enum bt_value_status bt_value_map_foreach_entry_const(
+               const struct bt_value *map_obj,
+               bt_value_map_foreach_entry_const_cb cb, void *data);
+
+extern bt_bool bt_value_map_has_entry(const struct bt_value *map_obj,
+               const char *key);
+
+extern enum bt_value_status bt_value_map_extend(
+               struct bt_value **extended_map_obj,
+               const struct bt_value *base_map_obj,
+               const struct bt_value *extension_map_obj);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_VALUES_CONST_H */
index 4056fe2edb3ad68c6fdf546cf7faef2412fda88a..d505f0e40ed2899fa9b42fad7a1334d90fea58c2 100644 (file)
  */
 
 #include <babeltrace/values.h>
+#include <babeltrace/values-const.h>
 
 BT_HIDDEN
-enum bt_value_status _bt_value_freeze(struct bt_value *object);
+enum bt_value_status _bt_value_freeze(const struct bt_value *object);
 
 #ifdef BT_DEV_MODE
 # define bt_value_freeze       _bt_value_freeze
index 5919b3ddf9f0e3823287ed156ab2a8cc7a2ba5b9..f6a9de549f68ec6a8a8ce6be35196ecf5bff029c 100644 (file)
@@ -3,7 +3,7 @@
 
 /*
  * Copyright (c) 2015-2016 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2015-2016 Philippe Proulx <pproulx@efficios.com>
+ * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -34,9 +34,6 @@
 extern "C" {
 #endif
 
-/**
-@brief Status codes.
-*/
 enum bt_value_status {
        /// Operation canceled.
        BT_VALUE_STATUS_CANCELED        = 125,
@@ -48,11 +45,6 @@ enum bt_value_status {
        BT_VALUE_STATUS_OK              = 0,
 };
 
-struct bt_value;
-struct bt_private_value;
-
-extern struct bt_value *bt_value_null;
-
 enum bt_value_type {
        /// Null value object.
        BT_VALUE_TYPE_NULL =            0,
@@ -76,100 +68,101 @@ enum bt_value_type {
        BT_VALUE_TYPE_MAP =             6,
 };
 
-extern enum bt_value_type bt_value_get_type(const struct bt_value *object);
-
-static inline
-bt_bool bt_value_is_null(const struct bt_value *object)
-{
-       return bt_value_get_type(object) == BT_VALUE_TYPE_NULL;
-}
+struct bt_value;
 
-static inline
-bt_bool bt_value_is_bool(const struct bt_value *object)
-{
-       return bt_value_get_type(object) == BT_VALUE_TYPE_BOOL;
-}
+extern struct bt_value *bt_value_null;
 
-static inline
-bt_bool bt_value_is_integer(const struct bt_value *object)
-{
-       return bt_value_get_type(object) == BT_VALUE_TYPE_INTEGER;
-}
+extern struct bt_value *bt_value_bool_create(void);
 
-static inline
-bt_bool bt_value_is_real(const struct bt_value *object)
-{
-       return bt_value_get_type(object) == BT_VALUE_TYPE_REAL;
-}
+extern struct bt_value *bt_value_bool_create_init(bt_bool val);
 
-static inline
-bt_bool bt_value_is_string(const struct bt_value *object)
-{
-       return bt_value_get_type(object) == BT_VALUE_TYPE_STRING;
-}
+extern void bt_value_bool_set(struct bt_value *bool_obj, bt_bool val);
 
-static inline
-bt_bool bt_value_is_array(const struct bt_value *object)
-{
-       return bt_value_get_type(object) == BT_VALUE_TYPE_ARRAY;
-}
+extern struct bt_value *bt_value_integer_create(void);
 
-static inline
-bt_bool bt_value_is_map(const struct bt_value *object)
-{
-       return bt_value_get_type(object) == BT_VALUE_TYPE_MAP;
-}
+extern struct bt_value *bt_value_integer_create_init(
+               int64_t val);
 
-extern enum bt_value_status bt_value_copy(struct bt_private_value **copy,
-               const struct bt_value *object);
+extern void bt_value_integer_set(struct bt_value *integer_obj, int64_t val);
 
-extern bt_bool bt_value_compare(const struct bt_value *object_a,
-               const struct bt_value *object_b);
+extern struct bt_value *bt_value_real_create(void);
 
-extern bt_bool bt_value_bool_get(const struct bt_value *bool_obj);
+extern struct bt_value *bt_value_real_create_init(double val);
 
-extern int64_t bt_value_integer_get(const struct bt_value *integer_obj);
+extern void bt_value_real_set(struct bt_value *real_obj, double val);
 
-extern double bt_value_real_get(const struct bt_value *real_obj);
+extern struct bt_value *bt_value_string_create(void);
 
-extern const char *bt_value_string_get(const struct bt_value *string_obj);
+extern struct bt_value *bt_value_string_create_init(const char *val);
 
-extern uint64_t bt_value_array_get_size(const struct bt_value *array_obj);
+extern enum bt_value_status bt_value_string_set(struct bt_value *string_obj,
+               const char *val);
 
-static inline
-bt_bool bt_value_array_is_empty(const struct bt_value *array_obj)
-{
-       return bt_value_array_get_size(array_obj) == 0;
-}
+extern struct bt_value *bt_value_array_create(void);
 
 extern struct bt_value *bt_value_array_borrow_element_by_index(
-               const struct bt_value *array_obj, uint64_t index);
+               struct bt_value *array_obj, uint64_t index);
 
-extern uint64_t bt_value_map_get_size(const struct bt_value *map_obj);
+extern enum bt_value_status bt_value_array_append_element(
+               struct bt_value *array_obj,
+               struct bt_value *element_obj);
 
-static inline
-bt_bool bt_value_map_is_empty(const struct bt_value *map_obj)
-{
-       return bt_value_map_get_size(map_obj) == 0;
-}
+extern enum bt_value_status bt_value_array_append_bool_element(
+               struct bt_value *array_obj, bt_bool val);
+
+extern enum bt_value_status bt_value_array_append_integer_element(
+               struct bt_value *array_obj, int64_t val);
+
+extern enum bt_value_status bt_value_array_append_real_element(
+               struct bt_value *array_obj, double val);
+
+extern enum bt_value_status bt_value_array_append_string_element(
+               struct bt_value *array_obj, const char *val);
+
+extern enum bt_value_status bt_value_array_append_empty_array_element(
+               struct bt_value *array_obj);
+
+extern enum bt_value_status bt_value_array_append_empty_map_element(
+               struct bt_value *array_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);
+
+extern struct bt_value *bt_value_map_create(void);
 
 extern struct bt_value *bt_value_map_borrow_entry_value(
-               const struct bt_value *map_obj, const char *key);
+               struct bt_value *map_obj, const char *key);
 
 typedef bt_bool (* bt_value_map_foreach_entry_cb)(const char *key,
-       struct bt_value *object, void *data);
+               struct bt_value *object, void *data);
 
 extern enum bt_value_status bt_value_map_foreach_entry(
-               const struct bt_value *map_obj,
+               struct bt_value *map_obj,
                bt_value_map_foreach_entry_cb cb, void *data);
 
-extern bt_bool bt_value_map_has_entry(const struct bt_value *map_obj,
-               const char *key);
+extern enum bt_value_status bt_value_map_insert_entry(
+               struct bt_value *map_obj, const char *key,
+               struct bt_value *element_obj);
+
+extern enum bt_value_status bt_value_map_insert_bool_entry(
+               struct bt_value *map_obj, const char *key, bt_bool val);
+
+extern enum bt_value_status bt_value_map_insert_integer_entry(
+               struct bt_value *map_obj, const char *key, int64_t val);
+
+extern enum bt_value_status bt_value_map_insert_real_entry(
+               struct bt_value *map_obj, const char *key, double val);
+
+extern enum bt_value_status bt_value_map_insert_string_entry(
+               struct bt_value *map_obj, const char *key,
+               const char *val);
+
+extern enum bt_value_status bt_value_map_insert_empty_array_entry(
+               struct bt_value *map_obj, const char *key);
 
-extern enum bt_value_status bt_value_map_extend(
-               struct bt_private_value **extended_map_obj,
-               const struct bt_value *base_map_obj,
-               const struct bt_value *extension_map_obj);
+extern enum bt_value_status bt_value_map_insert_empty_map_entry(
+               struct bt_value *map_obj, const char *key);
 
 #ifdef __cplusplus
 }
index 724d7de19f2b12bba3a5d0f304904fa17ae8d65e..0c91aeaa5af4232471ffa4df7e917771f9ef7c45 100644 (file)
@@ -46,7 +46,7 @@ struct colander_data {
 static
 enum bt_self_component_status colander_init(
                struct bt_self_component_sink *self_comp,
-               struct bt_value *params, void *init_method_data)
+               const struct bt_value *params, void *init_method_data)
 {
        enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
        struct colander_data *colander_data = NULL;
index cc27a6998e48ef3e911050b4b92e1c6e9068875a..f624e65927d7d319eded63d085264829bf20515b 100644 (file)
@@ -39,7 +39,7 @@
 #include <babeltrace/common-internal.h>
 #include <babeltrace/types.h>
 #include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
+#include <babeltrace/values-const.h>
 #include <babeltrace/values-internal.h>
 #include <babeltrace/object.h>
 #include <babeltrace/assert-internal.h>
@@ -51,7 +51,7 @@ typedef void (*port_added_func_t)(void *, void *, void *);
 typedef void (*port_removed_func_t)(void *, void *, void *);
 typedef void (*ports_connected_func_t)(void *, void *, void *, void *, void *);
 typedef void (*ports_disconnected_func_t)(void *, void *, void *, void *, void *);
-typedef enum bt_self_component_status (*comp_init_method_t)(void *, void *, void *);
+typedef enum bt_self_component_status (*comp_init_method_t)(void *, const void *, void *);
 
 struct bt_graph_listener {
        bt_private_graph_listener_removed removed;
@@ -1678,7 +1678,7 @@ enum bt_graph_status add_component_with_init_method_data(
                struct bt_private_graph *priv_graph,
                struct bt_component_class *comp_cls,
                comp_init_method_t init_method,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                void *init_method_data, struct bt_component **user_component)
 {
        struct bt_graph *graph = (void *) priv_graph;
@@ -1687,6 +1687,7 @@ enum bt_graph_status add_component_with_init_method_data(
        struct bt_component *component = NULL;
        int ret;
        bool init_can_consume;
+       struct bt_value *new_params = NULL;
 
        BT_ASSERT(comp_cls);
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
@@ -1696,7 +1697,6 @@ enum bt_graph_status add_component_with_init_method_data(
                "Duplicate component name: %!+g, name=\"%s\"", graph, name);
        BT_ASSERT_PRE(!params || bt_value_is_map(params),
                "Parameter value is not a map value: %!+v", params);
-       bt_object_get_ref(params);
        init_can_consume = graph->can_consume;
        bt_graph_set_can_consume(graph, false);
        BT_LIB_LOGD("Adding component to graph: "
@@ -1705,13 +1705,14 @@ enum bt_graph_status add_component_with_init_method_data(
                graph, comp_cls, name, params, init_method_data);
 
        if (!params) {
-               params = bt_private_value_as_value(
-                       bt_private_value_map_create());
-               if (!params) {
+               new_params = bt_value_map_create();
+               if (!new_params) {
                        BT_LOGE_STR("Cannot create map value object.");
                        graph_status = BT_GRAPH_STATUS_NOMEM;
                        goto end;
                }
+
+               params = new_params;
        }
 
        ret = bt_component_create(comp_cls, name, &component);
@@ -1778,7 +1779,7 @@ enum bt_graph_status add_component_with_init_method_data(
 
 end:
        bt_object_put_ref(component);
-       bt_object_put_ref(params);
+       bt_object_put_ref(new_params);
        (void) init_can_consume;
        bt_graph_set_can_consume(graph, init_can_consume);
        return graph_status;
@@ -1788,7 +1789,7 @@ enum bt_graph_status
 bt_private_graph_add_source_component_with_init_method_data(
                struct bt_private_graph *graph,
                struct bt_component_class_source *comp_cls,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                void *init_method_data, struct bt_component_source **component)
 {
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
@@ -1800,7 +1801,7 @@ bt_private_graph_add_source_component_with_init_method_data(
 enum bt_graph_status bt_private_graph_add_source_component(
                struct bt_private_graph *graph,
                struct bt_component_class_source *comp_cls,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                struct bt_component_source **component)
 {
        return bt_private_graph_add_source_component_with_init_method_data(
@@ -1811,7 +1812,7 @@ enum bt_graph_status
 bt_private_graph_add_filter_component_with_init_method_data(
                struct bt_private_graph *graph,
                struct bt_component_class_filter *comp_cls,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                void *init_method_data, struct bt_component_filter **component)
 {
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
@@ -1823,7 +1824,7 @@ bt_private_graph_add_filter_component_with_init_method_data(
 enum bt_graph_status bt_private_graph_add_filter_component(
                struct bt_private_graph *graph,
                struct bt_component_class_filter *comp_cls,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                struct bt_component_filter **component)
 {
        return bt_private_graph_add_filter_component_with_init_method_data(
@@ -1834,7 +1835,7 @@ enum bt_graph_status
 bt_private_graph_add_sink_component_with_init_method_data(
                struct bt_private_graph *graph,
                struct bt_component_class_sink *comp_cls,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                void *init_method_data, struct bt_component_sink **component)
 {
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
@@ -1846,7 +1847,7 @@ bt_private_graph_add_sink_component_with_init_method_data(
 enum bt_graph_status bt_private_graph_add_sink_component(
                struct bt_private_graph *graph,
                struct bt_component_class_sink *comp_cls,
-               const char *name, struct bt_value *params,
+               const char *name, const struct bt_value *params,
                struct bt_component_sink **component)
 {
        return bt_private_graph_add_sink_component_with_init_method_data(
index ab2957114098614b3dca466633e9df4558ac54ef..8fd249d868902d769ef21d06fd8d663dc4c3a9cb 100644 (file)
@@ -28,7 +28,7 @@
 #include <babeltrace/graph/query-executor-internal.h>
 #include <babeltrace/graph/component-class.h>
 #include <babeltrace/graph/component-class-internal.h>
-#include <babeltrace/values.h>
+#include <babeltrace/values-const.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/object.h>
 #include <babeltrace/compiler-internal.h>
@@ -67,11 +67,11 @@ end:
 enum bt_query_executor_status bt_private_query_executor_query(
                struct bt_private_query_executor *priv_query_exec,
                struct bt_component_class *comp_cls,
-               const char *object, struct bt_value *params,
-               struct bt_value **user_result)
+               const char *object, const struct bt_value *params,
+               const struct bt_value **user_result)
 {
        typedef enum bt_query_status (*method_t)(void *, void *,
-               const void *, void *, void *);
+               const void *, const void *, void *);
 
        struct bt_query_executor *query_exec = (void *) priv_query_exec;
        enum bt_query_status status;
index 0104a9e009b1c4fe1de86af42c4f2ed58060e9ac..c91198256e77a91dad5861f123c294eb717b265c 100644 (file)
@@ -33,6 +33,7 @@
 #include <babeltrace/common-internal.h>
 #include <babeltrace/lib-logging-internal.h>
 #include <babeltrace/values-internal.h>
+#include <babeltrace/values-internal.h>
 #include <babeltrace/object-pool-internal.h>
 #include <babeltrace/trace-ir/field-classes-internal.h>
 #include <babeltrace/trace-ir/fields-internal.h>
index b38677394f340ec11a1dfbca71b5a6b716860296..c158c7dc42181b9d8de5d1438ee31b5146da7bf7 100644 (file)
@@ -27,8 +27,9 @@
 #include <babeltrace/object.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
+#include <babeltrace/values-const.h>
 #include <babeltrace/values-internal.h>
+#include <babeltrace/trace-ir/attributes-internal.h>
 #include <inttypes.h>
 #include <babeltrace/compat/string-internal.h>
 #include <babeltrace/assert-internal.h>
@@ -37,9 +38,9 @@
 #define BT_ATTR_VALUE_INDEX            1
 
 BT_HIDDEN
-struct bt_private_value *bt_attributes_create(void)
+struct bt_value *bt_attributes_create(void)
 {
-       struct bt_private_value *attr_obj;
+       struct bt_value *attr_obj;
 
        /*
         * Attributes: array value object of array value objects, each one
@@ -56,7 +57,7 @@ struct bt_private_value *bt_attributes_create(void)
         *     ]
         */
        BT_LOGD_STR("Creating attributes object.");
-       attr_obj = bt_private_value_array_create();
+       attr_obj = bt_value_array_create();
        if (!attr_obj) {
                BT_LOGE_STR("Failed to create array value.");
        } else {
@@ -68,41 +69,39 @@ struct bt_private_value *bt_attributes_create(void)
 }
 
 BT_HIDDEN
-void bt_attributes_destroy(struct bt_private_value *attr_obj)
+void bt_attributes_destroy(struct bt_value *attr_obj)
 {
        BT_LOGD("Destroying attributes object: addr=%p", attr_obj);
        BT_OBJECT_PUT_REF_AND_RESET(attr_obj);
 }
 
 BT_HIDDEN
-int64_t bt_attributes_get_count(struct bt_private_value *attr_obj)
+int64_t bt_attributes_get_count(const struct bt_value *attr_obj)
 {
-       return bt_value_array_get_size(bt_private_value_as_value(attr_obj));
+       return bt_value_array_get_size(attr_obj);
 }
 
 BT_HIDDEN
-const char *bt_attributes_get_field_name(struct bt_private_value *attr_obj,
+const char *bt_attributes_get_field_name(const struct bt_value *attr_obj,
                uint64_t index)
 {
        const char *ret = NULL;
-       struct bt_private_value *attr_field_obj = NULL;
-       struct bt_private_value *attr_field_name_obj = NULL;
+       const struct bt_value *attr_field_obj = NULL;
+       const struct bt_value *attr_field_name_obj = NULL;
 
        if (!attr_obj) {
                BT_LOGW_STR("Invalid parameter: attributes object is NULL.");
                goto end;
        }
 
-       if (index >= bt_value_array_get_size(
-                       bt_private_value_as_value(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_get_size(
-                               bt_private_value_as_value(attr_obj)));
+                       index, bt_value_array_get_size(attr_obj));
                goto end;
        }
 
-       attr_field_obj = bt_private_value_array_borrow_element_by_index(
+       attr_field_obj = bt_value_array_borrow_element_by_index_const(
                attr_obj, index);
        if (!attr_field_obj) {
                BT_LOGE("Cannot get attributes object's array value's element by index: "
@@ -111,7 +110,7 @@ const char *bt_attributes_get_field_name(struct bt_private_value *attr_obj,
        }
 
        attr_field_name_obj =
-               bt_private_value_array_borrow_element_by_index(attr_field_obj,
+               bt_value_array_borrow_element_by_index_const(attr_field_obj,
                        BT_ATTR_NAME_INDEX);
        if (!attr_field_name_obj) {
                BT_LOGE("Cannot get attribute array value's element by index: "
@@ -120,42 +119,40 @@ const char *bt_attributes_get_field_name(struct bt_private_value *attr_obj,
                goto end;
        }
 
-       ret = bt_value_string_get(
-               bt_private_value_as_value(attr_field_name_obj));
+       ret = bt_value_string_get(attr_field_name_obj);
 
 end:
        return ret;
 }
 
 BT_HIDDEN
-struct bt_private_value *bt_attributes_borrow_field_value(
-               struct bt_private_value *attr_obj, uint64_t index)
+struct bt_value *bt_attributes_borrow_field_value(
+               struct bt_value *attr_obj, uint64_t index)
 {
-       struct bt_private_value *value_obj = NULL;
-       struct bt_private_value *attr_field_obj = NULL;
+       struct bt_value *value_obj = NULL;
+       struct bt_value *attr_field_obj = NULL;
 
        if (!attr_obj) {
                BT_LOGW_STR("Invalid parameter: attributes object is NULL.");
                goto end;
        }
 
-       if (index >= bt_value_array_get_size(bt_private_value_as_value(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_get_size(
-                               bt_private_value_as_value(attr_obj)));
+                       index, bt_value_array_get_size(attr_obj));
                goto end;
        }
 
        attr_field_obj =
-               bt_private_value_array_borrow_element_by_index(attr_obj, index);
+               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_private_value_array_borrow_element_by_index(
+       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: "
@@ -168,16 +165,15 @@ end:
 }
 
 static
-struct bt_private_value *bt_attributes_borrow_field_by_name(
-               struct bt_private_value *attr_obj, const char *name)
+struct bt_value *bt_attributes_borrow_field_by_name(
+               struct bt_value *attr_obj, const char *name)
 {
        uint64_t i;
        int64_t attr_size;
-       struct bt_private_value *value_obj = NULL;
-       struct bt_private_value *attr_field_name_obj = NULL;
+       struct bt_value *value_obj = NULL;
+       struct bt_value *attr_field_name_obj = NULL;
 
-       attr_size = bt_value_array_get_size(
-               bt_private_value_as_value(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);
@@ -187,7 +183,7 @@ struct bt_private_value *bt_attributes_borrow_field_by_name(
        for (i = 0; i < attr_size; ++i) {
                const char *field_name;
 
-               value_obj = bt_private_value_array_borrow_element_by_index(
+               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: "
@@ -196,7 +192,7 @@ struct bt_private_value *bt_attributes_borrow_field_by_name(
                }
 
                attr_field_name_obj =
-                       bt_private_value_array_borrow_element_by_index(
+                       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: "
@@ -205,8 +201,7 @@ struct bt_private_value *bt_attributes_borrow_field_by_name(
                        goto error;
                }
 
-               field_name = bt_value_string_get(
-                       bt_private_value_as_value(attr_field_name_obj));
+               field_name = bt_value_string_get(attr_field_name_obj);
 
                if (!strcmp(field_name, name)) {
                        break;
@@ -223,11 +218,11 @@ error:
 }
 
 BT_HIDDEN
-int bt_attributes_set_field_value(struct bt_private_value *attr_obj,
-               const char *name, struct bt_private_value *value_obj)
+int bt_attributes_set_field_value(struct bt_value *attr_obj,
+               const char *name, struct bt_value *value_obj)
 {
        int ret = 0;
-       struct bt_private_value *attr_field_obj = NULL;
+       struct bt_value *attr_field_obj = NULL;
 
        if (!attr_obj || !name || !value_obj) {
                BT_LOGW("Invalid parameter: attributes object, name, or value object is NULL: "
@@ -239,32 +234,32 @@ int bt_attributes_set_field_value(struct bt_private_value *attr_obj,
 
        attr_field_obj = bt_attributes_borrow_field_by_name(attr_obj, name);
        if (attr_field_obj) {
-               ret = bt_private_value_array_set_element_by_index(
+               ret = bt_value_array_set_element_by_index(
                        attr_field_obj, BT_ATTR_VALUE_INDEX,
-                       bt_private_value_as_value(value_obj));
+                       value_obj);
                attr_field_obj = NULL;
                goto end;
        }
 
-       attr_field_obj = bt_private_value_array_create();
+       attr_field_obj = bt_value_array_create();
        if (!attr_field_obj) {
                BT_LOGE_STR("Failed to create empty array value.");
                ret = -1;
                goto end;
        }
 
-       ret = bt_private_value_array_append_string_element(attr_field_obj,
+       ret = bt_value_array_append_string_element(attr_field_obj,
                name);
-       ret |= bt_private_value_array_append_element(attr_field_obj,
-               bt_private_value_as_value(value_obj));
+       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_private_value_array_append_element(attr_obj,
-               bt_private_value_as_value(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",
@@ -277,11 +272,11 @@ end:
 }
 
 BT_HIDDEN
-struct bt_private_value *bt_attributes_borrow_field_value_by_name(
-               struct bt_private_value *attr_obj, const char *name)
+struct bt_value *bt_attributes_borrow_field_value_by_name(
+               struct bt_value *attr_obj, const char *name)
 {
-       struct bt_private_value *value_obj = NULL;
-       struct bt_private_value *attr_field_obj = NULL;
+       struct bt_value *value_obj = NULL;
+       struct bt_value *attr_field_obj = NULL;
 
        if (!attr_obj || !name) {
                BT_LOGW("Invalid parameter: attributes object or name is NULL: "
@@ -296,7 +291,7 @@ struct bt_private_value *bt_attributes_borrow_field_value_by_name(
                goto end;
        }
 
-       value_obj = bt_private_value_array_borrow_element_by_index(
+       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: "
@@ -309,7 +304,7 @@ end:
 }
 
 BT_HIDDEN
-int bt_attributes_freeze(struct bt_private_value *attr_obj)
+int bt_attributes_freeze(const struct bt_value *attr_obj)
 {
        uint64_t i;
        int64_t count;
@@ -322,7 +317,7 @@ int bt_attributes_freeze(struct bt_private_value *attr_obj)
        }
 
        BT_LOGD("Freezing attributes object: value-addr=%p", attr_obj);
-       count = bt_value_array_get_size(bt_private_value_as_value(attr_obj));
+       count = bt_value_array_get_size(attr_obj);
        BT_ASSERT(count >= 0);
 
        /*
@@ -331,9 +326,10 @@ int bt_attributes_freeze(struct bt_private_value *attr_obj)
         * attribute is frozen one by one.
         */
        for (i = 0; i < count; ++i) {
-               struct bt_private_value *obj = NULL;
+               struct bt_value *obj = NULL;
 
-               obj = bt_attributes_borrow_field_value(attr_obj, i);
+               obj = bt_attributes_borrow_field_value(
+                       (void *) attr_obj, i);
                if (!obj) {
                        BT_LOGE("Cannot get attributes object's field value by index: "
                                "value-addr=%p, index=%" PRIu64,
@@ -342,7 +338,7 @@ int bt_attributes_freeze(struct bt_private_value *attr_obj)
                        goto end;
                }
 
-               bt_value_freeze(bt_private_value_as_value(obj));
+               bt_value_freeze(obj);
        }
 
 end:
index d33a4dc49710e8bfdafba85df38706e644c60f67..d2b58899a2d74761effad899b5e598307b8ca62e 100644 (file)
@@ -43,7 +43,7 @@
 #include <babeltrace/trace-ir/resolve-field-path-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
+#include <babeltrace/values-const.h>
 #include <babeltrace/values-internal.h>
 #include <babeltrace/object.h>
 #include <babeltrace/types.h>
@@ -261,7 +261,7 @@ bool trace_has_environment_entry(struct bt_trace *trace, const char *name)
 
 static
 int set_environment_entry(struct bt_trace *trace, const char *name,
-               struct bt_private_value *value)
+               struct bt_value *value)
 {
        int ret;
 
@@ -274,7 +274,7 @@ int set_environment_entry(struct bt_trace *trace, const char *name,
                "%![trace-]+t, entry-name=\"%s\"", trace, name);
        ret = bt_attributes_set_field_value(trace->environment, name,
                value);
-       bt_value_freeze(bt_private_value_as_value(value));
+       bt_value_freeze(value);
        if (ret) {
                BT_LIB_LOGE("Cannot set trace's environment entry: "
                        "%![trace-]+t, entry-name=\"%s\"", trace, name);
@@ -291,13 +291,13 @@ int bt_private_trace_set_environment_entry_string(
                const char *name, const char *value)
 {
        int ret;
-       struct bt_private_value *value_obj;
+       struct bt_value *value_obj;
        struct bt_trace *trace = (void *) priv_trace;
 
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_NON_NULL(value, "Value");
-       value_obj = bt_private_value_string_create_init(value);
+       value_obj = bt_value_string_create_init(value);
        if (!value_obj) {
                BT_LOGE_STR("Cannot create a string value object.");
                ret = -1;
@@ -317,12 +317,12 @@ int bt_private_trace_set_environment_entry_integer(
                const char *name, int64_t value)
 {
        int ret;
-       struct bt_private_value *value_obj;
+       struct bt_value *value_obj;
        struct bt_trace *trace = (void *) priv_trace;
 
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
-       value_obj = bt_private_value_integer_create_init(value);
+       value_obj = bt_value_integer_create_init(value);
        if (!value_obj) {
                BT_LOGE_STR("Cannot create an integer value object.");
                ret = -1;
@@ -349,15 +349,14 @@ uint64_t bt_trace_get_environment_entry_count(struct bt_trace *trace)
 
 void bt_trace_borrow_environment_entry_by_index(
                struct bt_trace *trace, uint64_t index,
-               const char **name, struct bt_value **value)
+               const char **name, const struct bt_value **value)
 {
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_NON_NULL(value, "Value");
        BT_ASSERT_PRE_VALID_INDEX(index,
                bt_attributes_get_count(trace->environment));
-       *value = bt_private_value_as_value(
-               bt_attributes_borrow_field_value(trace->environment, index));
+       *value = bt_attributes_borrow_field_value(trace->environment, index);
        BT_ASSERT(*value);
        *name = bt_attributes_get_field_name(trace->environment, index);
        BT_ASSERT(*name);
@@ -365,23 +364,22 @@ void bt_trace_borrow_environment_entry_by_index(
 
 void bt_private_trace_borrow_environment_entry_by_index(
                struct bt_private_trace *trace, uint64_t index,
-               const char **name, struct bt_private_value **value)
+               const char **name, const struct bt_value **value)
 {
        bt_trace_borrow_environment_entry_by_index((void *) trace,
                index, name, (void *) value);
 }
 
-struct bt_value *bt_trace_borrow_environment_entry_value_by_name(
+const struct bt_value *bt_trace_borrow_environment_entry_value_by_name(
                struct bt_trace *trace, const char *name)
 {
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
-       return bt_private_value_as_value(
-               bt_attributes_borrow_field_value_by_name(trace->environment,
-                       name));
+       return bt_attributes_borrow_field_value_by_name(trace->environment,
+               name);
 }
 
-struct bt_private_value *
+const struct bt_value *
 bt_private_trace_borrow_environment_entry_value_by_name(
                struct bt_private_trace *trace, const char *name)
 {
index ffe289c2bdeec5d44e3466619ebfbf0090866e60..70c3676a9a68d751cc9d035bc26ca69539c80d6a 100644 (file)
@@ -31,8 +31,8 @@
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/common-internal.h>
 #include <babeltrace/object.h>
+#include <babeltrace/values-const.h>
 #include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
 #include <babeltrace/compat/glib-internal.h>
 #include <babeltrace/types.h>
 #include <babeltrace/object-internal.h>
@@ -90,8 +90,6 @@ struct bt_value bt_value_null_instance = {
 };
 
 struct bt_value *bt_value_null = &bt_value_null_instance;
-struct bt_private_value *bt_private_value_null =
-       (void *) &bt_value_null_instance;
 
 struct bt_value_bool {
        struct bt_value base;
@@ -168,60 +166,60 @@ void (* const destroy_funcs[])(struct bt_value *) = {
 };
 
 static
-struct bt_private_value *bt_value_null_copy(const struct bt_value *null_obj)
+struct bt_value *bt_value_null_copy(const struct bt_value *null_obj)
 {
        return (void *) bt_value_null;
 }
 
 static
-struct bt_private_value *bt_value_bool_copy(const struct bt_value *bool_obj)
+struct bt_value *bt_value_bool_copy(const struct bt_value *bool_obj)
 {
-       return bt_private_value_bool_create_init(
+       return bt_value_bool_create_init(
                BT_VALUE_TO_BOOL(bool_obj)->value);
 }
 
 static
-struct bt_private_value *bt_value_integer_copy(
+struct bt_value *bt_value_integer_copy(
                const struct bt_value *integer_obj)
 {
-       return bt_private_value_integer_create_init(
+       return bt_value_integer_create_init(
                BT_VALUE_TO_INTEGER(integer_obj)->value);
 }
 
 static
-struct bt_private_value *bt_value_real_copy(const struct bt_value *real_obj)
+struct bt_value *bt_value_real_copy(const struct bt_value *real_obj)
 {
-       return bt_private_value_real_create_init(
+       return bt_value_real_create_init(
                BT_VALUE_TO_REAL(real_obj)->value);
 }
 
 static
-struct bt_private_value *bt_value_string_copy(const struct bt_value *string_obj)
+struct bt_value *bt_value_string_copy(const struct bt_value *string_obj)
 {
-       return bt_private_value_string_create_init(
+       return bt_value_string_create_init(
                BT_VALUE_TO_STRING(string_obj)->gstr->str);
 }
 
 static
-struct bt_private_value *bt_value_array_copy(const struct bt_value *array_obj)
+struct bt_value *bt_value_array_copy(const struct bt_value *array_obj)
 {
        int i;
        int ret;
-       struct bt_private_value *copy_obj;
+       struct bt_value *copy_obj;
        struct bt_value_array *typed_array_obj;
 
        BT_LOGD("Copying array value: addr=%p", array_obj);
        typed_array_obj = BT_VALUE_TO_ARRAY(array_obj);
-       copy_obj = bt_private_value_array_create();
+       copy_obj = bt_value_array_create();
        if (!copy_obj) {
                BT_LOGE_STR("Cannot create empty array value.");
                goto end;
        }
 
        for (i = 0; i < typed_array_obj->garray->len; ++i) {
-               struct bt_private_value *element_obj_copy = NULL;
-               struct bt_value *element_obj =
-                       bt_value_array_borrow_element_by_index(
+               struct bt_value *element_obj_copy = NULL;
+               const struct bt_value *element_obj =
+                       bt_value_array_borrow_element_by_index_const(
                                array_obj, i);
 
                BT_ASSERT(element_obj);
@@ -237,7 +235,7 @@ struct bt_private_value *bt_value_array_copy(const struct bt_value *array_obj)
                }
 
                BT_ASSERT(element_obj_copy);
-               ret = bt_private_value_array_append_element(copy_obj,
+               ret = bt_value_array_append_element(copy_obj,
                        (void *) element_obj_copy);
                BT_OBJECT_PUT_REF_AND_RESET(element_obj_copy);
                if (ret) {
@@ -256,18 +254,18 @@ end:
 }
 
 static
-struct bt_private_value *bt_value_map_copy(const struct bt_value *map_obj)
+struct bt_value *bt_value_map_copy(const struct bt_value *map_obj)
 {
        int ret;
        GHashTableIter iter;
        gpointer key, element_obj;
-       struct bt_private_value *copy_obj;
-       struct bt_private_value *element_obj_copy = NULL;
+       struct bt_value *copy_obj;
+       struct bt_value *element_obj_copy = NULL;
        struct bt_value_map *typed_map_obj;
 
        BT_LOGD("Copying map value: addr=%p", map_obj);
        typed_map_obj = BT_VALUE_TO_MAP(map_obj);
-       copy_obj = bt_private_value_map_create();
+       copy_obj = bt_value_map_create();
        if (!copy_obj) {
                goto end;
        }
@@ -290,7 +288,7 @@ struct bt_private_value *bt_value_map_copy(const struct bt_value *map_obj)
                }
 
                BT_ASSERT(element_obj_copy);
-               ret = bt_private_value_map_insert_entry(copy_obj, key_str,
+               ret = bt_value_map_insert_entry(copy_obj, key_str,
                        (void *) element_obj_copy);
                BT_OBJECT_PUT_REF_AND_RESET(element_obj_copy);
                if (ret) {
@@ -308,7 +306,7 @@ end:
 }
 
 static
-struct bt_private_value *(* const copy_funcs[])(const struct bt_value *) = {
+struct bt_value *(* const copy_funcs[])(const struct bt_value *) = {
        [BT_VALUE_TYPE_NULL] =          bt_value_null_copy,
        [BT_VALUE_TYPE_BOOL] =          bt_value_bool_copy,
        [BT_VALUE_TYPE_INTEGER] =       bt_value_integer_copy,
@@ -416,12 +414,12 @@ bt_bool bt_value_array_compare(const struct bt_value *object_a,
        }
 
        for (i = 0; i < array_obj_a->garray->len; ++i) {
-               struct bt_value *element_obj_a;
-               struct bt_value *element_obj_b;
+               const struct bt_value *element_obj_a;
+               const struct bt_value *element_obj_b;
 
-               element_obj_a = bt_value_array_borrow_element_by_index(
+               element_obj_a = bt_value_array_borrow_element_by_index_const(
                        object_a, i);
-               element_obj_b = bt_value_array_borrow_element_by_index(
+               element_obj_b = bt_value_array_borrow_element_by_index_const(
                        object_b, i);
 
                if (!bt_value_compare(element_obj_a, element_obj_b)) {
@@ -461,10 +459,10 @@ bt_bool bt_value_map_compare(const struct bt_value *object_a,
        g_hash_table_iter_init(&iter, map_obj_a->ght);
 
        while (g_hash_table_iter_next(&iter, &key, &element_obj_a)) {
-               struct bt_value *element_obj_b;
+               const 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_entry_value(object_b,
+               element_obj_b = bt_value_map_borrow_entry_value_const(object_b,
                        key_str);
 
                if (!bt_value_compare(element_obj_a, element_obj_b)) {
@@ -565,8 +563,9 @@ void bt_value_destroy(struct bt_object *obj)
 }
 
 BT_HIDDEN
-enum bt_value_status _bt_value_freeze(struct bt_value *object)
+enum bt_value_status _bt_value_freeze(const struct bt_value *c_object)
 {
+       const struct bt_value *object = (void *) c_object;
        enum bt_value_status ret = BT_VALUE_STATUS_OK;
 
        BT_ASSERT(object);
@@ -576,7 +575,7 @@ enum bt_value_status _bt_value_freeze(struct bt_value *object)
        }
 
        BT_LOGD("Freezing value: addr=%p", object);
-       freeze_funcs[object->type](object);
+       freeze_funcs[object->type]((void *) object);
 
 end:
        return ret;
@@ -599,7 +598,7 @@ struct bt_value bt_value_create_base(enum bt_value_type type)
        return value;
 }
 
-struct bt_private_value *bt_private_value_bool_create_init(bt_bool val)
+struct bt_value *bt_value_bool_create_init(bt_bool val)
 {
        struct bt_value_bool *bool_obj;
 
@@ -618,12 +617,12 @@ end:
        return (void *) BT_VALUE_FROM_CONCRETE(bool_obj);
 }
 
-struct bt_private_value *bt_private_value_bool_create(void)
+struct bt_value *bt_value_bool_create(void)
 {
-       return bt_private_value_bool_create_init(BT_FALSE);
+       return bt_value_bool_create_init(BT_FALSE);
 }
 
-struct bt_private_value *bt_private_value_integer_create_init(int64_t val)
+struct bt_value *bt_value_integer_create_init(int64_t val)
 {
        struct bt_value_integer *integer_obj;
 
@@ -643,12 +642,12 @@ end:
        return (void *) BT_VALUE_FROM_CONCRETE(integer_obj);
 }
 
-struct bt_private_value *bt_private_value_integer_create(void)
+struct bt_value *bt_value_integer_create(void)
 {
-       return bt_private_value_integer_create_init(0);
+       return bt_value_integer_create_init(0);
 }
 
-struct bt_private_value *bt_private_value_real_create_init(double val)
+struct bt_value *bt_value_real_create_init(double val)
 {
        struct bt_value_real *real_obj;
 
@@ -668,12 +667,12 @@ end:
        return (void *) BT_VALUE_FROM_CONCRETE(real_obj);
 }
 
-struct bt_private_value *bt_private_value_real_create(void)
+struct bt_value *bt_value_real_create(void)
 {
-       return bt_private_value_real_create_init(0.);
+       return bt_value_real_create_init(0.);
 }
 
-struct bt_private_value *bt_private_value_string_create_init(const char *val)
+struct bt_value *bt_value_string_create_init(const char *val)
 {
        struct bt_value_string *string_obj = NULL;
 
@@ -705,12 +704,12 @@ end:
        return (void *) BT_VALUE_FROM_CONCRETE(string_obj);
 }
 
-struct bt_private_value *bt_private_value_string_create(void)
+struct bt_value *bt_value_string_create(void)
 {
-       return bt_private_value_string_create_init("");
+       return bt_value_string_create_init("");
 }
 
-struct bt_private_value *bt_private_value_array_create(void)
+struct bt_value *bt_value_array_create(void)
 {
        struct bt_value_array *array_obj;
 
@@ -738,7 +737,7 @@ end:
        return (void *) BT_VALUE_FROM_CONCRETE(array_obj);
 }
 
-struct bt_private_value *bt_private_value_map_create(void)
+struct bt_value *bt_value_map_create(void)
 {
        struct bt_value_map *map_obj;
 
@@ -773,7 +772,7 @@ bt_bool bt_value_bool_get(const struct bt_value *bool_obj)
        return BT_VALUE_TO_BOOL(bool_obj)->value;
 }
 
-void bt_private_value_bool_set(struct bt_private_value *bool_obj, bt_bool val)
+void bt_value_bool_set(struct bt_value *bool_obj, bt_bool val)
 {
        BT_ASSERT_PRE_NON_NULL(bool_obj, "Value object");
        BT_ASSERT_PRE_VALUE_IS_TYPE(bool_obj, BT_VALUE_TYPE_BOOL);
@@ -790,7 +789,7 @@ int64_t bt_value_integer_get(const struct bt_value *integer_obj)
        return BT_VALUE_TO_INTEGER(integer_obj)->value;
 }
 
-void bt_private_value_integer_set(struct bt_private_value *integer_obj,
+void bt_value_integer_set(struct bt_value *integer_obj,
                int64_t val)
 {
        BT_ASSERT_PRE_NON_NULL(integer_obj, "Value object");
@@ -808,7 +807,7 @@ double bt_value_real_get(const struct bt_value *real_obj)
        return BT_VALUE_TO_REAL(real_obj)->value;
 }
 
-void bt_private_value_real_set(struct bt_private_value *real_obj, double val)
+void bt_value_real_set(struct bt_value *real_obj, double val)
 {
        BT_ASSERT_PRE_NON_NULL(real_obj, "Value object");
        BT_ASSERT_PRE_VALUE_IS_TYPE(real_obj, BT_VALUE_TYPE_REAL);
@@ -825,8 +824,8 @@ const char *bt_value_string_get(const struct bt_value *string_obj)
        return BT_VALUE_TO_STRING(string_obj)->gstr->str;
 }
 
-enum bt_value_status bt_private_value_string_set(
-               struct bt_private_value *string_obj, const char *val)
+enum bt_value_status bt_value_string_set(
+               struct bt_value *string_obj, const char *val)
 {
        BT_ASSERT_PRE_NON_NULL(string_obj, "Value object");
        BT_ASSERT_PRE_VALUE_IS_TYPE(string_obj, BT_VALUE_TYPE_STRING);
@@ -845,8 +844,7 @@ uint64_t bt_value_array_get_size(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_obj, uint64_t index)
 {
        struct bt_value_array *typed_array_obj =
                BT_VALUE_TO_ARRAY(array_obj);
@@ -858,16 +856,16 @@ struct bt_value *bt_value_array_borrow_element_by_index(
        return g_ptr_array_index(typed_array_obj->garray, index);
 }
 
-struct bt_private_value *bt_private_value_array_borrow_element_by_index(
-               const struct bt_private_value *array_obj,
+const struct bt_value *bt_value_array_borrow_element_by_index_const(
+               const struct bt_value *array_obj,
                uint64_t index)
 {
-       return (void *) bt_value_array_borrow_element_by_index(
+       return bt_value_array_borrow_element_by_index(
                (void *) array_obj, index);
 }
 
-enum bt_value_status bt_private_value_array_append_element(
-               struct bt_private_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 =
@@ -885,86 +883,86 @@ enum bt_value_status bt_private_value_array_append_element(
        return BT_VALUE_STATUS_OK;
 }
 
-enum bt_value_status bt_private_value_array_append_bool_element(
-               struct bt_private_value *array_obj, bt_bool val)
+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_private_value *bool_obj = NULL;
+       struct bt_value *bool_obj = NULL;
 
-       bool_obj = bt_private_value_bool_create_init(val);
-       ret = bt_private_value_array_append_element(array_obj,
+       bool_obj = bt_value_bool_create_init(val);
+       ret = bt_value_array_append_element(array_obj,
                (void *) bool_obj);
        bt_object_put_ref(bool_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_array_append_integer_element(
-               struct bt_private_value *array_obj, int64_t val)
+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_private_value *integer_obj = NULL;
+       struct bt_value *integer_obj = NULL;
 
-       integer_obj = bt_private_value_integer_create_init(val);
-       ret = bt_private_value_array_append_element(array_obj,
+       integer_obj = bt_value_integer_create_init(val);
+       ret = bt_value_array_append_element(array_obj,
                (void *) integer_obj);
        bt_object_put_ref(integer_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_array_append_real_element(
-               struct bt_private_value *array_obj, double val)
+enum bt_value_status bt_value_array_append_real_element(
+               struct bt_value *array_obj, double val)
 {
        enum bt_value_status ret;
-       struct bt_private_value *real_obj = NULL;
+       struct bt_value *real_obj = NULL;
 
-       real_obj = bt_private_value_real_create_init(val);
-       ret = bt_private_value_array_append_element(array_obj,
+       real_obj = bt_value_real_create_init(val);
+       ret = bt_value_array_append_element(array_obj,
                (void *) real_obj);
        bt_object_put_ref(real_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_array_append_string_element(
-               struct bt_private_value *array_obj, const char *val)
+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_private_value *string_obj = NULL;
+       struct bt_value *string_obj = NULL;
 
-       string_obj = bt_private_value_string_create_init(val);
-       ret = bt_private_value_array_append_element(array_obj,
+       string_obj = bt_value_string_create_init(val);
+       ret = bt_value_array_append_element(array_obj,
                (void *) string_obj);
        bt_object_put_ref(string_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_array_append_empty_array_element(
-               struct bt_private_value *array_obj)
+enum bt_value_status bt_value_array_append_empty_array_element(
+               struct bt_value *array_obj)
 {
        enum bt_value_status ret;
-       struct bt_private_value *empty_array_obj = NULL;
+       struct bt_value *empty_array_obj = NULL;
 
-       empty_array_obj = bt_private_value_array_create();
-       ret = bt_private_value_array_append_element(array_obj,
+       empty_array_obj = bt_value_array_create();
+       ret = bt_value_array_append_element(array_obj,
                (void *) empty_array_obj);
        bt_object_put_ref(empty_array_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_array_append_empty_map_element(
-               struct bt_private_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_private_value *map_obj = NULL;
+       struct bt_value *map_obj = NULL;
 
-       map_obj = bt_private_value_map_create();
-       ret = bt_private_value_array_append_element(array_obj,
+       map_obj = bt_value_map_create();
+       ret = bt_value_array_append_element(array_obj,
                (void *) map_obj);
        bt_object_put_ref(map_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_array_set_element_by_index(
-               struct bt_private_value *array_obj, uint64_t index,
+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 =
@@ -992,7 +990,7 @@ uint64_t bt_value_map_get_size(const struct bt_value *map_obj)
        return (uint64_t) g_hash_table_size(BT_VALUE_TO_MAP(map_obj)->ght);
 }
 
-struct bt_value *bt_value_map_borrow_entry_value(const struct bt_value *map_obj,
+struct bt_value *bt_value_map_borrow_entry_value(struct bt_value *map_obj,
                const char *key)
 {
        BT_ASSERT_PRE_NON_NULL(map_obj, "Value object");
@@ -1002,10 +1000,10 @@ struct bt_value *bt_value_map_borrow_entry_value(const struct bt_value *map_obj,
                GUINT_TO_POINTER(g_quark_from_string(key)));
 }
 
-struct bt_private_value *bt_private_value_map_borrow_entry_value(
-               const struct bt_private_value *map_obj, const char *key)
+const struct bt_value *bt_value_map_borrow_entry_value_const(
+               const struct bt_value *map_obj, const char *key)
 {
-       return (void *) bt_value_map_borrow_entry_value((void *) map_obj, key);
+       return bt_value_map_borrow_entry_value((void *) map_obj, key);
 }
 
 bt_bool bt_value_map_has_entry(const struct bt_value *map_obj, const char *key)
@@ -1017,8 +1015,8 @@ bt_bool bt_value_map_has_entry(const struct bt_value *map_obj, const char *key)
                GUINT_TO_POINTER(g_quark_from_string(key)));
 }
 
-enum bt_value_status bt_private_value_map_insert_entry(
-               struct bt_private_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");
@@ -1035,86 +1033,86 @@ enum bt_value_status bt_private_value_map_insert_entry(
        return BT_VALUE_STATUS_OK;
 }
 
-enum bt_value_status bt_private_value_map_insert_bool_entry(
-               struct bt_private_value *map_obj, const char *key, bt_bool val)
+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_private_value *bool_obj = NULL;
+       struct bt_value *bool_obj = NULL;
 
-       bool_obj = bt_private_value_bool_create_init(val);
-       ret = bt_private_value_map_insert_entry(map_obj, key,
+       bool_obj = bt_value_bool_create_init(val);
+       ret = bt_value_map_insert_entry(map_obj, key,
                (void *) bool_obj);
        bt_object_put_ref(bool_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_map_insert_integer_entry(
-               struct bt_private_value *map_obj, const char *key, int64_t val)
+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_private_value *integer_obj = NULL;
+       struct bt_value *integer_obj = NULL;
 
-       integer_obj = bt_private_value_integer_create_init(val);
-       ret = bt_private_value_map_insert_entry(map_obj, key,
+       integer_obj = bt_value_integer_create_init(val);
+       ret = bt_value_map_insert_entry(map_obj, key,
                (void *) integer_obj);
        bt_object_put_ref(integer_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_map_insert_real_entry(
-               struct bt_private_value *map_obj, const char *key, double val)
+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_private_value *real_obj = NULL;
+       struct bt_value *real_obj = NULL;
 
-       real_obj = bt_private_value_real_create_init(val);
-       ret = bt_private_value_map_insert_entry(map_obj, key,
+       real_obj = bt_value_real_create_init(val);
+       ret = bt_value_map_insert_entry(map_obj, key,
                (void *) real_obj);
        bt_object_put_ref(real_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_map_insert_string_entry(
-               struct bt_private_value *map_obj, const char *key,
+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_private_value *string_obj = NULL;
+       struct bt_value *string_obj = NULL;
 
-       string_obj = bt_private_value_string_create_init(val);
-       ret = bt_private_value_map_insert_entry(map_obj, key,
+       string_obj = bt_value_string_create_init(val);
+       ret = bt_value_map_insert_entry(map_obj, key,
                (void *) string_obj);
        bt_object_put_ref(string_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_map_insert_empty_array_entry(
-               struct bt_private_value *map_obj, const char *key)
+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_private_value *array_obj = NULL;
+       struct bt_value *array_obj = NULL;
 
-       array_obj = bt_private_value_array_create();
-       ret = bt_private_value_map_insert_entry(map_obj, key,
+       array_obj = bt_value_array_create();
+       ret = bt_value_map_insert_entry(map_obj, key,
                (void *) array_obj);
        bt_object_put_ref(array_obj);
        return ret;
 }
 
-enum bt_value_status bt_private_value_map_insert_empty_map_entry(
-               struct bt_private_value *map_obj, const char *key)
+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_private_value *empty_map_obj = NULL;
+       struct bt_value *empty_map_obj = NULL;
 
-       empty_map_obj = bt_private_value_map_create();
-       ret = bt_private_value_map_insert_entry(map_obj, key,
+       empty_map_obj = bt_value_map_create();
+       ret = bt_value_map_insert_entry(map_obj, key,
                (void *) empty_map_obj);
        bt_object_put_ref(empty_map_obj);
        return ret;
 }
 
-enum bt_value_status bt_value_map_foreach_entry(const struct bt_value *map_obj,
+enum bt_value_status bt_value_map_foreach_entry(struct bt_value *map_obj,
                bt_value_map_foreach_entry_cb cb, void *data)
 {
        enum bt_value_status ret = BT_VALUE_STATUS_OK;
@@ -1142,26 +1140,26 @@ enum bt_value_status bt_value_map_foreach_entry(const struct bt_value *map_obj,
        return ret;
 }
 
-enum bt_value_status bt_private_value_map_foreach_entry(
-               const struct bt_private_value *map_obj,
-               bt_private_value_map_foreach_entry_cb cb, void *data)
+enum bt_value_status bt_value_map_foreach_entry_const(
+               const struct bt_value *map_obj,
+               bt_value_map_foreach_entry_const_cb cb, void *data)
 {
        return bt_value_map_foreach_entry((void *) map_obj,
                (bt_value_map_foreach_entry_cb) cb, data);
 }
 
 struct extend_map_element_data {
-       struct bt_private_value *extended_obj;
+       struct bt_value *extended_obj;
        enum bt_value_status status;
 };
 
 static
 bt_bool extend_map_element(const char *key,
-               struct bt_value *extension_obj_elem, void *data)
+               const struct bt_value *extension_obj_elem, void *data)
 {
        bt_bool ret = BT_TRUE;
        struct extend_map_element_data *extend_data = data;
-       struct bt_private_value *extension_obj_elem_copy = NULL;
+       struct bt_value *extension_obj_elem_copy = NULL;
 
        /* Copy object which is to replace the current one */
        extend_data->status = bt_value_copy(&extension_obj_elem_copy,
@@ -1175,7 +1173,7 @@ bt_bool extend_map_element(const char *key,
        BT_ASSERT(extension_obj_elem_copy);
 
        /* Replace in extended object */
-       extend_data->status = bt_private_value_map_insert_entry(
+       extend_data->status = bt_value_map_insert_entry(
                extend_data->extended_obj, key,
                (void *) extension_obj_elem_copy);
        if (extend_data->status) {
@@ -1198,7 +1196,7 @@ end:
 }
 
 enum bt_value_status bt_value_map_extend(
-               struct bt_private_value **extended_map_obj,
+               struct bt_value **extended_map_obj,
                const struct bt_value *base_map_obj,
                const struct bt_value *extension_obj)
 {
@@ -1233,7 +1231,7 @@ enum bt_value_status bt_value_map_extend(
         */
        extend_data.extended_obj = *extended_map_obj;
 
-       if (bt_value_map_foreach_entry(extension_obj, extend_map_element,
+       if (bt_value_map_foreach_entry_const(extension_obj, extend_map_element,
                        &extend_data)) {
                BT_LOGE("Cannot iterate on the extension object's elements: "
                        "extension-value-addr=%p", extension_obj);
@@ -1258,7 +1256,7 @@ end:
        return extend_data.status;
 }
 
-enum bt_value_status bt_value_copy(struct bt_private_value **copy_obj,
+enum bt_value_status bt_value_copy(struct bt_value **copy_obj,
                const struct bt_value *object)
 {
        enum bt_value_status status = BT_VALUE_STATUS_OK;
index 24bfa04a5ebeaa605e8245b770c0b33bf40173c6..2dfaa19f1ee4bd2d3ef288f914aa3161aec23233 100644 (file)
@@ -1246,10 +1246,10 @@ end:
 static
 struct ctf_fs_component *ctf_fs_create(
                struct bt_self_component_source *self_comp,
-               struct bt_value *params)
+               const struct bt_value *params)
 {
        struct ctf_fs_component *ctf_fs;
-       struct bt_value *value = NULL;
+       const struct bt_value *value = NULL;
        const char *path_param;
 
        ctf_fs = g_new0(struct ctf_fs_component, 1);
@@ -1267,13 +1267,14 @@ struct ctf_fs_component *ctf_fs_create(
         * private component should also exist.
         */
        ctf_fs->self_comp = self_comp;
-       value = bt_value_map_borrow_entry_value(params, "path");
+       value = bt_value_map_borrow_entry_value_const(params, "path");
        if (value && !bt_value_is_string(value)) {
                goto error;
        }
 
        path_param = bt_value_string_get(value);
-       value = bt_value_map_borrow_entry_value(params, "clock-class-offset-s");
+       value = bt_value_map_borrow_entry_value_const(params,
+               "clock-class-offset-s");
        if (value) {
                if (!bt_value_is_integer(value)) {
                        BT_LOGE("clock-class-offset-s should be an integer");
@@ -1282,7 +1283,8 @@ struct ctf_fs_component *ctf_fs_create(
                ctf_fs->metadata_config.clock_class_offset_s = bt_value_integer_get(value);
        }
 
-       value = bt_value_map_borrow_entry_value(params, "clock-class-offset-ns");
+       value = bt_value_map_borrow_entry_value_const(params,
+               "clock-class-offset-ns");
        if (value) {
                if (!bt_value_is_integer(value)) {
                        BT_LOGE("clock-class-offset-ns should be an integer");
@@ -1322,7 +1324,7 @@ end:
 BT_HIDDEN
 enum bt_self_component_status ctf_fs_init(
                struct bt_self_component_source *self_comp,
-               struct bt_value *params, UNUSED_VAR void *init_method_data)
+               const struct bt_value *params, UNUSED_VAR void *init_method_data)
 {
        struct ctf_fs_component *ctf_fs;
        enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
@@ -1339,8 +1341,8 @@ BT_HIDDEN
 enum bt_query_status ctf_fs_query(
                struct bt_self_component_class_source *comp_class,
                struct bt_query_executor *query_exec,
-               const char *object, struct bt_value *params,
-               struct bt_value **result)
+               const char *object, const struct bt_value *params,
+               const struct bt_value **result)
 {
        enum bt_query_status status = BT_QUERY_STATUS_OK;
 
index d2c5668614b46dee0f2af9f093e3814a29d2ddbe..c5590d7eb396d481ed16bd5939e1cbee7a8b8106 100644 (file)
@@ -154,7 +154,7 @@ struct ctf_fs_notif_iter_data {
 BT_HIDDEN
 enum bt_self_component_status ctf_fs_init(
                struct bt_self_component_source *source,
-               struct bt_value *params, void *init_method_data);
+               const struct bt_value *params, void *init_method_data);
 
 BT_HIDDEN
 void ctf_fs_finalize(struct bt_self_component_source *component);
@@ -163,8 +163,8 @@ BT_HIDDEN
 enum bt_query_status ctf_fs_query(
                struct bt_self_component_class_source *comp_class,
                struct bt_query_executor *query_exec,
-               const char *object, struct bt_value *params,
-               struct bt_value **result);
+               const char *object, const struct bt_value *params,
+               const struct bt_value **result);
 
 BT_HIDDEN
 struct ctf_fs_trace *ctf_fs_trace_create(const char *path, const char *name,
index 026c95829e4189df04c5ee0f71e1968a69c29ed8..dd14336667784c9a77bd668402be0c7e5b296159 100644 (file)
@@ -48,11 +48,12 @@ struct range {
 BT_HIDDEN
 enum bt_query_status metadata_info_query(
                struct bt_self_component_class_source *comp_class,
-               struct bt_value *params, struct bt_value **user_result)
+               const struct bt_value *params,
+               const struct bt_value **user_result)
 {
        enum bt_query_status status = BT_QUERY_STATUS_OK;
-       struct bt_private_value *result = NULL;
-       struct bt_value *path_value = NULL;
+       struct bt_value *result = NULL;
+       const struct bt_value *path_value = NULL;
        char *metadata_text = NULL;
        FILE *metadata_fp = NULL;
        GString *g_metadata_text = NULL;
@@ -61,7 +62,7 @@ enum bt_query_status metadata_info_query(
        const char *path;
        bool is_packetized;
 
-       result = bt_private_value_map_create();
+       result = bt_value_map_create();
        if (!result) {
                status = BT_QUERY_STATUS_NOMEM;
                goto error;
@@ -75,7 +76,7 @@ enum bt_query_status metadata_info_query(
                goto error;
        }
 
-       path_value = bt_value_map_borrow_entry_value(params, "path");
+       path_value = bt_value_map_borrow_entry_value_const(params, "path");
        path = bt_value_string_get(path_value);
 
        BT_ASSERT(path);
@@ -140,14 +141,14 @@ enum bt_query_status metadata_info_query(
 
        g_string_append(g_metadata_text, metadata_text);
 
-       ret = bt_private_value_map_insert_string_entry(result, "text",
+       ret = bt_value_map_insert_string_entry(result, "text",
                g_metadata_text->str);
        if (ret) {
                BT_LOGE_STR("Cannot insert metadata text into query result.");
                goto error;
        }
 
-       ret = bt_private_value_map_insert_bool_entry(result, "is-packetized",
+       ret = bt_value_map_insert_bool_entry(result, "is-packetized",
                is_packetized);
        if (ret) {
                BT_LOGE_STR("Cannot insert \"is-packetized\" attribute into query result.");
@@ -175,45 +176,45 @@ end:
                fclose(metadata_fp);
        }
 
-       *user_result = bt_private_value_as_value(result);
+       *user_result = result;
        return status;
 }
 
 static
-int add_range(struct bt_private_value *info, struct range *range,
+int add_range(struct bt_value *info, struct range *range,
                const char *range_name)
 {
        int ret = 0;
        enum bt_value_status status;
-       struct bt_private_value *range_map = NULL;
+       struct bt_value *range_map = NULL;
 
        if (!range->set) {
                /* Not an error. */
                goto end;
        }
 
-       range_map = bt_private_value_map_create();
+       range_map = bt_value_map_create();
        if (!range_map) {
                ret = -1;
                goto end;
        }
 
-       status = bt_private_value_map_insert_integer_entry(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_private_value_map_insert_integer_entry(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_private_value_map_insert_entry(info, range_name,
-               bt_private_value_as_value(range_map));
+       status = bt_value_map_insert_entry(info, range_name,
+               range_map);
        if (status != BT_VALUE_STATUS_OK) {
                ret = -1;
                goto end;
@@ -225,8 +226,7 @@ end:
 }
 
 static
-int add_stream_ids(struct bt_private_value *info,
-               struct bt_stream *stream)
+int add_stream_ids(struct bt_value *info, struct bt_stream *stream)
 {
        int ret = 0;
        int64_t stream_class_id, stream_instance_id;
@@ -235,7 +235,7 @@ int add_stream_ids(struct bt_private_value *info,
 
        stream_instance_id = bt_stream_get_id(stream);
        if (stream_instance_id != -1) {
-               status = bt_private_value_map_insert_integer_entry(info, "id",
+               status = bt_value_map_insert_integer_entry(info, "id",
                                stream_instance_id);
                if (status != BT_VALUE_STATUS_OK) {
                        ret = -1;
@@ -255,7 +255,7 @@ int add_stream_ids(struct bt_private_value *info,
                goto end;
        }
 
-       status = bt_private_value_map_insert_integer_entry(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;
@@ -267,18 +267,17 @@ end:
 
 static
 int populate_stream_info(struct ctf_fs_ds_file_group *group,
-               struct bt_private_value *group_info,
-               struct range *stream_range)
+               struct bt_value *group_info, struct range *stream_range)
 {
        int ret = 0;
        size_t file_idx;
        enum bt_value_status status;
-       struct bt_private_value *file_paths;
+       struct bt_value *file_paths;
 
        stream_range->begin_ns = INT64_MAX;
        stream_range->end_ns = 0;
 
-       file_paths = bt_private_value_array_create();
+       file_paths = bt_value_array_create();
        if (!file_paths) {
                ret = -1;
                goto end;
@@ -297,7 +296,7 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group,
                        goto end;
                }
 
-               status = bt_private_value_array_append_string_element(file_paths,
+               status = bt_value_array_append_string_element(file_paths,
                                info->path->str);
                if (status != BT_VALUE_STATUS_OK) {
                        ret = -1;
@@ -325,8 +324,8 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group,
                }
        }
 
-       status = bt_private_value_map_insert_entry(group_info, "paths",
-               bt_private_value_as_value(file_paths));
+       status = bt_value_map_insert_entry(group_info, "paths",
+               file_paths);
        if (status != BT_VALUE_STATUS_OK) {
                ret = -1;
                goto end;
@@ -344,13 +343,13 @@ end:
 
 static
 int populate_trace_info(const char *trace_path, const char *trace_name,
-               struct bt_private_value *trace_info)
+               struct bt_value *trace_info)
 {
        int ret = 0;
        size_t group_idx;
        struct ctf_fs_trace *trace = NULL;
        enum bt_value_status status;
-       struct bt_private_value *file_groups;
+       struct bt_value *file_groups;
        struct range trace_range = {
                .begin_ns = INT64_MAX,
                .end_ns = 0,
@@ -362,18 +361,18 @@ int populate_trace_info(const char *trace_path, const char *trace_name,
                .set = false,
        };
 
-       file_groups = bt_private_value_array_create();
+       file_groups = bt_value_array_create();
        if (!file_groups) {
                goto end;
        }
 
-       status = bt_private_value_map_insert_string_entry(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_private_value_map_insert_string_entry(trace_info, "path",
+       status = bt_value_map_insert_string_entry(trace_info, "path",
                        trace_path);
        if (status != BT_VALUE_STATUS_OK) {
                ret = -1;
@@ -397,12 +396,12 @@ int populate_trace_info(const char *trace_path, const char *trace_name,
        /* Find range of all stream groups, and of the trace. */
        for (group_idx = 0; group_idx < trace->ds_file_groups->len;
                        group_idx++) {
-               struct bt_private_value *group_info;
+               struct bt_value *group_info;
                struct range group_range = { .set = false };
                struct ctf_fs_ds_file_group *group = g_ptr_array_index(
                                trace->ds_file_groups, group_idx);
 
-               group_info = bt_private_value_map_create();
+               group_info = bt_value_map_create();
                if (!group_info) {
                        ret = -1;
                        goto end;
@@ -426,9 +425,9 @@ int populate_trace_info(const char *trace_path, const char *trace_name,
                        trace_intersection.end_ns = min(trace_intersection.end_ns,
                                        group_range.end_ns);
                        trace_intersection.set = true;
-                       status = bt_private_value_array_append_element(
+                       status = bt_value_array_append_element(
                                file_groups,
-                               bt_private_value_as_value(group_info));
+                               group_info);
                        bt_object_put_ref(group_info);
                        if (status != BT_VALUE_STATUS_OK) {
                                goto end;
@@ -449,8 +448,8 @@ int populate_trace_info(const char *trace_path, const char *trace_name,
                }
        }
 
-       status = bt_private_value_map_insert_entry(trace_info, "streams",
-               bt_private_value_as_value(file_groups));
+       status = bt_value_map_insert_entry(trace_info, "streams",
+               file_groups);
        BT_OBJECT_PUT_REF_AND_RESET(file_groups);
        if (status != BT_VALUE_STATUS_OK) {
                ret = -1;
@@ -466,11 +465,12 @@ end:
 BT_HIDDEN
 enum bt_query_status trace_info_query(
                struct bt_self_component_class_source *comp_class,
-               struct bt_value *params, struct bt_value **user_result)
+               const struct bt_value *params,
+               const struct bt_value **user_result)
 {
        enum bt_query_status status = BT_QUERY_STATUS_OK;
-       struct bt_private_value *result = NULL;
-       struct bt_value *path_value = NULL;
+       struct bt_value *result = NULL;
+       const struct bt_value *path_value = NULL;
        int ret = 0;
        const char *path = NULL;
        GList *trace_paths = NULL;
@@ -487,7 +487,7 @@ enum bt_query_status trace_info_query(
                goto error;
        }
 
-       path_value = bt_value_map_borrow_entry_value(params, "path");
+       path_value = bt_value_map_borrow_entry_value_const(params, "path");
        path = bt_value_string_get(path_value);
 
        normalized_path = bt_common_normalize_path(path, NULL);
@@ -509,7 +509,7 @@ enum bt_query_status trace_info_query(
                goto error;
        }
 
-       result = bt_private_value_array_create();
+       result = bt_value_array_create();
        if (!result) {
                status = BT_QUERY_STATUS_NOMEM;
                goto error;
@@ -522,9 +522,9 @@ enum bt_query_status trace_info_query(
                GString *trace_path = tp_node->data;
                GString *trace_name = tn_node->data;
                enum bt_value_status status;
-               struct bt_private_value *trace_info;
+               struct bt_value *trace_info;
 
-               trace_info = bt_private_value_map_create();
+               trace_info = bt_value_map_create();
                if (!trace_info) {
                        BT_LOGE("Failed to create trace info map.");
                        goto error;
@@ -537,8 +537,7 @@ enum bt_query_status trace_info_query(
                        goto error;
                }
 
-               status = bt_private_value_array_append_element(result,
-                       bt_private_value_as_value(trace_info));
+               status = bt_value_array_append_element(result, trace_info);
                bt_object_put_ref(trace_info);
                if (status != BT_VALUE_STATUS_OK) {
                        goto error;
@@ -576,6 +575,6 @@ end:
                g_list_free(trace_names);
        }
 
-       *user_result = bt_private_value_as_value(result);
+       *user_result = result;
        return status;
 }
index baf8a3389b62aeb82cd33d4fece869c4a6764881..86ecb558a055b8d4f4602e86d0ac46b3f1bec82b 100644 (file)
 BT_HIDDEN
 enum bt_query_status metadata_info_query(
                struct bt_self_component_class_source *comp_class,
-               struct bt_value *params, struct bt_value **result);
+               const struct bt_value *params, const struct bt_value **result);
 
 BT_HIDDEN
 enum bt_query_status trace_info_query(
                struct bt_self_component_class_source *comp_class,
-               struct bt_value *params, struct bt_value **result);
+               const struct bt_value *params, const struct bt_value **result);
 
 #endif /* BABELTRACE_PLUGIN_CTF_FS_QUERY_H */
index ef3d723ee9dda364e0ee551dea7e65fd0dcaaf68..8a9d4fffd6535179060300967ced056e42a76877 100644 (file)
@@ -212,14 +212,15 @@ end:
 }
 
 static
-int handle_params(struct dmesg_component *dmesg_comp, struct bt_value *params)
+int handle_params(struct dmesg_component *dmesg_comp,
+               const struct bt_value *params)
 {
-       struct bt_value *no_timestamp = NULL;
-       struct bt_value *path = NULL;
+       const struct bt_value *no_timestamp = NULL;
+       const struct bt_value *path = NULL;
        const char *path_str;
        int ret = 0;
 
-       no_timestamp = bt_value_map_borrow_entry_value(params,
+       no_timestamp = bt_value_map_borrow_entry_value_const(params,
                "no-extract-timestamp");
        if (no_timestamp) {
                if (!bt_value_is_bool(no_timestamp)) {
@@ -234,7 +235,7 @@ int handle_params(struct dmesg_component *dmesg_comp, struct bt_value *params)
                        bt_value_bool_get(no_timestamp);
        }
 
-       path = bt_value_map_borrow_entry_value(params, "path");
+       path = bt_value_map_borrow_entry_value_const(params, "path");
        if (path) {
                if (dmesg_comp->params.read_from_stdin) {
                        BT_LOGE_STR("Cannot specify both `read-from-stdin` and `path` parameters.");
index 870e87bb93d7e0c99e2f18bb5a56a347c79c454e..f9fab1bc24a9156e63d3af77a2e6671ef6a63f0d 100644 (file)
@@ -30,7 +30,7 @@
 BT_HIDDEN
 enum bt_self_component_status dmesg_init(
                struct bt_self_component_source *self_comp,
-               struct bt_value *params, void *init_method_data);
+               const struct bt_value *params, void *init_method_data);
 
 BT_HIDDEN
 void dmesg_finalize(struct bt_self_component_source *self_comp);
index 2b83b1def33d8b890249014805902385e6531e06..2d09aa5ee9aeba827c3d5735c57698799a9ed2b1 100644 (file)
@@ -24,7 +24,6 @@
  */
 
 #include <babeltrace/babeltrace.h>
-#include <babeltrace/values.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/common-internal.h>
 #include <plugins-common.h>
@@ -228,7 +227,7 @@ end:
 }
 
 static
-int add_params_to_map(struct bt_private_value *plugin_opt_map)
+int add_params_to_map(struct bt_value *plugin_opt_map)
 {
        int ret = 0;
        unsigned int i;
@@ -237,7 +236,7 @@ int add_params_to_map(struct bt_private_value *plugin_opt_map)
                const char *key = plugin_options[i];
                enum bt_value_status status;
 
-               status = bt_private_value_map_insert_entry(plugin_opt_map, key,
+               status = bt_value_map_insert_entry(plugin_opt_map, key,
                        bt_value_null);
                switch (status) {
                case BT_VALUE_STATUS_OK:
@@ -252,13 +251,13 @@ end:
 }
 
 static
-bt_bool check_param_exists(const char *key, struct bt_value *object, void *data)
+bt_bool check_param_exists(const char *key, const struct bt_value *object,
+               void *data)
 {
        struct pretty_component *pretty = data;
 
-       if (!bt_value_map_has_entry(
-                       bt_private_value_as_value(pretty->plugin_opt_map),
-                       key)) {
+       if (!bt_value_map_has_entry(pretty->plugin_opt_map,
+                                   key)) {
                fprintf(pretty->err,
                        "[warning] Parameter \"%s\" unknown to \"text.pretty\" sink component\n", key);
        }
@@ -266,12 +265,12 @@ bt_bool check_param_exists(const char *key, struct bt_value *object, void *data)
 }
 
 static
-void apply_one_string(const char *key, struct bt_value *params, char **option)
+void apply_one_string(const char *key, const struct bt_value *params, char **option)
 {
-       struct bt_value *value = NULL;
+       const struct bt_value *value = NULL;
        const char *str;
 
-       value = bt_value_map_borrow_entry_value(params, key);
+       value = bt_value_map_borrow_entry_value_const(params, key);
        if (!value) {
                goto end;
        }
@@ -286,13 +285,13 @@ end:
 }
 
 static
-void apply_one_bool(const char *key, struct bt_value *params, bool *option,
+void apply_one_bool(const char *key, const struct bt_value *params, bool *option,
                bool *found)
 {
-       struct bt_value *value = NULL;
+       const struct bt_value *value = NULL;
        bt_bool bool_val;
 
-       value = bt_value_map_borrow_entry_value(params, key);
+       value = bt_value_map_borrow_entry_value_const(params, key);
        if (!value) {
                goto end;
        }
@@ -337,14 +336,14 @@ end:
 }
 
 static
-int apply_params(struct pretty_component *pretty, struct bt_value *params)
+int apply_params(struct pretty_component *pretty, const struct bt_value *params)
 {
        int ret = 0;
        enum bt_value_status status;
        bool value, found;
        char *str = NULL;
 
-       pretty->plugin_opt_map = bt_private_value_map_create();
+       pretty->plugin_opt_map = bt_value_map_create();
        if (!pretty->plugin_opt_map) {
                ret = -1;
                goto end;
@@ -354,7 +353,8 @@ int apply_params(struct pretty_component *pretty, struct bt_value *params)
                goto end;
        }
        /* Report unknown parameters. */
-       status = bt_value_map_foreach_entry(params, check_param_exists, pretty);
+       status = bt_value_map_foreach_entry_const(params,
+               check_param_exists, pretty);
        switch (status) {
        case BT_VALUE_STATUS_OK:
                break;
@@ -365,10 +365,11 @@ int apply_params(struct pretty_component *pretty, struct bt_value *params)
        /* Known parameters. */
        pretty->options.color = PRETTY_COLOR_OPT_AUTO;
        if (bt_value_map_has_entry(params, "color")) {
-               struct bt_value *color_value;
+               const struct bt_value *color_value;
                const char *color;
 
-               color_value = bt_value_map_borrow_entry_value(params, "color");
+               color_value = bt_value_map_borrow_entry_value_const(params,
+                       "color");
                if (!color_value) {
                        goto end;
                }
@@ -636,7 +637,7 @@ void init_stream_packet_context_quarks(void)
 BT_HIDDEN
 enum bt_self_component_status pretty_init(
                struct bt_self_component_sink *comp,
-               struct bt_value *params,
+               const struct bt_value *params,
                UNUSED_VAR void *init_method_data)
 {
        enum bt_self_component_status ret;
index 6be4ba3f1f856fef8234825378d6c1da880cb644..7d53088aa6a51867b1b280a3937016a0e16e20a3 100644 (file)
@@ -78,7 +78,7 @@ struct pretty_component {
        bool start_line;
        GString *string;
        GString *tmp_string;
-       struct bt_private_value *plugin_opt_map; /* Temporary parameter map. */
+       struct bt_value *plugin_opt_map; /* Temporary parameter map. */
        bool use_colors;
 
        uint64_t last_cycles_timestamp;
@@ -106,7 +106,7 @@ GQuark stream_packet_context_quarks[STREAM_PACKET_CONTEXT_QUARKS_LEN];
 BT_HIDDEN
 enum bt_self_component_status pretty_init(
                struct bt_self_component_sink *component,
-               struct bt_value *params,
+               const struct bt_value *params,
                void *init_method_data);
 
 BT_HIDDEN
index 49bb3ff26f3036975670fb7023025d61d8a9a373..83579b88b05fe20d5571b2d79e13e575170ac74f 100644 (file)
@@ -362,7 +362,7 @@ int print_event_header(struct pretty_component *pretty,
                }
        }
        if (pretty->options.print_trace_hostname_field) {
-               struct bt_value *hostname_str;
+               const struct bt_value *hostname_str;
 
                hostname_str = bt_trace_borrow_environment_entry_value_by_name(
                        trace_class, "hostname");
@@ -381,7 +381,7 @@ int print_event_header(struct pretty_component *pretty,
                }
        }
        if (pretty->options.print_trace_domain_field) {
-               struct bt_value *domain_str;
+               const struct bt_value *domain_str;
 
                domain_str = bt_trace_borrow_environment_entry_value_by_name(
                        trace_class, "domain");
@@ -402,7 +402,7 @@ int print_event_header(struct pretty_component *pretty,
                }
        }
        if (pretty->options.print_trace_procname_field) {
-               struct bt_value *procname_str;
+               const struct bt_value *procname_str;
 
                procname_str = bt_trace_borrow_environment_entry_value_by_name(
                        trace_class, "procname");
@@ -423,7 +423,7 @@ int print_event_header(struct pretty_component *pretty,
                }
        }
        if (pretty->options.print_trace_vpid_field) {
-               struct bt_value *vpid_value;
+               const struct bt_value *vpid_value;
 
                vpid_value = bt_trace_borrow_environment_entry_value_by_name(
                        trace_class, "vpid");
index 7bf9b799dd27f9a646fa9734fefa1be1b4e54db7..7b82ae4a84e084229e9bd2eb081d6fdc37f0793b 100644 (file)
@@ -124,12 +124,13 @@ void counter_finalize(struct bt_self_component_sink *comp)
 BT_HIDDEN
 enum bt_self_component_status counter_init(
                struct bt_self_component_sink *component,
-               struct bt_value *params, UNUSED_VAR void *init_method_data)
+               const struct bt_value *params,
+               UNUSED_VAR void *init_method_data)
 {
        enum bt_self_component_status ret;
        struct counter *counter = g_new0(struct counter, 1);
-       struct bt_value *step = NULL;
-       struct bt_value *hide_zero = NULL;
+       const struct bt_value *step = NULL;
+       const struct bt_value *hide_zero = NULL;
 
        if (!counter) {
                ret = BT_SELF_COMPONENT_STATUS_NOMEM;
@@ -144,7 +145,7 @@ enum bt_self_component_status counter_init(
 
        counter->last_printed_total = -1ULL;
        counter->step = 1000;
-       step = bt_value_map_borrow_entry_value(params, "step");
+       step = bt_value_map_borrow_entry_value_const(params, "step");
        if (step && bt_value_is_integer(step)) {
                int64_t val;
 
@@ -154,7 +155,7 @@ enum bt_self_component_status counter_init(
                }
        }
 
-       hide_zero = bt_value_map_borrow_entry_value(params, "hide-zero");
+       hide_zero = bt_value_map_borrow_entry_value_const(params, "hide-zero");
        if (hide_zero && bt_value_is_bool(hide_zero)) {
                bt_bool val;
 
index 2c11fa335dbd0ff84e259f4b07f599d4bdc445ea..2feeaa50ba4d6c93a865e58c448e61f96eae185c 100644 (file)
@@ -48,7 +48,7 @@ struct counter {
 BT_HIDDEN
 enum bt_self_component_status counter_init(
                struct bt_self_component_sink *component,
-               struct bt_value *params, void *init_method_data);
+               const struct bt_value *params, void *init_method_data);
 
 BT_HIDDEN
 void counter_finalize(struct bt_self_component_sink *component);
index ecb58f570d0024ce15a236856668e65cb3559982..2c259156cee3ba736be8c185ecd30823594c178f 100644 (file)
@@ -48,7 +48,8 @@ void dummy_finalize(struct bt_self_component_sink *comp)
 BT_HIDDEN
 enum bt_self_component_status dummy_init(
                struct bt_self_component_sink *component,
-               struct bt_value *params, UNUSED_VAR void *init_method_data)
+               const struct bt_value *params,
+               UNUSED_VAR void *init_method_data)
 {
        enum bt_self_component_status ret;
        struct dummy *dummy = g_new0(struct dummy, 1);
index ffbeb5b746c56c0ffd132499753d1c135ca8eecd..06fcc0e82cd1928ea350f289aa61b694fcba272a 100644 (file)
@@ -35,7 +35,7 @@ struct dummy {
 BT_HIDDEN
 enum bt_self_component_status dummy_init(
                struct bt_self_component_sink *component,
-               struct bt_value *params, void *init_method_data);
+               const struct bt_value *params, void *init_method_data);
 
 BT_HIDDEN
 void dummy_finalize(struct bt_self_component_sink *component);
index 275f8e7eae698ae9e2a8f30bfba8e86e629d3254..229bb1be8b77389af0ee60831bb9e27f5beb354c 100644 (file)
@@ -244,18 +244,18 @@ void destroy_muxer_comp(struct muxer_comp *muxer_comp)
 }
 
 static
-struct bt_private_value *get_default_params(void)
+struct bt_value *get_default_params(void)
 {
-       struct bt_private_value *params;
+       struct bt_value *params;
        int ret;
 
-       params = bt_private_value_map_create();
+       params = bt_value_map_create();
        if (!params) {
                BT_LOGE_STR("Cannot create a map value object.");
                goto error;
        }
 
-       ret = bt_private_value_map_insert_bool_entry(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.");
@@ -272,11 +272,12 @@ end:
 }
 
 static
-int configure_muxer_comp(struct muxer_comp *muxer_comp, struct bt_value *params)
+int configure_muxer_comp(struct muxer_comp *muxer_comp,
+               const struct bt_value *params)
 {
-       struct bt_private_value *default_params = NULL;
-       struct bt_private_value *real_params = NULL;
-       struct bt_value *assume_absolute_clock_classes = NULL;
+       struct bt_value *default_params = NULL;
+       struct bt_value *real_params = NULL;
+       const struct bt_value *assume_absolute_clock_classes = NULL;
        int ret = 0;
        bt_bool bool_val;
 
@@ -288,7 +289,7 @@ int configure_muxer_comp(struct muxer_comp *muxer_comp, struct bt_value *params)
        }
 
        ret = bt_value_map_extend(&real_params,
-               bt_private_value_as_value(default_params), params);
+               default_params, params);
        if (ret) {
                BT_LOGE("Cannot extend default parameters map value: "
                        "muxer-comp-addr=%p, def-params-addr=%p, "
@@ -297,9 +298,8 @@ int configure_muxer_comp(struct muxer_comp *muxer_comp, struct bt_value *params)
                goto error;
        }
 
-       assume_absolute_clock_classes = bt_value_map_borrow_entry_value(
-               bt_private_value_as_value(real_params),
-               ASSUME_ABSOLUTE_CLOCK_CLASSES_PARAM_NAME);
+       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)) {
                BT_LOGE("Expecting a boolean value for the `%s` parameter: "
index 9949cbcbd31814b8b96ee63c224fd5cf9a334a87..27bffa9e140aeb80cf8a69489edb12c046d89edc 100644 (file)
@@ -31,7 +31,7 @@
 BT_HIDDEN
 enum bt_self_component_status muxer_init(
                struct bt_self_component_filter *self_comp,
-               struct bt_value *params, void *init_data);
+               const struct bt_value *params, void *init_data);
 
 BT_HIDDEN
 void muxer_finalize(struct bt_self_component_filter *self_comp);
index c69c24a1e035dac455637a0315792abd527dd318..5cdb4e27a8e8f0171c7f2f040982ea961137387f 100644 (file)
@@ -15,7 +15,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <babeltrace/plugin/plugin-dev.h>
+#include <babeltrace/babeltrace.h>
 #include <stdlib.h>
 #include <glib.h>
 
index 567a85f4d396398f2a3e0e6f92b9063b48ec3fef..2234c04c71f7a14df12cfdd8608220fbb0ae9fc4 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <babeltrace/plugin/plugin-dev.h>
-#include <babeltrace/graph/component-class.h>
-#include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
-#include <babeltrace/object.h>
-#include <babeltrace/assert-internal.h>
+#include <babeltrace/babeltrace.h>
 #include <babeltrace/assert-internal.h>
 
 static enum bt_self_component_status sink_consume(
@@ -61,18 +56,22 @@ static enum bt_self_notification_iterator_status dummy_iterator_next_method(
 static enum bt_query_status flt_query_method(
                struct bt_self_component_class_filter *component_class,
                struct bt_query_executor *query_exec,
-               const char *object, struct bt_value *params,
-               struct bt_value **result)
+               const char *object, const struct bt_value *params,
+               const struct bt_value **result)
 {
-       struct bt_private_value *res = bt_private_value_array_create();
-       *result = bt_private_value_as_value(res);
+       struct bt_value *res = bt_value_array_create();
+       struct bt_value *val;
+       *result = res;
        int iret;
 
        BT_ASSERT(*result);
-       iret = bt_private_value_array_append_string_element(res, object);
+       iret = bt_value_array_append_string_element(res, object);
+       BT_ASSERT(iret == 0);
+       iret = bt_value_copy(&val, params);
        BT_ASSERT(iret == 0);
-       iret = bt_private_value_array_append_element(res, params);
+       iret = bt_value_array_append_element(res, val);
        BT_ASSERT(iret == 0);
+       bt_object_put_ref(val);
        return BT_QUERY_STATUS_OK;
 }
 
index 97cf0506e9c981efd33c74db26c6966cdf73a86a..02724cf4b9d1b771c6515538f79c69d09b540584 100644 (file)
@@ -489,7 +489,7 @@ enum bt_self_notification_iterator_status src_iter_next(
 static
 enum bt_self_component_status src_init(
                struct bt_self_component_source *self_comp,
-               struct bt_value *params, void *init_method_data)
+               const struct bt_value *params, void *init_method_data)
 {
        int ret;
 
@@ -660,7 +660,7 @@ enum bt_self_component_status sink_port_connected(
 static
 enum bt_self_component_status sink_init(
                struct bt_self_component_sink *self_comp,
-               struct bt_value *params, void *init_method_data)
+               const struct bt_value *params, void *init_method_data)
 {
        struct sink_user_data *user_data = g_new0(struct sink_user_data, 1);
        int ret;
index 52a2f559a3a8d8437c92d883b0b5a5a3fa2f35e6..6a6ca7c3560a433a48ee4c7882cade7722195deb 100644 (file)
@@ -20,9 +20,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include <babeltrace/object.h>
-#include <babeltrace/values.h>
-#include <babeltrace/private-values.h>
+#include <babeltrace/babeltrace.h>
 #include <babeltrace/assert-internal.h>
 #include <string.h>
 #include "tap/tap.h"
@@ -45,140 +43,128 @@ static
 void test_bool(void)
 {
        bt_bool value;
-       struct bt_private_value *priv_obj;
        struct bt_value *obj;
 
-       priv_obj = bt_private_value_bool_create();
-       obj = bt_private_value_as_value(priv_obj);
+       obj = bt_value_bool_create();
        ok(obj && bt_value_is_bool(obj),
-               "bt_private_value_bool_create() returns a boolean value object");
+               "bt_value_bool_create() returns a boolean value object");
 
        value = BT_TRUE;
        value = bt_value_bool_get(obj);
        ok(!value, "default boolean value object value is BT_FALSE");
 
-       bt_private_value_bool_set(priv_obj, BT_FALSE);
-       bt_private_value_bool_set(priv_obj, BT_TRUE);
+       bt_value_bool_set(obj, BT_FALSE);
+       bt_value_bool_set(obj, BT_TRUE);
        value = bt_value_bool_get(obj);
-       ok(value, "bt_private_value_bool_set() works");
+       ok(value, "bt_value_bool_set() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
        pass("putting an existing boolean value object does not cause a crash")
 
        value = BT_FALSE;
-       priv_obj = bt_private_value_bool_create_init(BT_TRUE);
-       obj = bt_private_value_as_value(priv_obj);
+       obj = bt_value_bool_create_init(BT_TRUE);
        ok(obj && bt_value_is_bool(obj),
-               "bt_private_value_bool_create_init() returns a boolean value object");
+               "bt_value_bool_create_init() returns a boolean value object");
        value = bt_value_bool_get(obj);
        ok(value,
-               "bt_private_value_bool_create_init() sets the appropriate initial value");
+               "bt_value_bool_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
 }
 
 static
 void test_integer(void)
 {
        int64_t value;
-       struct bt_private_value *priv_obj;
        struct bt_value *obj;
 
-       priv_obj = bt_private_value_integer_create();
-       obj = bt_private_value_as_value(priv_obj);
+       obj = bt_value_integer_create();
        ok(obj && bt_value_is_integer(obj),
-               "bt_private_value_integer_create() returns an integer value object");
+               "bt_value_integer_create() returns an integer value object");
 
        value = 1961;
        value = bt_value_integer_get(obj);
        ok(value == 0, "default integer value object value is 0");
 
-       bt_private_value_integer_set(priv_obj, -98765);
+       bt_value_integer_set(obj, -98765);
        value = bt_value_integer_get(obj);
        ok(value == -98765, "bt_private_integer_bool_set() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
        pass("putting an existing integer value object does not cause a crash")
 
-       priv_obj = bt_private_value_integer_create_init(321456987);
-       obj = bt_private_value_as_value(priv_obj);
+       obj = bt_value_integer_create_init(321456987);
        ok(obj && bt_value_is_integer(obj),
-               "bt_private_value_integer_create_init() returns an integer value object");
+               "bt_value_integer_create_init() returns an integer value object");
        value = bt_value_integer_get(obj);
        ok(value == 321456987,
-               "bt_private_value_integer_create_init() sets the appropriate initial value");
+               "bt_value_integer_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
 }
 
 static
 void test_real(void)
 {
        double value;
-       struct bt_private_value *priv_obj;
        struct bt_value *obj;
 
-       priv_obj = bt_private_value_real_create();
-       obj = bt_private_value_as_value(priv_obj);
+       obj = bt_value_real_create();
        ok(obj && bt_value_is_real(obj),
-               "bt_private_value_real_create() returns a real number value object");
+               "bt_value_real_create() returns a real number value object");
 
        value = 17.34;
        value = bt_value_real_get(obj);
        ok(value == 0.,
                "default real number value object value is 0");
 
-       bt_private_value_real_set(priv_obj, -3.1416);
+       bt_value_real_set(obj, -3.1416);
        value = bt_value_real_get(obj);
-       ok(value == -3.1416, "bt_private_value_real_set() works");
+       ok(value == -3.1416, "bt_value_real_set() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
        pass("putting an existing real number value object does not cause a crash")
 
-       priv_obj = bt_private_value_real_create_init(33.1649758);
-       obj = bt_private_value_as_value(priv_obj);
+       obj = bt_value_real_create_init(33.1649758);
        ok(obj && bt_value_is_real(obj),
-               "bt_private_value_real_create_init() returns a real number value object");
+               "bt_value_real_create_init() returns a real number value object");
        value = bt_value_real_get(obj);
        ok(value == 33.1649758,
-               "bt_private_value_real_create_init() sets the appropriate initial value");
+               "bt_value_real_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
 }
 
 static
 void test_string(void)
 {
        const char *value;
-       struct bt_private_value *priv_obj;
        struct bt_value *obj;
 
-       priv_obj = bt_private_value_string_create();
-       obj = bt_private_value_as_value(priv_obj);
+       obj = bt_value_string_create();
        ok(obj && bt_value_is_string(obj),
-               "bt_private_value_string_create() returns a string value object");
+               "bt_value_string_create() returns a string value object");
 
        value = bt_value_string_get(obj);
        ok(value && !strcmp(value, ""),
                "default string value object value is \"\"");
 
-       bt_private_value_string_set(priv_obj, "hello worldz");
+       bt_value_string_set(obj, "hello worldz");
        value = bt_value_string_get(obj);
        ok(value && !strcmp(value, "hello worldz"),
                "bt_value_string_get() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
        pass("putting an existing string value object does not cause a crash")
 
-       priv_obj = bt_private_value_string_create_init("initial value");
-       obj = bt_private_value_as_value(priv_obj);
+       obj = bt_value_string_create_init("initial value");
        ok(obj && bt_value_is_string(obj),
-               "bt_private_value_string_create_init() returns a string value object");
+               "bt_value_string_create_init() returns a string value object");
        value = bt_value_string_get(obj);
        ok(value && !strcmp(value, "initial value"),
-               "bt_private_value_string_create_init() sets the appropriate initial value");
+               "bt_value_string_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
 }
 
 static
@@ -188,34 +174,28 @@ void test_array(void)
        bt_bool bool_value;
        int64_t int_value;
        double real_value;
-       struct bt_private_value *priv_obj;
        struct bt_value *obj;
        const char *string_value;
-       struct bt_private_value *priv_array_obj;
        struct bt_value *array_obj;
 
-       priv_array_obj = bt_private_value_array_create();
-       array_obj = bt_private_value_as_value(priv_array_obj);
+       array_obj = bt_value_array_create();
        ok(array_obj && bt_value_is_array(array_obj),
-               "bt_private_value_array_create() returns an array value object");
+               "bt_value_array_create() returns an array value object");
        ok(bt_value_array_is_empty(array_obj),
                "initial array value object size is 0");
 
-       priv_obj = bt_private_value_integer_create_init(345);
-       obj = bt_private_value_as_value(priv_obj);
-       ret = bt_private_value_array_append_element(priv_array_obj, obj);
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
-       priv_obj = bt_private_value_real_create_init(-17.45);
-       obj = bt_private_value_as_value(priv_obj);
-       ret |= bt_private_value_array_append_element(priv_array_obj, obj);
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
-       priv_obj = bt_private_value_bool_create_init(BT_TRUE);
-       obj = bt_private_value_as_value(priv_obj);
-       ret |= bt_private_value_array_append_element(priv_array_obj, obj);
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
-       ret |= bt_private_value_array_append_element(priv_array_obj,
+       obj = bt_value_integer_create_init(345);
+       ret = bt_value_array_append_element(array_obj, obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       obj = bt_value_real_create_init(-17.45);
+       ret |= bt_value_array_append_element(array_obj, obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       obj = bt_value_bool_create_init(BT_TRUE);
+       ret |= bt_value_array_append_element(array_obj, obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       ret |= bt_value_array_append_element(array_obj,
                bt_value_null);
-       ok(!ret, "bt_private_value_array_append_element() succeeds");
+       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");
 
@@ -241,12 +221,11 @@ void test_array(void)
        ok(obj == bt_value_null,
                "bt_value_array_borrow_element_by_index() returns an value object with the appropriate type (null)");
 
-       priv_obj = bt_private_value_integer_create_init(1001);
-       obj = bt_private_value_as_value(priv_obj);
+       obj = bt_value_integer_create_init(1001);
        BT_ASSERT(obj);
-       ok(!bt_private_value_array_set_element_by_index(priv_array_obj, 2, obj),
+       ok(!bt_value_array_set_element_by_index(array_obj, 2, obj),
                "bt_value_array_set_element_by_index() succeeds");
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
        obj = bt_value_array_borrow_element_by_index(array_obj, 2);
        ok(obj && bt_value_is_integer(obj),
                "bt_value_array_set_element_by_index() inserts an value object with the appropriate type");
@@ -255,64 +234,64 @@ void test_array(void)
        ok(int_value == 1001,
                "bt_value_array_set_element_by_index() inserts an value object with the appropriate value");
 
-       ret = bt_private_value_array_append_bool_element(priv_array_obj,
+       ret = bt_value_array_append_bool_element(array_obj,
                BT_FALSE);
-       ok(!ret, "bt_private_value_array_append_bool_element() succeeds");
-       ret = bt_private_value_array_append_integer_element(priv_array_obj,
+       ok(!ret, "bt_value_array_append_bool_element() succeeds");
+       ret = bt_value_array_append_integer_element(array_obj,
                98765);
-       ok(!ret, "bt_private_value_array_append_integer_element() succeeds");
-       ret = bt_private_value_array_append_real_element(priv_array_obj,
+       ok(!ret, "bt_value_array_append_integer_element() succeeds");
+       ret = bt_value_array_append_real_element(array_obj,
                2.49578);
-       ok(!ret, "bt_private_value_array_append_real_element() succeeds");
-       ret = bt_private_value_array_append_string_element(priv_array_obj,
+       ok(!ret, "bt_value_array_append_real_element() succeeds");
+       ret = bt_value_array_append_string_element(array_obj,
                "bt_value");
-       ok(!ret, "bt_private_value_array_append_string_element() succeeds");
-       ret = bt_private_value_array_append_empty_array_element(priv_array_obj);
-       ok(!ret, "bt_private_value_array_append_empty_array_element() succeeds");
-       ret = bt_private_value_array_append_empty_map_element(priv_array_obj);
-       ok(!ret, "bt_private_value_array_append_empty_map_element() succeeds");
+       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_private_value_array_append_element_*() functions increment the array value object's size");
+               "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_borrow_element_by_index(array_obj, 4);
        ok(obj && bt_value_is_bool(obj),
-               "bt_private_value_array_append_bool_element() appends a boolean value object");
+               "bt_value_array_append_bool_element() appends a boolean value object");
        bool_value = bt_value_bool_get(obj);
        ok(!bool_value,
-               "bt_private_value_array_append_bool_element() appends the appropriate value");
+               "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_private_value_array_append_integer_element() appends an integer value object");
+               "bt_value_array_append_integer_element() appends an integer value object");
        int_value = bt_value_integer_get(obj);
        ok(int_value == 98765,
-               "bt_private_value_array_append_integer_element() appends the appropriate value");
+               "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_private_value_array_append_real_element() appends a real number value object");
+               "bt_value_array_append_real_element() appends a real number value object");
        real_value = bt_value_real_get(obj);
        ok(real_value == 2.49578,
-               "bt_private_value_array_append_real_element() appends the appropriate value");
+               "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_private_value_array_append_string_element() appends a string value object");
+               "bt_value_array_append_string_element() appends a string value object");
        string_value = bt_value_string_get(obj);
        ok(!ret && string_value && !strcmp(string_value, "bt_value"),
-               "bt_private_value_array_append_string_element() appends the appropriate value");
+               "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_private_value_array_append_empty_array_element() 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_private_value_array_append_empty_array_element() an empty array value object");
+               "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_private_value_array_append_empty_map_element() 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_private_value_array_append_empty_map_element() an empty map value object");
+               "bt_value_array_append_empty_map_element() an empty map value object");
 
-       BT_OBJECT_PUT_REF_AND_RESET(priv_array_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(array_obj);
        pass("putting an existing array value object does not cause a crash")
 }
 
@@ -496,42 +475,35 @@ void test_map(void)
        bt_bool bool_value;
        int64_t int_value;
        double real_value;
-       struct bt_private_value *priv_obj;
        struct bt_value *obj;
-       struct bt_private_value *priv_map_obj;
        struct bt_value *map_obj;
        struct map_foreach_checklist checklist;
 
-       priv_map_obj = bt_private_value_map_create();
-       map_obj = bt_private_value_as_value(priv_map_obj);
+       map_obj = bt_value_map_create();
        ok(map_obj && bt_value_is_map(map_obj),
-               "bt_private_value_map_create() returns a map value object");
+               "bt_value_map_create() returns a map value object");
        ok(bt_value_map_get_size(map_obj) == 0,
                "initial map value object size is 0");
 
-       priv_obj = bt_private_value_integer_create_init(19457);
-       obj = bt_private_value_as_value(priv_obj);
-       ret = bt_private_value_map_insert_entry(priv_map_obj, "int", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
-       priv_obj = bt_private_value_real_create_init(5.444);
-       obj = bt_private_value_as_value(priv_obj);
-       ret |= bt_private_value_map_insert_entry(priv_map_obj, "real", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
-       priv_obj = bt_private_value_bool_create();
-       obj = bt_private_value_as_value(priv_obj);
-       ret |= bt_private_value_map_insert_entry(priv_map_obj, "bt_bool", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
-       ret |= bt_private_value_map_insert_entry(priv_map_obj, "null",
+       obj = bt_value_integer_create_init(19457);
+       ret = bt_value_map_insert_entry(map_obj, "int", obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       obj = bt_value_real_create_init(5.444);
+       ret |= bt_value_map_insert_entry(map_obj, "real", obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       obj = bt_value_bool_create();
+       ret |= bt_value_map_insert_entry(map_obj, "bt_bool", obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       ret |= bt_value_map_insert_entry(map_obj, "null",
                bt_value_null);
-       ok(!ret, "bt_private_value_map_insert_entry() succeeds");
+       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");
 
-       priv_obj = bt_private_value_bool_create_init(BT_TRUE);
-       obj = bt_private_value_as_value(priv_obj);
-       ret = bt_private_value_map_insert_entry(priv_map_obj, "bt_bool", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(priv_obj);
-       ok(!ret, "bt_private_value_map_insert_entry() accepts an existing key");
+       obj = bt_value_bool_create_init(BT_TRUE);
+       ret = bt_value_map_insert_entry(map_obj, "bt_bool", obj);
+       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       ok(!ret, "bt_value_map_insert_entry() accepts an existing key");
 
        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");
@@ -557,23 +529,23 @@ void test_map(void)
        ok(bool_value,
                "bt_value_map_borrow_entry_value() returns an value object with the appropriate value (boolean)");
 
-       ret = bt_private_value_map_insert_bool_entry(priv_map_obj, "bool2",
+       ret = bt_value_map_insert_bool_entry(map_obj, "bool2",
                BT_TRUE);
-       ok(!ret, "bt_private_value_map_insert_bool_entry() succeeds");
-       ret = bt_private_value_map_insert_integer_entry(priv_map_obj, "int2",
+       ok(!ret, "bt_value_map_insert_bool_entry() succeeds");
+       ret = bt_value_map_insert_integer_entry(map_obj, "int2",
                98765);
-       ok(!ret, "bt_private_value_map_insert_integer_entry() succeeds");
-       ret = bt_private_value_map_insert_real_entry(priv_map_obj, "real2",
+       ok(!ret, "bt_value_map_insert_integer_entry() succeeds");
+       ret = bt_value_map_insert_real_entry(map_obj, "real2",
                -49.0001);
-       ok(!ret, "bt_private_value_map_insert_real_entry() succeeds");
-       ret = bt_private_value_map_insert_string_entry(priv_map_obj, "string2",
+       ok(!ret, "bt_value_map_insert_real_entry() succeeds");
+       ret = bt_value_map_insert_string_entry(map_obj, "string2",
                "bt_value");
-       ok(!ret, "bt_private_value_map_insert_string_entry() succeeds");
-       ret = bt_private_value_map_insert_empty_array_entry(priv_map_obj,
+       ok(!ret, "bt_value_map_insert_string_entry() succeeds");
+       ret = bt_value_map_insert_empty_array_entry(map_obj,
                "array2");
-       ok(!ret, "bt_private_value_map_insert_empty_array_entry() succeeds");
-       ret = bt_private_value_map_insert_empty_map_entry(priv_map_obj, "map2");
-       ok(!ret, "bt_private_value_map_insert_empty_map_entry() succeeds");
+       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");
@@ -617,7 +589,7 @@ void test_map(void)
                checklist.array2 && checklist.map2,
                "bt_value_map_foreach_entry() iterates over all the map value object's elements");
 
-       BT_OBJECT_PUT_REF_AND_RESET(priv_map_obj);
+       BT_OBJECT_PUT_REF_AND_RESET(map_obj);
        pass("putting an existing map value object does not cause a crash")
 }
 
@@ -643,22 +615,22 @@ void test_compare_null(void)
 static
 void test_compare_bool(void)
 {
-       struct bt_private_value *bool1 =
-               bt_private_value_bool_create_init(BT_FALSE);
-       struct bt_private_value *bool2 =
-               bt_private_value_bool_create_init(BT_TRUE);
-       struct bt_private_value *bool3 =
-               bt_private_value_bool_create_init(BT_FALSE);
+       struct bt_value *bool1 =
+               bt_value_bool_create_init(BT_FALSE);
+       struct bt_value *bool2 =
+               bt_value_bool_create_init(BT_TRUE);
+       struct bt_value *bool3 =
+               bt_value_bool_create_init(BT_FALSE);
 
        BT_ASSERT(bool1 && bool2 && bool3);
        ok(!bt_value_compare(bt_value_null,
-               bt_private_value_as_value(bool1)),
+               bool1),
                "cannot compare null value object and bt_bool value object");
-       ok(!bt_value_compare(bt_private_value_as_value(bool1),
-               bt_private_value_as_value(bool2)),
+       ok(!bt_value_compare(bool1,
+                            bool2),
                "boolean value objects are not equivalent (BT_FALSE and BT_TRUE)");
-       ok(bt_value_compare(bt_private_value_as_value(bool1),
-               bt_private_value_as_value(bool3)),
+       ok(bt_value_compare(bool1,
+                           bool3),
                "boolean value objects are equivalent (BT_FALSE and BT_FALSE)");
 
        BT_OBJECT_PUT_REF_AND_RESET(bool1);
@@ -669,22 +641,22 @@ void test_compare_bool(void)
 static
 void test_compare_integer(void)
 {
-       struct bt_private_value *int1 =
-               bt_private_value_integer_create_init(10);
-       struct bt_private_value *int2 =
-               bt_private_value_integer_create_init(-23);
-       struct bt_private_value *int3 =
-               bt_private_value_integer_create_init(10);
+       struct bt_value *int1 =
+               bt_value_integer_create_init(10);
+       struct bt_value *int2 =
+               bt_value_integer_create_init(-23);
+       struct bt_value *int3 =
+               bt_value_integer_create_init(10);
 
        BT_ASSERT(int1 && int2 && int3);
        ok(!bt_value_compare(bt_value_null,
-               bt_private_value_as_value(int1)),
+               int1),
                "cannot compare null value object and integer value object");
-       ok(!bt_value_compare(bt_private_value_as_value(int1),
-               bt_private_value_as_value(int2)),
+       ok(!bt_value_compare(int1,
+                            int2),
                "integer value objects are not equivalent (10 and -23)");
-       ok(bt_value_compare(bt_private_value_as_value(int1),
-               bt_private_value_as_value(int3)),
+       ok(bt_value_compare(int1,
+                           int3),
                "integer value objects are equivalent (10 and 10)");
 
        BT_OBJECT_PUT_REF_AND_RESET(int1);
@@ -695,23 +667,23 @@ void test_compare_integer(void)
 static
 void test_compare_real(void)
 {
-       struct bt_private_value *real1 =
-               bt_private_value_real_create_init(17.38);
-       struct bt_private_value *real2 =
-               bt_private_value_real_create_init(-14.23);
-       struct bt_private_value *real3 =
-               bt_private_value_real_create_init(17.38);
+       struct bt_value *real1 =
+               bt_value_real_create_init(17.38);
+       struct bt_value *real2 =
+               bt_value_real_create_init(-14.23);
+       struct bt_value *real3 =
+               bt_value_real_create_init(17.38);
 
        BT_ASSERT(real1 && real2 && real3);
 
        ok(!bt_value_compare(bt_value_null,
-               bt_private_value_as_value(real1)),
+               real1),
                "cannot compare null value object and real number value object");
-       ok(!bt_value_compare(bt_private_value_as_value(real1),
-               bt_private_value_as_value(real2)),
+       ok(!bt_value_compare(real1,
+                            real2),
                "real number value objects are not equivalent (17.38 and -14.23)");
-       ok(bt_value_compare(bt_private_value_as_value(real1),
-               bt_private_value_as_value(real3)),
+       ok(bt_value_compare(real1,
+                           real3),
                "real number value objects are equivalent (17.38 and 17.38)");
 
        BT_OBJECT_PUT_REF_AND_RESET(real1);
@@ -722,23 +694,23 @@ void test_compare_real(void)
 static
 void test_compare_string(void)
 {
-       struct bt_private_value *string1 =
-               bt_private_value_string_create_init("hello");
-       struct bt_private_value *string2 =
-               bt_private_value_string_create_init("bt_value");
-       struct bt_private_value *string3 =
-               bt_private_value_string_create_init("hello");
+       struct bt_value *string1 =
+               bt_value_string_create_init("hello");
+       struct bt_value *string2 =
+               bt_value_string_create_init("bt_value");
+       struct bt_value *string3 =
+               bt_value_string_create_init("hello");
 
        BT_ASSERT(string1 && string2 && string3);
 
        ok(!bt_value_compare(bt_value_null,
-               bt_private_value_as_value(string1)),
+               string1),
                "cannot compare null value object and string value object");
-       ok(!bt_value_compare(bt_private_value_as_value(string1),
-               bt_private_value_as_value(string2)),
+       ok(!bt_value_compare(string1,
+                            string2),
                "string value objects are not equivalent (\"hello\" and \"bt_value\")");
-       ok(bt_value_compare(bt_private_value_as_value(string1),
-               bt_private_value_as_value(string3)),
+       ok(bt_value_compare(string1,
+                           string3),
                "string value objects are equivalent (\"hello\" and \"hello\")");
 
        BT_OBJECT_PUT_REF_AND_RESET(string1);
@@ -749,50 +721,47 @@ void test_compare_string(void)
 static
 void test_compare_array(void)
 {
-       struct bt_private_value *array1 = bt_private_value_array_create();
-       struct bt_private_value *array2 = bt_private_value_array_create();
-       struct bt_private_value *array3 = bt_private_value_array_create();
+       struct bt_value *array1 = bt_value_array_create();
+       struct bt_value *array2 = bt_value_array_create();
+       struct bt_value *array3 = bt_value_array_create();
        enum bt_value_status status;
 
        BT_ASSERT(array1 && array2 && array3);
 
-       ok(bt_value_compare(bt_private_value_as_value(array1),
-               bt_private_value_as_value(array2)),
+       ok(bt_value_compare(array1,
+                           array2),
                "empty array value objects are equivalent");
 
-       status = bt_private_value_array_append_integer_element(array1, 23);
+       status = bt_value_array_append_integer_element(array1, 23);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_real_element(array1, 14.2);
+       status = bt_value_array_append_real_element(array1, 14.2);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_bool_element(array1, BT_FALSE);
+       status = bt_value_array_append_bool_element(array1, BT_FALSE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_real_element(array2, 14.2);
+       status = bt_value_array_append_real_element(array2, 14.2);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_integer_element(array2, 23);
+       status = bt_value_array_append_integer_element(array2, 23);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_bool_element(array2, BT_FALSE);
+       status = bt_value_array_append_bool_element(array2, BT_FALSE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_integer_element(array3, 23);
+       status = bt_value_array_append_integer_element(array3, 23);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_real_element(array3, 14.2);
+       status = bt_value_array_append_real_element(array3, 14.2);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_bool_element(array3, BT_FALSE);
+       status = bt_value_array_append_bool_element(array3, BT_FALSE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       BT_ASSERT(bt_value_array_get_size(
-               bt_private_value_as_value(array1)) == 3);
-       BT_ASSERT(bt_value_array_get_size(
-               bt_private_value_as_value(array2)) == 3);
-       BT_ASSERT(bt_value_array_get_size(
-               bt_private_value_as_value(array3)) == 3);
+       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,
-               bt_private_value_as_value(array1)),
+               array1),
                "cannot compare null value object and array value object");
-       ok(!bt_value_compare(bt_private_value_as_value(array1),
-               bt_private_value_as_value(array2)),
+       ok(!bt_value_compare(array1,
+                            array2),
                "array value objects are not equivalent ([23, 14.2, BT_FALSE] and [14.2, 23, BT_FALSE])");
-       ok(bt_value_compare(bt_private_value_as_value(array1),
-               bt_private_value_as_value(array3)),
+       ok(bt_value_compare(array1,
+                           array3),
                "array value objects are equivalent ([23, 14.2, BT_FALSE] and [23, 14.2, BT_FALSE])");
 
        BT_OBJECT_PUT_REF_AND_RESET(array1);
@@ -803,54 +772,51 @@ void test_compare_array(void)
 static
 void test_compare_map(void)
 {
-       struct bt_private_value *map1 = bt_private_value_map_create();
-       struct bt_private_value *map2 = bt_private_value_map_create();
-       struct bt_private_value *map3 = bt_private_value_map_create();
+       struct bt_value *map1 = bt_value_map_create();
+       struct bt_value *map2 = bt_value_map_create();
+       struct bt_value *map3 = bt_value_map_create();
        enum bt_value_status status;
 
        BT_ASSERT(map1 && map2 && map3);
 
-       ok(bt_value_compare(bt_private_value_as_value(map1),
-               bt_private_value_as_value(map2)),
+       ok(bt_value_compare(map1,
+                           map2),
                "empty map value objects are equivalent");
 
 
-       status = bt_private_value_map_insert_integer_entry(map1, "one", 23);
+       status = bt_value_map_insert_integer_entry(map1, "one", 23);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_real_entry(map1, "two", 14.2);
+       status = bt_value_map_insert_real_entry(map1, "two", 14.2);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_bool_entry(map1, "three",
+       status = bt_value_map_insert_bool_entry(map1, "three",
                BT_FALSE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_real_entry(map2, "one", 14.2);
+       status = bt_value_map_insert_real_entry(map2, "one", 14.2);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_integer_entry(map2, "two", 23);
+       status = bt_value_map_insert_integer_entry(map2, "two", 23);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_bool_entry(map2, "three",
+       status = bt_value_map_insert_bool_entry(map2, "three",
                BT_FALSE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_bool_entry(map3, "three",
+       status = bt_value_map_insert_bool_entry(map3, "three",
                BT_FALSE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_integer_entry(map3, "one", 23);
+       status = bt_value_map_insert_integer_entry(map3, "one", 23);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_real_entry(map3, "two", 14.2);
+       status = bt_value_map_insert_real_entry(map3, "two", 14.2);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       BT_ASSERT(bt_value_map_get_size(
-               bt_private_value_as_value(map1)) == 3);
-       BT_ASSERT(bt_value_map_get_size(
-               bt_private_value_as_value(map2)) == 3);
-       BT_ASSERT(bt_value_map_get_size(
-               bt_private_value_as_value(map3)) == 3);
+       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,
-               bt_private_value_as_value(map1)),
+               map1),
                "cannot compare null value object and map value object");
-       ok(!bt_value_compare(bt_private_value_as_value(map1),
-               bt_private_value_as_value(map2)),
+       ok(!bt_value_compare(map1,
+                            map2),
                "map value objects are not equivalent");
-       ok(bt_value_compare(bt_private_value_as_value(map1),
-               bt_private_value_as_value(map3)),
+       ok(bt_value_compare(map1,
+                           map3),
                "map value objects are equivalent");
 
        BT_OBJECT_PUT_REF_AND_RESET(map1);
@@ -881,78 +847,78 @@ void test_copy(void)
         * bt_value_compare() elsewhere, then the deep copy is a
         * success.
         */
-       struct bt_private_value *null_copy_obj;
-       struct bt_private_value *bool_obj, *bool_copy_obj;
-       struct bt_private_value *integer_obj, *integer_copy_obj;
-       struct bt_private_value *real_obj, *real_copy_obj;
-       struct bt_private_value *string_obj, *string_copy_obj;
-       struct bt_private_value *array_obj, *array_copy_obj;
-       struct bt_private_value *map_obj, *map_copy_obj;
+       struct bt_value *null_copy_obj;
+       struct bt_value *bool_obj, *bool_copy_obj;
+       struct bt_value *integer_obj, *integer_copy_obj;
+       struct bt_value *real_obj, *real_copy_obj;
+       struct bt_value *string_obj, *string_copy_obj;
+       struct bt_value *array_obj, *array_copy_obj;
+       struct bt_value *map_obj, *map_copy_obj;
        enum bt_value_status status;
 
-       bool_obj = bt_private_value_bool_create_init(BT_TRUE);
-       integer_obj = bt_private_value_integer_create_init(23);
-       real_obj = bt_private_value_real_create_init(-3.1416);
-       string_obj = bt_private_value_string_create_init("test");
-       array_obj = bt_private_value_array_create();
-       map_obj = bt_private_value_map_create();
+       bool_obj = bt_value_bool_create_init(BT_TRUE);
+       integer_obj = bt_value_integer_create_init(23);
+       real_obj = bt_value_real_create_init(-3.1416);
+       string_obj = bt_value_string_create_init("test");
+       array_obj = bt_value_array_create();
+       map_obj = bt_value_map_create();
 
        BT_ASSERT(bool_obj && integer_obj && real_obj && string_obj &&
                array_obj && map_obj);
 
-       status = bt_private_value_array_append_element(array_obj,
-               bt_private_value_as_value(bool_obj));
+       status = bt_value_array_append_element(array_obj,
+               bool_obj);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_element(array_obj,
-               bt_private_value_as_value(integer_obj));
+       status = bt_value_array_append_element(array_obj,
+               integer_obj);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_element(array_obj,
-               bt_private_value_as_value(real_obj));
+       status = bt_value_array_append_element(array_obj,
+               real_obj);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_array_append_element(array_obj,
+       status = bt_value_array_append_element(array_obj,
                bt_value_null);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_entry(map_obj, "array",
-               bt_private_value_as_value(array_obj));
+       status = bt_value_map_insert_entry(map_obj, "array",
+               array_obj);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_entry(map_obj, "string",
-               bt_private_value_as_value(string_obj));
+       status = bt_value_map_insert_entry(map_obj, "string",
+               string_obj);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
 
        status = bt_value_copy(&map_copy_obj,
-               bt_private_value_as_value(map_obj));
+               map_obj);
        ok(status == BT_VALUE_STATUS_OK && map_copy_obj,
                "bt_value_copy() succeeds");
 
        ok(map_obj != map_copy_obj,
                "bt_value_copy() returns a different pointer (map)");
-       string_copy_obj = bt_private_value_map_borrow_entry_value(map_copy_obj,
+       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_private_value_map_borrow_entry_value(map_copy_obj,
+       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_private_value_array_borrow_element_by_index(
+       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_private_value_array_borrow_element_by_index(
+       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_private_value_array_borrow_element_by_index(
+       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_private_value_array_borrow_element_by_index(
+       null_copy_obj = bt_value_array_borrow_element_by_index(
                array_copy_obj, 3);
-       ok(bt_private_value_as_value(null_copy_obj) == bt_value_null,
+       ok(null_copy_obj == bt_value_null,
                "bt_value_copy() returns the same pointer (null)");
 
-       ok(bt_value_compare(bt_private_value_as_value(map_obj),
-               bt_private_value_as_value(map_copy_obj)),
+       ok(bt_value_compare(map_obj,
+                           map_copy_obj),
                "source and destination value objects have the same content");
 
        BT_OBJECT_PUT_REF_AND_RESET(map_copy_obj);
@@ -965,15 +931,15 @@ void test_copy(void)
 }
 
 static
-bt_bool compare_map_elements(struct bt_value *map_a, struct bt_value *map_b,
+bt_bool compare_map_elements(const struct bt_value *map_a, const struct bt_value *map_b,
                const char *key)
 {
-       struct bt_value *elem_a = NULL;
-       struct bt_value *elem_b = NULL;
+       const struct bt_value *elem_a = NULL;
+       const struct bt_value *elem_b = NULL;
        bt_bool equal;
 
-       elem_a = bt_value_map_borrow_entry_value(map_a, key);
-       elem_b = bt_value_map_borrow_entry_value(map_b, key);
+       elem_a = bt_value_map_borrow_entry_value_const(map_a, key);
+       elem_b = bt_value_map_borrow_entry_value_const(map_b, key);
        equal = bt_value_compare(elem_a, elem_b);
        return equal;
 }
@@ -981,59 +947,58 @@ bt_bool compare_map_elements(struct bt_value *map_a, struct bt_value *map_b,
 static
 void test_extend(void)
 {
-       struct bt_private_value *base_map = bt_private_value_map_create();
-       struct bt_private_value *extension_map = bt_private_value_map_create();
-       struct bt_private_value *extended_map = NULL;
-       struct bt_private_value *array = bt_private_value_array_create();
+       struct bt_value *base_map = bt_value_map_create();
+       struct bt_value *extension_map = bt_value_map_create();
+       struct bt_value *extended_map = NULL;
+       struct bt_value *array = bt_value_array_create();
        enum bt_value_status status;
 
        BT_ASSERT(base_map);
        BT_ASSERT(extension_map);
        BT_ASSERT(array);
-       status = bt_private_value_map_insert_bool_entry(base_map, "file",
+       status = bt_value_map_insert_bool_entry(base_map, "file",
                BT_TRUE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_bool_entry(base_map, "edit",
+       status = bt_value_map_insert_bool_entry(base_map, "edit",
                BT_FALSE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_integer_entry(base_map,
+       status = bt_value_map_insert_integer_entry(base_map,
                "selection", 17);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_integer_entry(base_map, "find",
+       status = bt_value_map_insert_integer_entry(base_map, "find",
                -34);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_bool_entry(extension_map, "edit",
+       status = bt_value_map_insert_bool_entry(extension_map, "edit",
                BT_TRUE);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_integer_entry(extension_map,
+       status = bt_value_map_insert_integer_entry(extension_map,
                "find", 101);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
-       status = bt_private_value_map_insert_real_entry(extension_map,
+       status = bt_value_map_insert_real_entry(extension_map,
                "project", -404);
        BT_ASSERT(status == BT_VALUE_STATUS_OK);
        status = bt_value_map_extend(
                &extended_map,
-               bt_private_value_as_value(base_map),
-               bt_private_value_as_value(extension_map));
+               base_map,
+               extension_map);
        ok(status == BT_VALUE_STATUS_OK &&
                extended_map, "bt_value_map_extend() succeeds");
-       ok(bt_value_map_get_size(
-               bt_private_value_as_value(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(bt_private_value_as_value(base_map),
-               bt_private_value_as_value(extended_map), "file"),
+       ok(compare_map_elements(base_map,
+                               extended_map, "file"),
                "bt_value_map_extend() picks the appropriate element (file)");
-       ok(compare_map_elements(bt_private_value_as_value(extension_map),
-               bt_private_value_as_value(extended_map), "edit"),
+       ok(compare_map_elements(extension_map,
+                               extended_map, "edit"),
                "bt_value_map_extend() picks the appropriate element (edit)");
-       ok(compare_map_elements(bt_private_value_as_value(base_map),
-               bt_private_value_as_value(extended_map), "selection"),
+       ok(compare_map_elements(base_map,
+                               extended_map, "selection"),
                "bt_value_map_extend() picks the appropriate element (selection)");
-       ok(compare_map_elements(bt_private_value_as_value(extension_map),
-               bt_private_value_as_value(extended_map), "find"),
+       ok(compare_map_elements(extension_map,
+                               extended_map, "find"),
                "bt_value_map_extend() picks the appropriate element (find)");
-       ok(compare_map_elements(bt_private_value_as_value(extension_map),
-               bt_private_value_as_value(extended_map), "project"),
+       ok(compare_map_elements(extension_map,
+                               extended_map, "project"),
                "bt_value_map_extend() picks the appropriate element (project)");
 
        BT_OBJECT_PUT_REF_AND_RESET(array);
index f1eb23441a8eb2c1ec0e6b25679853bd8dcc170b..d89d86b2a2fefb36fd8a328b608897f61fb28cd3 100644 (file)
@@ -535,7 +535,7 @@ void sink_input_port_disconnected(struct bt_self_component_sink *self_comp,
 static
 enum bt_self_component_status src_init(
        struct bt_self_component_source *self_comp,
-       struct bt_value *params, void *init_method_data)
+       const struct bt_value *params, void *init_method_data)
 {
        int ret;
 
@@ -548,7 +548,7 @@ enum bt_self_component_status src_init(
 static
 enum bt_self_component_status sink_init(
        struct bt_self_component_sink *self_comp,
-       struct bt_value *params, void *init_method_data)
+       const struct bt_value *params, void *init_method_data)
 {
        int ret;
 
index eae1ab51374164804357660a824a9b2338e5ae98..4306834c7417324db8a48d596523d0b34a826245 100644 (file)
@@ -118,10 +118,10 @@ static void test_sfs(const char *plugin_dir)
        char *sfs_path = get_test_plugin_path(plugin_dir, "sfs");
        unsigned int major, minor, patch;
        const char *extra;
-       struct bt_private_value *params;
-       struct bt_value *results;
-       struct bt_value *object;
-       struct bt_value *res_params;
+       struct bt_value *params;
+       const struct bt_value *results;
+       const struct bt_value *object;
+       const struct bt_value *res_params;
        struct bt_private_graph *graph;
        const char *object_str;
        enum bt_graph_status graph_ret;
@@ -175,21 +175,20 @@ static void test_sfs(const char *plugin_dir)
                plugin, "filter");
        ok(filter_comp_class,
                "bt_plugin_borrow_filter_component_class_by_name() finds a filter component class");
-       params = bt_private_value_integer_create_init(23);
+       params = bt_value_integer_create_init(23);
        BT_ASSERT(params);
        ret = bt_private_query_executor_query(query_exec,
                bt_component_class_filter_as_component_class(filter_comp_class),
-               "get-something", bt_private_value_as_value(params),
-               &results);
+               "get-something", params, &results);
        ok(ret == 0 && results, "bt_private_query_executor_query() succeeds");
        BT_ASSERT(bt_value_is_array(results) && bt_value_array_get_size(results) == 2);
-       object = bt_value_array_borrow_element_by_index(results, 0);
+       object = bt_value_array_borrow_element_by_index_const(results, 0);
        BT_ASSERT(object && bt_value_is_string(object));
        object_str = bt_value_string_get(object);
        ok(strcmp(object_str, "get-something") == 0,
                "bt_component_class_query() receives the expected object name");
-       res_params = bt_value_array_borrow_element_by_index(results, 1);
-       ok(res_params == bt_private_value_as_value(params),
+       res_params = bt_value_array_borrow_element_by_index_const(results, 1);
+       ok(bt_value_compare(res_params, params),
                "bt_component_class_query() receives the expected parameters");
 
        bt_object_get_ref(sink_comp_class);
This page took 0.162141 seconds and 4 git commands to generate.