#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-internal.h>
-#include <babeltrace/ref.h>
+#include <babeltrace/object.h>
#include <babeltrace/types.h>
#include <babeltrace/endian-internal.h>
#include <babeltrace/assert-internal.h>
}
BT_LOGD_STR("Putting packet header field classe.");
- bt_put(trace->packet_header_fc);
+ bt_object_put_ref(trace->packet_header_fc);
g_free(trace);
}
goto end;
error:
- BT_PUT(trace);
+ BT_OBJECT_PUT_REF_AND_RESET(trace);
end:
return trace;
static
bool trace_has_environment_entry(struct bt_trace *trace, const char *name)
{
- struct bt_value *attribute;
-
BT_ASSERT(trace);
- attribute = bt_attributes_borrow_field_value_by_name(
- trace->environment, name);
- return attribute != NULL;
+ return bt_attributes_borrow_field_value_by_name(
+ trace->environment, name) != NULL;
}
static
int set_environment_entry(struct bt_trace *trace, const char *name,
- struct bt_value *value)
+ struct bt_private_value *value)
{
int ret;
"%![trace-]+t, entry-name=\"%s\"", trace, name);
ret = bt_attributes_set_field_value(trace->environment, name,
value);
- bt_value_freeze(value);
+ bt_value_freeze(bt_value_borrow_from_private(value));
if (ret) {
BT_LIB_LOGE("Cannot set trace's environment entry: "
"%![trace-]+t, entry-name=\"%s\"", trace, name);
const char *name, const char *value)
{
int ret;
- struct bt_value *value_obj;
+ struct bt_private_value *value_obj;
BT_ASSERT_PRE_NON_NULL(trace, "Trace");
BT_ASSERT_PRE_NON_NULL(name, "Name");
BT_ASSERT_PRE_NON_NULL(value, "Value");
- value_obj = bt_value_string_create_init(value);
+ value_obj = bt_private_value_string_create_init(value);
if (!value_obj) {
BT_LOGE_STR("Cannot create a string value object.");
ret = -1;
ret = set_environment_entry(trace, name, value_obj);
end:
- bt_put(value_obj);
+ bt_object_put_ref(value_obj);
return ret;
}
struct bt_trace *trace, const char *name, int64_t value)
{
int ret;
- struct bt_value *value_obj;
+ struct bt_private_value *value_obj;
BT_ASSERT_PRE_NON_NULL(trace, "Trace");
BT_ASSERT_PRE_NON_NULL(name, "Name");
- value_obj = bt_value_integer_create_init(value);
+ value_obj = bt_private_value_integer_create_init(value);
if (!value_obj) {
BT_LOGE_STR("Cannot create an integer value object.");
ret = -1;
ret = set_environment_entry(trace, name, value_obj);
end:
- bt_put(value_obj);
+ bt_object_put_ref(value_obj);
return ret;
}
BT_ASSERT_PRE_NON_NULL(value, "Value");
BT_ASSERT_PRE_VALID_INDEX(index,
bt_attributes_get_count(trace->environment));
- *value = bt_attributes_borrow_field_value(trace->environment, index);
+ *value = bt_value_borrow_from_private(
+ bt_attributes_borrow_field_value(trace->environment, index));
BT_ASSERT(*value);
*name = bt_attributes_get_field_name(trace->environment, index);
BT_ASSERT(*name);
{
BT_ASSERT_PRE_NON_NULL(trace, "Trace");
BT_ASSERT_PRE_NON_NULL(name, "Name");
- return bt_attributes_borrow_field_value_by_name(trace->environment,
- name);
+ return bt_value_borrow_from_private(
+ bt_attributes_borrow_field_value_by_name(trace->environment,
+ name));
}
uint64_t bt_trace_get_stream_count(struct bt_trace *trace)
}
bt_field_class_make_part_of_trace(field_class);
- bt_put(trace->packet_header_fc);
- trace->packet_header_fc = bt_get(field_class);
+ bt_object_put_ref(trace->packet_header_fc);
+ trace->packet_header_fc = bt_object_get_ref(field_class);
bt_field_class_freeze(field_class);
BT_LIB_LOGV("Set trace's packet header field classe: %!+t", trace);