#include <babeltrace/ctf-writer/utils-internal.h>
#include <babeltrace/ctf-writer/utils.h>
#include <babeltrace/endian-internal.h>
-#include <babeltrace/object-internal.h>
-#include <babeltrace/object.h>
+#include <babeltrace/ctf-writer/object-internal.h>
+#include <babeltrace/ctf-writer/object.h>
#include <float.h>
#include <inttypes.h>
#include <stdlib.h>
BT_HIDDEN
void bt_ctf_field_type_common_initialize(struct bt_ctf_field_type_common *ft,
- bool init_bo, bt_object_release_func release_func,
+ bool init_bo, bt_ctf_object_release_func release_func,
struct bt_ctf_field_type_common_methods *methods)
{
BT_ASSERT(ft && (ft->id > BT_CTF_FIELD_TYPE_ID_UNKNOWN) &&
(ft->id < BT_CTF_FIELD_TYPE_ID_NR));
- bt_object_init_shared(&ft->base, release_func);
+ bt_ctf_object_init_shared(&ft->base, release_func);
ft->methods = methods;
if (init_bo) {
BT_HIDDEN
void bt_ctf_field_type_common_integer_initialize(
struct bt_ctf_field_type_common *ft,
- unsigned int size, bt_object_release_func release_func,
+ unsigned int size, bt_ctf_object_release_func release_func,
struct bt_ctf_field_type_common_methods *methods)
{
struct bt_ctf_field_type_common_integer *int_ft = BT_CTF_FROM_COMMON(ft);
BT_HIDDEN
void bt_ctf_field_type_common_floating_point_initialize(
struct bt_ctf_field_type_common *ft,
- bt_object_release_func release_func,
+ bt_ctf_object_release_func release_func,
struct bt_ctf_field_type_common_methods *methods)
{
struct bt_ctf_field_type_common_floating_point *flt_ft = BT_CTF_FROM_COMMON(ft);
void bt_ctf_field_type_common_enumeration_initialize(
struct bt_ctf_field_type_common *ft,
struct bt_ctf_field_type_common *container_ft,
- bt_object_release_func release_func,
+ bt_ctf_object_release_func release_func,
struct bt_ctf_field_type_common_methods *methods)
{
struct bt_ctf_field_type_common_enumeration *enum_ft = BT_CTF_FROM_COMMON(ft);
BT_LOGD("Initializing common enumeration field type object: int-ft-addr=%p",
container_ft);
ft->id = BT_CTF_FIELD_TYPE_ID_ENUM;
- enum_ft->container_ft = bt_object_get_ref(container_ft);
+ enum_ft->container_ft = bt_ctf_object_get_ref(container_ft);
enum_ft->entries = g_ptr_array_new_with_free_func(
(GDestroyNotify) destroy_enumeration_mapping);
bt_ctf_field_type_common_initialize(ft, false, release_func, methods);
BT_HIDDEN
void bt_ctf_field_type_common_string_initialize(
struct bt_ctf_field_type_common *ft,
- bt_object_release_func release_func,
+ bt_ctf_object_release_func release_func,
struct bt_ctf_field_type_common_methods *methods)
{
struct bt_ctf_field_type_common_string *string_ft = BT_CTF_FROM_COMMON(ft);
BT_HIDDEN
void bt_ctf_field_type_common_structure_initialize(
struct bt_ctf_field_type_common *ft,
- bt_object_release_func release_func,
+ bt_ctf_object_release_func release_func,
struct bt_ctf_field_type_common_methods *methods)
{
struct bt_ctf_field_type_common_structure *struct_ft = BT_CTF_FROM_COMMON(ft);
void bt_ctf_field_type_common_array_initialize(
struct bt_ctf_field_type_common *ft,
struct bt_ctf_field_type_common *element_ft,
- unsigned int length, bt_object_release_func release_func,
+ unsigned int length, bt_ctf_object_release_func release_func,
struct bt_ctf_field_type_common_methods *methods)
{
struct bt_ctf_field_type_common_array *array_ft = BT_CTF_FROM_COMMON(ft);
BT_LOGD("Initializing common array field type object: element-ft-addr=%p, "
"length=%u", element_ft, length);
ft->id = BT_CTF_FIELD_TYPE_ID_ARRAY;
- array_ft->element_ft = bt_object_get_ref(element_ft);
+ array_ft->element_ft = bt_ctf_object_get_ref(element_ft);
array_ft->length = length;
bt_ctf_field_type_common_initialize(ft, false, release_func, methods);
BT_LOGD("Initialized common array field type object: addr=%p, "
struct bt_ctf_field_type_common *ft,
struct bt_ctf_field_type_common *element_ft,
const char *length_field_name,
- bt_object_release_func release_func,
+ bt_ctf_object_release_func release_func,
struct bt_ctf_field_type_common_methods *methods)
{
struct bt_ctf_field_type_common_sequence *seq_ft = BT_CTF_FROM_COMMON(ft);
BT_LOGD("Initializing common sequence field type object: element-ft-addr=%p, "
"length-field-name=\"%s\"", element_ft, length_field_name);
ft->id = BT_CTF_FIELD_TYPE_ID_SEQUENCE;
- seq_ft->element_ft = bt_object_get_ref(element_ft);
+ seq_ft->element_ft = bt_ctf_object_get_ref(element_ft);
seq_ft->length_field_name = g_string_new(length_field_name);
bt_ctf_field_type_common_initialize(ft, false, release_func, methods);
BT_LOGD("Initialized common sequence field type object: addr=%p, "
struct bt_ctf_field_type_common *ft,
struct bt_ctf_field_type_common *tag_ft,
const char *tag_name,
- bt_object_release_func release_func,
+ bt_ctf_object_release_func release_func,
struct bt_ctf_field_type_common_methods *methods)
{
struct bt_ctf_field_type_common_variant *var_ft = BT_CTF_FROM_COMMON(ft);
sizeof(struct bt_ctf_field_type_common_variant_choice));
if (tag_ft) {
- var_ft->tag_ft = bt_object_get_ref(tag_ft);
+ var_ft->tag_ft = bt_ctf_object_get_ref(tag_ft);
}
bt_ctf_field_type_common_initialize(ft, true, release_func, methods);
}
BT_HIDDEN
-void bt_ctf_field_type_common_integer_destroy(struct bt_object *obj)
+void bt_ctf_field_type_common_integer_destroy(struct bt_ctf_object *obj)
{
struct bt_ctf_field_type_common_integer *ft = (void *) obj;
BT_LOGD("Destroying integer field type object: addr=%p", ft);
BT_LOGD_STR("Putting mapped clock class.");
- bt_object_put_ref(ft->mapped_clock_class);
+ bt_ctf_object_put_ref(ft->mapped_clock_class);
g_free(ft);
}
BT_HIDDEN
-void bt_ctf_field_type_common_floating_point_destroy(struct bt_object *obj)
+void bt_ctf_field_type_common_floating_point_destroy(struct bt_ctf_object *obj)
{
struct bt_ctf_field_type_common_floating_point *ft = (void *) obj;
}
BT_HIDDEN
-void bt_ctf_field_type_common_enumeration_destroy_recursive(struct bt_object *obj)
+void bt_ctf_field_type_common_enumeration_destroy_recursive(struct bt_ctf_object *obj)
{
struct bt_ctf_field_type_common_enumeration *ft = (void *) obj;
BT_LOGD("Destroying enumeration field type object: addr=%p", ft);
g_ptr_array_free(ft->entries, TRUE);
BT_LOGD_STR("Putting container field type.");
- bt_object_put_ref(ft->container_ft);
+ bt_ctf_object_put_ref(ft->container_ft);
g_free(ft);
}
BT_HIDDEN
-void bt_ctf_field_type_common_string_destroy(struct bt_object *obj)
+void bt_ctf_field_type_common_string_destroy(struct bt_ctf_object *obj)
{
struct bt_ctf_field_type_common_string *ft = (void *) obj;
"addr=%p, field-ft-addr=%p, field-name=\"%s\"",
field, field->type, g_quark_to_string(field->name));
BT_LOGD_STR("Putting field type.");
- bt_object_put_ref(field->type);
+ bt_ctf_object_put_ref(field->type);
}
BT_HIDDEN
-void bt_ctf_field_type_common_structure_destroy_recursive(struct bt_object *obj)
+void bt_ctf_field_type_common_structure_destroy_recursive(struct bt_ctf_object *obj)
{
struct bt_ctf_field_type_common_structure *ft = (void *) obj;
uint64_t i;
}
BT_HIDDEN
-void bt_ctf_field_type_common_array_destroy_recursive(struct bt_object *obj)
+void bt_ctf_field_type_common_array_destroy_recursive(struct bt_ctf_object *obj)
{
struct bt_ctf_field_type_common_array *ft = (void *) obj;
BT_LOGD("Destroying array field type object: addr=%p", ft);
BT_LOGD_STR("Putting element field type.");
- bt_object_put_ref(ft->element_ft);
+ bt_ctf_object_put_ref(ft->element_ft);
g_free(ft);
}
BT_HIDDEN
-void bt_ctf_field_type_common_sequence_destroy_recursive(struct bt_object *obj)
+void bt_ctf_field_type_common_sequence_destroy_recursive(struct bt_ctf_object *obj)
{
struct bt_ctf_field_type_common_sequence *ft = (void *) obj;
BT_LOGD("Destroying sequence field type object: addr=%p", ft);
BT_LOGD_STR("Putting element field type.");
- bt_object_put_ref(ft->element_ft);
+ bt_ctf_object_put_ref(ft->element_ft);
g_string_free(ft->length_field_name, TRUE);
BT_LOGD_STR("Putting length field path.");
- bt_object_put_ref(ft->length_field_path);
+ bt_ctf_object_put_ref(ft->length_field_path);
g_free(ft);
}
"addr=%p, field-ft-addr=%p, field-name=\"%s\"",
choice, choice->type, g_quark_to_string(choice->name));
BT_LOGD_STR("Putting field type.");
- bt_object_put_ref(choice->type);
+ bt_ctf_object_put_ref(choice->type);
if (choice->ranges) {
g_array_free(choice->ranges, TRUE);
}
BT_HIDDEN
-void bt_ctf_field_type_common_variant_destroy_recursive(struct bt_object *obj)
+void bt_ctf_field_type_common_variant_destroy_recursive(struct bt_ctf_object *obj)
{
struct bt_ctf_field_type_common_variant *ft = (void *) obj;
uint64_t i;
}
BT_LOGD_STR("Putting tag field type.");
- bt_object_put_ref(ft->tag_ft);
+ bt_ctf_object_put_ref(ft->tag_ft);
BT_LOGD_STR("Putting tag field path.");
- bt_object_put_ref(ft->tag_field_path);
+ bt_ctf_object_put_ref(ft->tag_field_path);
g_free(ft);
}
}
*member_name = name_quark;
- *member_ft = bt_object_get_ref(field_type);
+ *member_ft = bt_ctf_object_get_ref(field_type);
g_hash_table_insert(field_name_to_index,
GUINT_TO_POINTER(name_quark),
GUINT_TO_POINTER(members->len - 1));
}
static
-void bt_ctf_field_type_enum_iter_destroy(struct bt_object *obj)
+void bt_ctf_field_type_enum_iter_destroy(struct bt_ctf_object *obj)
{
struct bt_ctf_field_type_enumeration_mapping_iterator *iter =
container_of(obj,
BT_LOGD("Destroying enumeration field type mapping iterator: addr=%p",
obj);
BT_LOGD_STR("Putting parent enumeration field type.");
- bt_object_put_ref(iter->enumeration_ft);
+ bt_ctf_object_put_ref(iter->enumeration_ft);
g_free(iter);
}
goto end;
}
- bt_object_init_shared(&iter->base, bt_ctf_field_type_enum_iter_destroy);
- iter->enumeration_ft = bt_object_get_ref(ft);
+ bt_ctf_object_init_shared(&iter->base, bt_ctf_field_type_enum_iter_destroy);
+ iter->enumeration_ft = bt_ctf_object_get_ref(ft);
iter->index = -1;
iter->type = iterator_type;
return iter;
error:
- bt_object_put_ref(iter);
+ bt_ctf_object_put_ref(iter);
return NULL;
}
return iter;
error:
- bt_object_put_ref(iter);
+ bt_ctf_object_put_ref(iter);
return NULL;
}
return iter;
error:
- bt_object_put_ref(iter);
+ bt_ctf_object_put_ref(iter);
return NULL;
}
goto end;
}
- bt_object_put_ref(int_ft->mapped_clock_class);
- int_ft->mapped_clock_class = bt_object_get_ref(clock_class);
+ bt_ctf_object_put_ref(int_ft->mapped_clock_class);
+ int_ft->mapped_clock_class = bt_ctf_object_get_ref(clock_class);
BT_LOGV("Set integer field type's mapped clock class: ft-addr=%p, "
"clock-class-addr=%p, clock-class-name=\"%s\"",
ft, clock_class, bt_ctf_clock_class_get_name(clock_class));
BT_CTF_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(ft, i);
if (field->name == name_quark) {
- bt_object_put_ref(field->type);
- field->type = bt_object_get_ref(field_type);
+ bt_ctf_object_put_ref(field->type);
+ field->type = bt_ctf_object_get_ref(field_type);
}
}
}
if (array_ft->element_ft) {
- BT_OBJECT_PUT_REF_AND_RESET(array_ft->element_ft);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(array_ft->element_ft);
}
- array_ft->element_ft = bt_object_get_ref(element_ft);
+ array_ft->element_ft = bt_ctf_object_get_ref(element_ft);
BT_LOGV("Set array field type's element field type: array-ft-addr=%p, "
"element-ft-addr=%p", ft, element_ft);
}
if (seq_ft->element_ft) {
- BT_OBJECT_PUT_REF_AND_RESET(seq_ft->element_ft);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(seq_ft->element_ft);
}
seq_ft->element_ft = element_ft;
- bt_object_get_ref(seq_ft->element_ft);
+ bt_ctf_object_get_ref(seq_ft->element_ft);
BT_LOGV("Set sequence field type's element field type: sequence-ft-addr=%p, "
"element-ft-addr=%p", ft, element_ft);
goto end;
}
- bt_object_get_ref(path);
- BT_OBJECT_MOVE_REF(seq_ft->length_field_path, path);
+ bt_ctf_object_get_ref(path);
+ BT_CTF_OBJECT_MOVE_REF(seq_ft->length_field_path, path);
BT_LOGV("Set sequence field type's length field path: ft-addr=%p, "
"field-path-addr=%p", ft, path);
goto end;
}
- bt_object_get_ref(path);
- BT_OBJECT_MOVE_REF(var_ft->tag_field_path, path);
+ bt_ctf_object_get_ref(path);
+ BT_CTF_OBJECT_MOVE_REF(var_ft->tag_field_path, path);
BT_LOGV("Set variant field type's tag field path: ft-addr=%p, "
"field-path-addr=%p", ft, path);
goto end;
}
- bt_object_put_ref(var_ft->tag_ft);
- var_ft->tag_ft = bt_object_get_ref(tag_ft);
+ bt_ctf_object_put_ref(var_ft->tag_ft);
+ var_ft->tag_ft = bt_ctf_object_get_ref(tag_ft);
BT_LOGV("Set variant field type's tag field type: variant-ft-addr=%p, "
"tag-ft-addr=%p", ft, tag_ft);
g_array_append_val(choice->ranges, range);
}
- bt_object_put_ref(iter);
+ bt_ctf_object_put_ref(iter);
}
var_ft->choices_up_to_date = true;
if (!*expected_clock_class) {
/* Move reference to output parameter */
- *expected_clock_class = bt_object_get_ref(mapped_clock_class);
+ *expected_clock_class = bt_ctf_object_get_ref(mapped_clock_class);
mapped_clock_class = NULL;
BT_LOGV("Setting expected clock class: "
"expected-clock-class-addr=%p",
bt_ctf_clock_class_get_name(mapped_clock_class),
*expected_clock_class,
bt_ctf_clock_class_get_name(*expected_clock_class));
- bt_object_put_ref(mapped_clock_class);
+ bt_ctf_object_put_ref(mapped_clock_class);
ret = -1;
goto end;
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(integer);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(integer);
end:
return (void *) integer;
struct bt_ctf_clock_class *bt_ctf_field_type_integer_get_mapped_clock_class(
struct bt_ctf_field_type *ft)
{
- return bt_object_get_ref(bt_ctf_field_type_common_integer_borrow_mapped_clock_class(
+ return bt_ctf_object_get_ref(bt_ctf_field_type_common_integer_borrow_mapped_clock_class(
(void *) ft));
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(enumeration);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(enumeration);
end:
return (void *) enumeration;
struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_field_type(
struct bt_ctf_field_type *ft)
{
- return bt_object_get_ref(
+ return bt_ctf_object_get_ref(
bt_ctf_field_type_common_enumeration_borrow_container_field_type(
(void *) ft));
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(structure);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(structure);
end:
return (void *) structure;
(void *) ft, field_name, (void *) field_type, index);
if (ret == 0 && field_type) {
- bt_object_get_ref(*field_type);
+ bt_ctf_object_get_ref(*field_type);
}
return ret;
struct bt_ctf_field_type *bt_ctf_field_type_structure_get_field_type_by_name(
struct bt_ctf_field_type *ft, const char *name)
{
- return bt_object_get_ref(bt_ctf_field_type_common_structure_borrow_field_type_by_name(
+ return bt_ctf_object_get_ref(bt_ctf_field_type_common_structure_borrow_field_type_by_name(
(void *) ft, name));
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(var_ft);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(var_ft);
end:
return (void *) var_ft;
struct bt_ctf_field_type *bt_ctf_field_type_variant_get_tag_field_type(
struct bt_ctf_field_type *ft)
{
- return bt_object_get_ref(bt_ctf_field_type_common_variant_borrow_tag_field_type(
+ return bt_ctf_object_get_ref(bt_ctf_field_type_common_variant_borrow_tag_field_type(
(void *) ft));
}
struct bt_ctf_field_type *ft,
const char *field_name)
{
- return bt_object_get_ref(bt_ctf_field_type_common_variant_borrow_field_type_by_name(
+ return bt_ctf_object_get_ref(bt_ctf_field_type_common_variant_borrow_field_type_by_name(
(void *) ft, field_name));
}
(void *) ft, field_name, (void *) field_type, index);
if (ret == 0 && field_type) {
- bt_object_get_ref(*field_type);
+ bt_ctf_object_get_ref(*field_type);
}
return ret;
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(array);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(array);
end:
return (void *) array;
struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_field_type(
struct bt_ctf_field_type *ft)
{
- return bt_object_get_ref(bt_ctf_field_type_common_array_borrow_element_field_type(
+ return bt_ctf_object_get_ref(bt_ctf_field_type_common_array_borrow_element_field_type(
(void *) ft));
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(sequence);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(sequence);
end:
return (void *) sequence;
struct bt_ctf_field_type *bt_ctf_field_type_sequence_get_element_field_type(
struct bt_ctf_field_type *ft)
{
- return bt_object_get_ref(bt_ctf_field_type_common_sequence_borrow_element_field_type(
+ return bt_ctf_object_get_ref(bt_ctf_field_type_common_sequence_borrow_element_field_type(
(void *) ft));
}
goto end;
}
- copy_ft->mapped_clock_class = bt_object_get_ref(int_ft->mapped_clock_class);
+ copy_ft->mapped_clock_class = bt_ctf_object_get_ref(int_ft->mapped_clock_class);
copy_ft->user_byte_order = int_ft->user_byte_order;
copy_ft->is_signed = int_ft->is_signed;
copy_ft->size = int_ft->size;
ft, copy_ft);
end:
- bt_object_put_ref(container_copy_ft);
+ bt_ctf_object_put_ref(container_copy_ft);
return (void *) copy_ft;
error:
- bt_object_put_ref(container_copy_ft);
- BT_OBJECT_PUT_REF_AND_RESET(copy_ft);
+ bt_ctf_object_put_ref(container_copy_ft);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(copy_ft);
return (void *) copy_ft;
}
return (void *) copy_ft;
error:
- BT_OBJECT_PUT_REF_AND_RESET(copy_ft);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(copy_ft);
return NULL;
}
ft, copy_ft);
end:
- bt_object_put_ref(tag_ft_copy);
+ bt_ctf_object_put_ref(tag_ft_copy);
return (void *) copy_ft;
error:
- bt_object_put_ref(tag_ft_copy);
- BT_OBJECT_PUT_REF_AND_RESET(copy_ft);
+ bt_ctf_object_put_ref(tag_ft_copy);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(copy_ft);
return NULL;
}
ft, copy_ft);
end:
- bt_object_put_ref(container_ft_copy);
+ bt_ctf_object_put_ref(container_ft_copy);
return (void *) copy_ft;
}
ft, copy_ft);
end:
- bt_object_put_ref(container_ft_copy);
+ bt_ctf_object_put_ref(container_ft_copy);
return (void *) copy_ft;
error:
- bt_object_put_ref(container_ft_copy);
- BT_OBJECT_PUT_REF_AND_RESET(copy_ft);
+ bt_ctf_object_put_ref(container_ft_copy);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(copy_ft);
return NULL;
}